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


PHP role::setId方法代码示例

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


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

示例1: updateRoles

 private function updateRoles()
 {
     $this->allRoles = array();
     $this->roles = array();
     $this->restRoles = array();
     foreach ($this->connection->query("SELECT * FROM role") as $roleRow) {
         $role = new role();
         $role->setId($roleRow['rid']);
         $role->setRole($roleRow['role']);
         array_push($this->allRoles, $role);
     }
     $publicRole = new role();
     $publicRole->setId(-1);
     $publicRole->setRole("Public");
     array_push($this->allRoles, $publicRole);
     $sqlEx = $this->connection->query("SELECT * FROM pluginrole WHERE pluginId='" . $this->id . "';");
     foreach ($sqlEx as $row) {
         foreach ($this->allRoles as $role) {
             if ($role->getId() == $row['roleId']) {
                 $role->setAccessRights($row['access']);
                 array_push($this->roles, $role);
             }
         }
     }
     foreach ($this->allRoles as $role) {
         if (!in_array($role, $this->roles)) {
             array_push($this->restRoles, $role);
         }
     }
 }
开发者ID:hersche,项目名称:Peta,代码行数:30,代码来源:plugin.php

示例2: mkRoleObjects

 public static function mkRoleObjects($dbRoles)
 {
     $roleObjects = array();
     foreach ($dbRoles as $dbRole) {
         $roleObject = new role();
         $roleObject->setId($dbRole['rid']);
         $roleObject->setRole($dbRole['role']);
         $roleObjects[] = $roleObject;
     }
     return $roleObjects;
 }
开发者ID:hersche,项目名称:Peta,代码行数:11,代码来源:user.php

示例3: alienuser

    if (usertools::containRoles($GLOBALS["adminRoles"], $_SESSION["user"]->getRoles())) {
        $template->assign("admin", true);
        $admin = true;
    }
    $user = $_SESSION["user"];
    if ($admin) {
        $user->setAdmin(true);
    }
    $template->assign("user", $user);
}
if ($user == Null) {
    $user = new alienuser();
    $user->setId(-1);
    $user->setUsername("Public");
    $role = new role();
    $role->setId(-1);
    $role->setRole("Public");
    $user->addRoleToRam($role);
    $_SESSION["user"] = $user;
    $template->assign("user", $user);
}
$instancedPluginManager = new instancedPluginManager($user, $template, $connection);
$allowedPluginInstances = array();
$pluginInstance = Null;
$allowed = False;
$allowedAccess = "Null";
$fn = basename($_SERVER['PHP_SELF']);
foreach ($instancedPluginManager->getInstancedPlugins() as $pI) {
    foreach ($user->getRoles() as $uRole) {
        foreach ($pI->getUsedRoles() as $pRole) {
            if ($pRole->getId() == $uRole->getId()) {
开发者ID:hersche,项目名称:Peta,代码行数:31,代码来源:default.php


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