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


PHP ACLRole::getAllRoles方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:ModuleInstaller.php

示例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));
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:10,代码来源:ACLRoleTest.php

示例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;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:21,代码来源:MBHelper.php

示例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;
             }
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:46,代码来源:UserDemoData.php


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