function SetUpUserAuthorization() { global $usersIds; global $grants; global $appGrants; global $dataSourceRecordPermissions; $userAuthorizationStrategy = new HardCodedUserAuthorization(new UserIdentitySessionStorage(GetIdentityCheckStrategy()), new HardCodedUserGrantsManager($grants, $appGrants), $usersIds); GetApplication()->SetUserAuthorizationStrategy($userAuthorizationStrategy); GetApplication()->SetDataSourceRecordPermissionRetrieveStrategy(new HardCodedDataSourceRecordPermissionRetrieveStrategy($dataSourceRecordPermissions)); }
function SetUpUserAuthorization() { global $grants; global $appGrants; global $dataSourceRecordPermissions; $hardCodedGrantsManager = new HardCodedUserGrantsManager($grants, $appGrants); $tableBasedGrantsManager = CreateTableBasedGrantsManager(); $grantsManager = new CompositeGrantsManager(); $grantsManager->AddGrantsManager($hardCodedGrantsManager); if (!is_null($tableBasedGrantsManager)) { $grantsManager->AddGrantsManager($tableBasedGrantsManager); GetApplication()->SetUserManager($tableBasedGrantsManager); } $userAuthorizationStrategy = new TableBasedUserAuthorization(new UserIdentitySessionStorage(GetIdentityCheckStrategy()), new MyPDOConnectionFactory(), GetGlobalConnectionOptions(), 'atig_users', 'user_name', 'user_id', $grantsManager); GetApplication()->SetUserAuthorizationStrategy($userAuthorizationStrategy); GetApplication()->SetDataSourceRecordPermissionRetrieveStrategy(new HardCodedDataSourceRecordPermissionRetrieveStrategy($dataSourceRecordPermissions)); }
function GetCurrentUser() { // TODO : use SuperGlobals global $currentUser; if (isset($currentUser)) { return $currentUser; } if (function_exists('GetIdentityCheckStrategy')) { $identityCheckStrategy = GetIdentityCheckStrategy(); if (isset($identityCheckStrategy)) { $storage = new UserIdentityCookieStorage($identityCheckStrategy); $userIdentity = $storage->LoadUserIdentity(); if ($userIdentity != null) { if ($identityCheckStrategy->CheckUsernameAndEncryptedPassword($userIdentity->userName, $userIdentity->password)) { $currentUser = $userIdentity->userName; return $currentUser; } } } } return 'guest'; }
function GetCurrentUser() { // TODO : use SuperGlobals global $currentUser; if (isset($currentUser)) { return $currentUser; } if (isset($_COOKIE['username'])) { if (function_exists('GetIdentityCheckStrategy')) { if (isset($_COOKIE['password'])) { $identityCheckStrategy = GetIdentityCheckStrategy(); if (isset($identityCheckStrategy)) { if ($identityCheckStrategy->CheckUsernameAndEncryptedPassword($_COOKIE['username'], $_COOKIE['password'])) { $currentUser = $_COOKIE['username']; return $currentUser; } } } } } return 'guest'; }
<?php /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ATTENTION! * If you see this message in your browser (Internet Explorer, Mozilla Firefox, Google Chrome, etc.) * this means that PHP is not properly installed on your web server. Please refer to the PHP manual * for more details: http://php.net/manual/install.php * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ include_once dirname(__FILE__) . '/' . 'authorization.php'; include_once dirname(__FILE__) . '/' . 'components/security/user_management_request_handler.php'; SetUpUserAuthorization(); UserManagementRequestHandler::HandleRequest($_GET, CreateTableBasedGrantsManager(), GetIdentityCheckStrategy());
} public function SetFooter($value) { $this->footer = $value; } public function GetFooter() { return $this->RenderText($this->footer); } public function BeginRender() { $this->loginControl->ProcessMessages(); } public function EndRender() { echo $this->renderer->Render($this); } public function addListeners() { $this->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler'); $this->loginControl->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler'); } } $loginPage = new LoginPage(new LoginControl(GetIdentityCheckStrategy(), 'Dashboard.php', GetCaptions('UTF-8'))); SetUpUserAuthorization(); $loginPage->addListeners(); $loginPage->SetHeader(GetPagesHeader()); $loginPage->SetFooter(GetPagesFooter()); $loginPage->BeginRender(); $loginPage->BeginRender(); $loginPage->EndRender();
$this->footer = $value; } public function GetFooter() { return $this->RenderText($this->footer); } public function BeginRender() { $this->loginControl->ProcessMessages(); } public function EndRender() { echo $this->renderer->Render($this); } public function addListeners() { $this->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler'); $this->loginControl->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler'); } } // to start session GetApplication(); $identityCheckStrategy = GetIdentityCheckStrategy(); $userIdentityStorage = new UserIdentitySessionStorage($identityCheckStrategy); $loginPage = new LoginPage(new LoginControl($identityCheckStrategy, 'planificacion.php', GetCaptions('UTF-8'), $userIdentityStorage)); SetUpUserAuthorization(); $loginPage->addListeners(); $loginPage->SetHeader(GetPagesHeader()); $loginPage->SetFooter(GetPagesFooter()); $loginPage->BeginRender(); $loginPage->EndRender();