示例#1
0
文件: User.php 项目: j7mbo/aurex
 /**
  * @param Role $role
  *
  * @return $this
  */
 public function addRole($role)
 {
     if (!$this->roles->contains($role)) {
         $this->roles->add($role);
     }
     return $this;
 }
示例#2
0
 /**
  * Adds a Role to the Collection.
  *
  * @param  Role $role
  *
  * @return User
  */
 public function addRole(Role $role)
 {
     if (!$this->hasRole($role)) {
         $this->roles->add($role);
     }
     return $this;
 }
示例#3
0
 /**
  * @param Role $role
  *
  * @return $this
  */
 public function addAuthorizedRole(Role $role)
 {
     $this->authorizedRoles->add($role);
     return $this;
 }
示例#4
0
文件: User.php 项目: blitzik/CMS
 /**
  * @param Role $role
  */
 public function addRole(Role $role)
 {
     $this->roles->add($role);
 }
 /**
  * @param Role $role
  */
 public function addRole(Role $role)
 {
     if (!$this->roles->contains($role)) {
         $this->roles->add($role);
     }
 }
示例#6
0
 /**
  * Replace the old platform roles of a user by a new array.
  *
  * @param $platformRoles
  */
 public function setPlatformRoles($platformRoles)
 {
     $roles = $this->getEntityRoles();
     $removedRoles = array();
     foreach ($roles as $role) {
         if ($role->getType() != Role::WS_ROLE) {
             $removedRoles[] = $role;
         }
     }
     foreach ($removedRoles as $removedRole) {
         $this->roles->removeElement($removedRole);
     }
     foreach ($platformRoles as $platformRole) {
         $this->roles->add($platformRole);
     }
 }
示例#7
0
 public function addChildren(Role $child, $setParentToChild = true)
 {
     $this->children->add($child);
     $setParentToChild && $child->setParent($this, false);
 }
示例#8
0
 /**
  * {@inheritdoc}
  */
 public function addRole(Role $role)
 {
     if (!$this->inRole($role)) {
         $this->roles->add($role);
     }
 }
示例#9
0
 /**
  * {@inheritdoc}
  */
 public function addAuthorizationRole(RoleInterface $role)
 {
     if (!$this->hasAuthorizationRole($role)) {
         $this->authorizationRoles->add($role);
     }
 }
示例#10
0
 /**
  * Add a child.
  *
  * @param  RoleInterface|string $child
  * @return RoleInterface
  */
 public function addChild($child)
 {
     $this->children->add($child);
     return $this;
 }
示例#11
0
 public function addRole(Movie $movie, $roles = null)
 {
     $roles = is_array($roles) ? $roles : [];
     $this->roles->add(new Role($this, $movie, $roles));
 }