Example #1
0
 /**
  * Add a user to an existing role. This will insert the added role into the users active RoleSet
  * instance upon successful insertion into the database
  *
  * @param Role $role Existing role to be added to
  * @param \RBAC\Subject\SubjectInterface $subject Initialized subject instance
  * @return bool Database execution success status
  */
 public function roleAddSubject(Role $role, SubjectInterface $subject)
 {
     if ($this->roleAddSubjectId($role, $subject->id())) {
         $users_role_set = $subject->getRoleSet();
         $users_role_set->addRole($role);
         $subject->loadRoleSet($users_role_set);
         return true;
     } else {
         return false;
     }
 }