/** * Private constructor. Use instance() method to get singleton instance */ private function __construct() { if (isset($_SESSION['user'])) { $this->loggedIn = true; $this->empNumber = $_SESSION['empID']; $this->loggedInUserId = $_SESSION['user']; $orangeAuth = new AuthorizeService($this->empNumber, $_SESSION['isAdmin']); $roleList = $orangeAuth->getRoles(); if (!empty($roleList)) { foreach ($roleList as $role => $inRole) { if ($inRole) { $this->roles[] = $role; } } } // If an admin, get admin group permissions if ($this->hasRole(Auth::ADMIN_ROLE)) { $permissions = $this->_getRightsForUserGroup($_SESSION['userGroup']); } } else { $this->loggedIn = false; } }
public static function getCurrentUserId() { if (empty(self::$currentUserId)) { self::$currentUserId = @$_SESSION['user']; } return self::$currentUserId; }