コード例 #1
0
ファイル: authorization.php プロジェクト: jsrxar/dto
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));
}
コード例 #2
0
ファイル: authorization.php プロジェクト: eroncalli/atig
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));
}
コード例 #3
0
ファイル: security_info.php プロジェクト: howareyoucolin/demo
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';
}
コード例 #4
0
ファイル: security_info.php プロジェクト: howareyoucolin/demo
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';
}
コード例 #5
0
<?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());
コード例 #6
0
    }
    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();
コード例 #7
0
        $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();