protected function setUp() { parent::setUp(); $this->deleteAllUsers(); $this->createNewUsers(); SessionUtils::saveSessionObject('user', $this->usersArray['admin']); }
<?php include "config.base.php"; include "include.common.php"; if (defined('MODULE_PATH')) { SessionUtils::saveSessionObject("modulePath", MODULE_PATH); } define('CLIENT_PATH', dirname(__FILE__)); include CLIENT_PATH . "/include.common.php"; include CLIENT_PATH . "/server.includes.inc.php"; $user = SessionUtils::getSessionObject('user'); $profileCurrent = null; $profileSwitched = null; $profileClass = ucfirst(SIGN_IN_ELEMENT_MAPPING_FIELD_NAME); $profileVar = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME; if (!empty($user->{$profileVar})) { $profileCurrent = BaseService::getInstance()->getElement($profileClass, $user->{$profileVar}, null, true); if (!empty($profileCurrent)) { $profileCurrent = FileService::getInstance()->updateProfileImage($profileCurrent); } } if ($user->user_level == 'Admin' || $user->user_level == 'Manager') { $switchedEmpId = BaseService::getInstance()->getCurrentProfileId(); if ($switchedEmpId != $user->{$profileVar} && !empty($switchedEmpId)) { $profileSwitched = BaseService::getInstance()->getElement($profileClass, $switchedEmpId, null, true); if (!empty($profileSwitched)) { $profileSwitched = FileService::getInstance()->updateProfileImage($profileSwitched); } } } $activeProfile = null;
public function setCurrentAdminProfile($profileId) { if (!class_exists('SessionUtils')) { include APP_BASE_PATH . "include.common.php"; } if ($profileId == "-1") { SessionUtils::saveSessionObject('admin_current_profile', null); return; } if ($this->currentUser->user_level == 'Admin') { SessionUtils::saveSessionObject('admin_current_profile', $profileId); } else { if ($this->currentUser->user_level == 'Manager') { $signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME; $signInMappingFieldTable = ucfirst($signInMappingField); $subordinate = new $signInMappingFieldTable(); $signInMappingField = SIGN_IN_ELEMENT_MAPPING_FIELD_NAME; $subordinates = $subordinate->Find("supervisor = ?", array($this->currentUser->{$signInMappingField})); $subFound = false; foreach ($subordinates as $sub) { if ($sub->id == $profileId) { $subFound = true; break; } } if (!$subFound) { return; } SessionUtils::saveSessionObject('admin_current_profile', $profileId); } } }
define('CLIENT_PATH', dirname(__FILE__)); include "config.base.php"; include "include.common.php"; include "server.includes.inc.php"; if (empty($user)) { if (!empty($_REQUEST['username']) && !empty($_REQUEST['password'])) { $suser = null; $ssoUserLoaded = false; if (empty($suser)) { $suser = new User(); $suser->Load("(username = ? or email = ?) and password = ?", array($_REQUEST['username'], $_REQUEST['username'], md5($_REQUEST['password']))); } if ($suser->password == md5($_REQUEST['password']) || $ssoUserLoaded) { $user = $suser; SessionUtils::saveSessionObject('user', $user); $suser->last_login = date("Y-m-d H:i:s"); $suser->Save(); if (!$ssoUserLoaded && !empty(BaseService::getInstance()->auditManager)) { BaseService::getInstance()->auditManager->user = $user; BaseService::getInstance()->audit(IceConstants::AUDIT_AUTHENTICATION, "User Login"); } if ($user->user_level == "Admin") { header("Location:" . HOME_LINK_ADMIN); } else { header("Location:" . HOME_LINK_OTHERS); } } else { header("Location:" . CLIENT_BASE_URL . "login.php?f=1"); } }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Ice Framework. If not, see <http://www.gnu.org/licenses/>. ------------------------------------------------------------------ Original work Copyright (c) 2012 [Gamonoid Media Pvt. Ltd] Developer: Thilina Hasantha (thilina.hasantha[at]gmail.com / facebook.com/thilinah) */ include 'includes.inc.php'; if (empty($user)) { $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; SessionUtils::saveSessionObject('loginRedirect', $actual_link); header("Location:" . CLIENT_BASE_URL . "login.php"); } if (empty($user->default_module)) { if ($user->user_level == "Admin") { $homeLink = HOME_LINK_ADMIN; } else { $homeLink = HOME_LINK_OTHERS; } } else { $defaultModule = new Module(); $defaultModule->Load("id = ?", array($user->default_module)); $homeLink = CLIENT_BASE_URL . "?g=" . $defaultModule->mod_group . "&&n=" . $defaultModule->name . "&m=" . $defaultModule->mod_group . "_" . str_replace(" ", "_", $defaultModule->menu); } //Check Module Permissions $modulePermissions = BaseService::getInstance()->loadModulePermissions($_REQUEST['g'], $_REQUEST['n'], $user->user_level);