本文整理汇总了PHP中role::setRole方法的典型用法代码示例。如果您正苦于以下问题:PHP role::setRole方法的具体用法?PHP role::setRole怎么用?PHP role::setRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类role
的用法示例。
在下文中一共展示了role::setRole方法的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);
}
}
}
示例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;
}
示例3: alienuser
$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()) {
if (!in_array($pI, $allowedPluginInstances)) {