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)); }
<?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());
} else { return $defaultValue; } } public function GetShowPageList() { return true; } public function GetShortCaption() { return $this->GetCaption(); } public function GetCaption() { return $this->GetLocalizerCaptions()->GetMessageString('AdminPage'); } public function GetPageFileName() { return basename(__FILE__); } } $tableBasedGrants = CreateTableBasedGrantsManager(); $page = new AdminPage($tableBasedGrants); $page->setHeader(GetPagesHeader()); $page->setFooter(GetPagesFooter()); $page->OnGetCustomTemplate->AddListener('Global_GetCustomTemplateHandler'); if (!GetApplication()->GetUserAuthorizationStrategy()->HasAdminGrant(GetApplication()->GetCurrentUser())) { RaiseSecurityError($page, 'You do not have permission to access this page.'); } $renderer = new ViewRenderer($page->GetLocalizerCaptions()); echo $renderer->Render($page);
<?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'; include_once dirname(__FILE__) . '/' . 'components/security/user_identity_storage/user_identity_session_storage.php'; SetUpUserAuthorization(); $identityCheckStrategy = GetIdentityCheckStrategy(); UserManagementRequestHandler::HandleRequest($_GET, CreateTableBasedGrantsManager(), $identityCheckStrategy, new UserIdentitySessionStorage($identityCheckStrategy));