示例#1
0
 public function clearRoles(Project $project)
 {
     foreach ($this->userRoles as $userRole) {
         if ($userRole->getProject() == $project) {
             $this->userRoles->removeElement($userRole);
         }
     }
 }
示例#2
0
文件: User.php 项目: ollietb/sulu
 /**
  * Remove userRoles.
  *
  * @param UserRole $userRoles
  */
 public function removeUserRole(UserRole $userRoles)
 {
     $this->userRoles->removeElement($userRoles);
 }
 /**
  * @return User[]
  */
 public function getUserRoles()
 {
     $sortedRoles = $this->userRoles->toArray();
     usort($sortedRoles, function (UserRole $a, UserRole $b) {
         return $a->getUser()->getUsername() < $b->getUser()->getUsername() ? -1 : 1;
     });
     return $sortedRoles;
 }
示例#4
0
 /**
  * @return UserRoleInterface[]
  */
 public function getRoles()
 {
     return $this->userRole->getValues();
 }
示例#5
0
 public function addUserRole(UserRole $userRole)
 {
     $this->userRoles->add($userRole);
 }