Example #1
0
File: User.php Project: j7mbo/aurex
 /**
  * @param Role $role
  *
  * @return $this
  */
 public function addRole($role)
 {
     if (!$this->roles->contains($role)) {
         $this->roles->add($role);
     }
     return $this;
 }
Example #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;
 }
Example #3
0
 /**
  * @param Role $role
  *
  * @return $this
  */
 public function addAuthorizedRole(Role $role)
 {
     $this->authorizedRoles->add($role);
     return $this;
 }
Example #4
0
File: User.php Project: 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);
     }
 }
Example #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);
     }
 }
Example #7
0
 public function addChildren(Role $child, $setParentToChild = true)
 {
     $this->children->add($child);
     $setParentToChild && $child->setParent($this, false);
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function addRole(Role $role)
 {
     if (!$this->inRole($role)) {
         $this->roles->add($role);
     }
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public function addAuthorizationRole(RoleInterface $role)
 {
     if (!$this->hasAuthorizationRole($role)) {
         $this->authorizationRoles->add($role);
     }
 }
Example #10
0
 /**
  * Add a child.
  *
  * @param  RoleInterface|string $child
  * @return RoleInterface
  */
 public function addChild($child)
 {
     $this->children->add($child);
     return $this;
 }
Example #11
0
 public function addRole(Movie $movie, $roles = null)
 {
     $roles = is_array($roles) ? $roles : [];
     $this->roles->add(new Role($this, $movie, $roles));
 }