本文整理汇总了PHP中ACLRole::getAllRoles方法的典型用法代码示例。如果您正苦于以下问题:PHP ACLRole::getAllRoles方法的具体用法?PHP ACLRole::getAllRoles怎么用?PHP ACLRole::getAllRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACLRole
的用法示例。
在下文中一共展示了ACLRole::getAllRoles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rebuild_dropdown_filters
/**
* Rebuilds cache files for dropdown filters extension
*/
protected function rebuild_dropdown_filters()
{
$roles = ACLRole::getAllRoles();
foreach ($roles as $role) {
$this->rebuild_role_dropdown_filters($role->id);
}
}
示例2: testgetAllRoles
public function testgetAllRoles()
{
$aclRole = new ACLRole();
//test with returnAsArray default/flase
$result = $aclRole->getAllRoles();
$this->assertTrue(is_array($result));
//test with returnAsArray true
$result = $aclRole->getAllRoles(true);
$this->assertTrue(is_array($result));
}
示例3: getRoles
/**
* Returns object storage containing available roles as keys
* and flags indicating if there is role specific metadata as value
*
* @param callable $callback Callback that checks if there is role specific metadata
* @return SplObjectStorage
*/
public static function getRoles($callback = null)
{
global $current_user;
$roles = new SplObjectStorage();
//Only super user should have access to all roles
$allRoles = $current_user->isAdmin() ? ACLRole::getAllRoles() : ACLRole::getUserRoles($current_user->id, false);
foreach ($allRoles as $role) {
if (in_array($role->name, static::$hiddenRoles)) {
continue;
}
$roles[$role] = $callback ? $callback(array('role' => $role->id)) : null;
}
return $roles;
}
示例4: User
/**
* Create a user in the seed data.
*/
function _create_seed_user($id, $last_name, $first_name, $user_name, $title, $is_admin, $reports_to, $reports_to_name, $email)
{
$u = new User();
$u->id = $id;
$u->new_with_id = true;
$u->last_name = $last_name;
$u->first_name = $first_name;
$u->user_name = $user_name;
$u->title = $title;
$u->status = 'Active';
$u->employee_status = 'Active';
$u->is_admin = $is_admin;
$u->is_group = 0;
//$u->user_password = $u->encrypt_password($user_name);
$u->user_hash = User::getPasswordHash($user_name);
$u->reports_to_id = $reports_to;
$u->reports_to_name = $reports_to_name;
//$u->email1 = $email;
$u->emailAddress->addAddress($email, true);
$u->emailAddress->addAddress("reply." . $email, false, true);
$u->emailAddress->addAddress("alias." . $email);
// bug 15371 tyoung set a user preference so that Users/DetailView.php can find something without repeatedly querying the db in vain
$u->setPreference('max_tabs', '7');
$u->savePreferencesToDB();
$u->picture = $this->_copy_user_image($id);
$u->save();
if ($id == "seed_jim_id") {
// add to Sales Administrator Role
$acl_roles = new ACLRole();
$arrRoles = $acl_roles->getAllRoles(true);
foreach ($arrRoles as $role) {
if ($role['name'] == "Sales Administrator") {
$u->load_relationship('aclroles');
$u->aclroles->add($role['id']);
// re-save user manually. otherwise the relation to role set will not be saved
// because One2MBeanRelationship::add() doesn't call SugarRelationship::addToResaveList()
// in workflow and during installation
$u->save();
break;
}
}
}
}