コード例 #1
0
ファイル: User.php プロジェクト: blitzik/CMS
 /**
  * @return array
  */
 public function getRoles()
 {
     $rolesEntities = $this->roles->toArray();
     $roles = [];
     foreach ($rolesEntities as $role) {
         $roles[$role->getId()] = $role->getName();
     }
     return $roles;
 }
コード例 #2
0
ファイル: User.php プロジェクト: Maksold/platform
 /**
  * {@inheritdoc}
  */
 public function getRoles()
 {
     $roles = $this->roles->toArray();
     /** @var Group $group */
     foreach ($this->groups as $group) {
         $roles = array_merge($roles, $group->getRoles());
     }
     return array_values(array_unique($roles));
 }
コード例 #3
0
ファイル: User.php プロジェクト: j7mbo/aurex
 /**
  * @return Role[]
  *
  * @note Every user must *at least* have ROLE_USER as a role
  */
 public function getRoles()
 {
     return array_unique(array_merge($this->roles->toArray(), ['ROLE_USER']));
 }
コード例 #4
0
ファイル: User.php プロジェクト: ngydat/CoreBundle
 /**
  * Returns the user's roles as an array of entities. The roles
  * owned by groups the user is a member are included by default.
  *
  * @param bool $areGroupsIncluded
  *
  * @return array[Role]
  */
 public function getEntityRoles($areGroupsIncluded = true)
 {
     $roles = array();
     if ($this->roles) {
         $roles = $this->roles->toArray();
     }
     if ($areGroupsIncluded) {
         foreach ($this->getGroups() as $group) {
             foreach ($group->getEntityRoles() as $role) {
                 if (!in_array($role, $roles)) {
                     $roles[] = $role;
                 }
             }
         }
     }
     return $roles;
 }
コード例 #5
0
 /**
  * @return Role[]
  */
 public function getRoles()
 {
     return $this->roles->toArray();
 }
コード例 #6
0
ファイル: Mailbox.php プロジェクト: 2ndkauboy/platform
 /**
  * @return Role[]
  */
 public function getAuthorizedRoles()
 {
     return $this->authorizedRoles->toArray();
 }