~eventum-developers/eventum/trunk

« back to all changes in this revision

Viewing changes to lib/eventum/class.auth.php

  • Committer: Bryan Alsdorf
  • Date: 2013-08-23 03:50:34 UTC
  • mto: (4033.1.168 eventum-skysql)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: bryan@montyprogram.com-20130823035034-7f5r3pt1xg0xnnhk
Initial commit of CRM migration

Show diffs side-by-side

added added

removed removed

Lines of Context:
150
150
            self::redirect(APP_RELATIVE_URL . "select_project.php?url=" . urlencode($_SERVER['REQUEST_URI']), $is_popup);
151
151
        }
152
152
        // check the expiration date for a 'Customer' type user
153
 
        $customer_id = User::getCustomerID($usr_id);
154
153
        $contact_id = User::getCustomerContactID($usr_id);
155
 
        if ((!empty($customer_id)) && ($customer_id != -1) &&
156
 
                (!empty($contact_id)) && (Customer::hasCustomerIntegration($prj_id))) {
157
 
 
158
 
            Customer::authenticateCustomer($prj_id, $customer_id, $contact_id);
 
154
        if ((!empty($contact_id)) && (CRM::hasCustomerIntegration($prj_id))) {
 
155
            $crm = CRM::getInstance($prj_id);
 
156
            $crm->authenticateCustomer();
159
157
        }
160
158
 
161
159
        // auto switch project
542
540
 
543
541
 
544
542
    /**
 
543
     * Returns the current customer ID.
 
544
     *
 
545
     * @param bool $redirect
 
546
     * @return  string  The current customer ID
 
547
     */
 
548
    public static function getCurrentCustomerID($redirect=true)
 
549
    {
 
550
        $customer_id = Session::get("current_customer_id");
 
551
        if (empty($customer_id) && $redirect == true) {
 
552
            self::redirect(APP_RELATIVE_URL . "select_customer.php");
 
553
        } else {
 
554
            return $customer_id;
 
555
        }
 
556
    }
 
557
 
 
558
 
 
559
    public static function setCurrentCustomerID($customer_id)
 
560
    {
 
561
        Session::set("current_customer_id", $customer_id);
 
562
    }
 
563
 
 
564
 
 
565
    /**
 
566
     * @static
 
567
     * @return Contact
 
568
     */
 
569
    public static function getCurrentContact()
 
570
    {
 
571
        $crm = CRM::getInstance(self::getCurrentProject());
 
572
        return $crm->getContact(User::getCustomerContactID(self::getUserID()));
 
573
    }
 
574
 
 
575
 
 
576
    /**
545
577
     * Sets the current selected project for the user session.
546
578
     *
547
579
     * @access  public
603
635
        }
604
636
    }
605
637
 
 
638
 
606
639
    /**
607
640
     * @static
608
641
     * @return Abstract_Auth_Backend