当前位置: 首页>>代码示例>>PHP>>正文


PHP fAuthorization::setUserAuthLevel方法代码示例

本文整理汇总了PHP中fAuthorization::setUserAuthLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP fAuthorization::setUserAuthLevel方法的具体用法?PHP fAuthorization::setUserAuthLevel怎么用?PHP fAuthorization::setUserAuthLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fAuthorization的用法示例。


在下文中一共展示了fAuthorization::setUserAuthLevel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: User

<?php

include './resources/init.php';
if (isset($_POST['type'])) {
    if ($_POST['type'] == "logout") {
        fAuthorization::destroyUserInfo();
    } else {
        if ($_POST['type'] == "login") {
            try {
                $user = new User($_POST['username']);
            } catch (fException $e) {
                fURL::redirect(URL_ROOT . "authentication.php");
            }
            if (sha1($_POST['password']) == $user->getPassword()) {
                fAuthorization::setUserAuthLevel($user->getLevel());
                fAuthorization::setUserToken($_POST['username']);
                fURL::redirect(fAuthorization::getRequestedUrl(true, URL_ROOT . "inventory.php"));
            } else {
                fURL::redirect(URL_ROOT . "authentication.php");
            }
        }
    }
} else {
    if (isset($_GET['type']) == "logout") {
        fAuthorization::destroyUserInfo();
    }
}
$tmpl->place('header');
$tmpl->place('menu');
?>
<div class="span-24 last">
开发者ID:JhunCabas,项目名称:material-management,代码行数:31,代码来源:authentication.php

示例2: UserPermission

         fAuthorization::setUserAuthLevel('super');
         break;
     case 2:
         fAuthorization::setUserAuthLevel('admin');
         break;
     case 3:
     case 4:
     case 5:
     case 6:
     case 7:
     case 8:
         fAuthorization::setUserAuthLevel('employee');
         break;
     case 9:
     default:
         fAuthorization::setUserAuthLevel('guest');
         break;
 }
 $up = new UserPermission();
 $tmp = $up->getByIdUser($u->prepareIdUser());
 $permissions = array('banner' => array(), 'news' => array(), 'classified' => array(), 'social' => array(), 'poll' => array(), 'turism' => array(), 'plaza' => array(), 'autoplus' => array(), 'real' => array(), 'user' => array(), 'franchise' => array());
 foreach ($tmp as $item) {
     switch ($item->prepareIdPermission()) {
         case 1:
             $permissions['banner'][] = 'add';
             break;
         case 2:
             $permissions['banner'][] = 'edit';
             break;
         case 3:
             $permissions['banner'][] = 'delete';
开发者ID:nevermind89x,项目名称:Mi-morelia,代码行数:31,代码来源:login2.php

示例3: testCheckLoggedIn2

 public function testCheckLoggedIn2()
 {
     $this->assertEquals(FALSE, fAuthorization::checkLoggedIn());
     fAuthorization::setAuthLevels(array('user' => 20, 'admin' => 50));
     fAuthorization::setUserAuthLevel('admin');
     $this->assertEquals(TRUE, fAuthorization::checkLoggedIn());
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:7,代码来源:fAuthorizationTest.php

示例4: login

 /**
  * Attempt to login, and register through fAuthorization when successful.
  * 
  * @throws sfNotFoundException		When no user by provided username exists
  * @throws sfBadPasswordException	When the given password fails to match
  * 
  * @param string $username 			Username for attempted login
  * @param string $password 			Provided password to match
  * @return boolean 					True when successful
  */
 public static function login($username, $password)
 {
     $login_attempt = sfCore::make('sfUser');
     // will throw sfNotFoundException if not available
     $login_attempt->loadByUsername($username);
     if (!$login_attempt->matchPassword($password)) {
         throw new sfBadPasswordException();
         return;
     }
     fAuthorization::setUserAuthLevel($login_attempt->getLevel());
     fAuthorization::setUserToken($username);
     static::evaluateSession();
     return true;
 }
开发者ID:rizqidjamaluddin,项目名称:Swoosh,代码行数:24,代码来源:sfUsers.php


注:本文中的fAuthorization::setUserAuthLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。