Removes the given role.

@param UserRole $aRole The user role

@throws UserRoleInvalidException        when the role is invalid
@throws UserRoleAlreadyRevokedException when the role is already revoked
496897
public function revoke(UserRole $aRole)
    {
        if (false === $this->isRoleAllowed($aRole)) {
            throw new UserRoleInvalidException();
        }

        $numberOfRoles = count($this->roles);
        for ($index = 0; $index < $numberOfRoles; $index++) {
            $role = $this->roles[$index];

            if ($role->equals($aRole)) {
                unset($this->roles[$index]);
                $this->roles = array_values($this->roles);
                break;
            }
        }
        if ($index === $numberOfRoles) {
            throw new UserRoleAlreadyRevokedException();
        }

        $this->updatedOn = new \DateTimeImmutable();
        $this->publish(
            new UserRoleRevoked(
                $this->id,
                $this->email,
                $aRole
            )
        );
    }
153745
def removeUserFromRole( dbid, userid, roleid )
      @dbid, @userid, @roleid = dbid, userid, roleid 
      
      xmlRequestData = toXML( :userid, @userid )
      xmlRequestData << toXML( :roleid, @roleid )
      
      sendRequest( :removeUserFromRole, xmlRequestData )
      
      return self if @chainAPIcalls
      @requestSucceeded
   end
422987
public function detachRole($role)
    {
        if (is_object($role)) {
            $role = $role->getKey();
        }

        if (is_array($role)) {
            $role = $role['id'];
        }

        $this->roles()->detach($role);

        self::clearCache();
    }
276688
public function removeRole(string $role): PermissionManager
    {
        if (!$this->hasRole($role)) {
            throw new RoleException("Undefined role '{$role}'");
        }

        unset($this->permissions[$role]);

        return $this;
    }
936640
public function setRole(UserInterface $user, array $selectedRole)
    {
        $choices = $this->rolesManager->getChoices();

        if (!isset($choices[$selectedRole['roles']])) {
            throw new InvalidArgumentException(
                sprintf('Impossible to set role %s', $selectedRole['roles'])
            );
        }

        $user->setRoles([$choices[$selectedRole['roles']]]);

        $this->entityManager->flush();
    }
940963
public function delete($userRoleLinker, $tableName = null)
    {
        $this->checkEntity($userRoleLinker);

        return parent::delete(array('user_id' => $userRoleLinker->getUserId(), 'role_id' => $userRoleLinker->getRoleId()));
    }
665644
def remove_role(self, role):
        
        if role in self.__roles:
            self.__roles.remove(role)
956211
def delete_role_from_user(self, role, user):
        
        uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
                utils.get_id(role))
        resp, resp_body = self.method_delete(uri)
1069175
public function removeRole($id, $role)
    {
        $user = $this->getUser($id);

        if (empty($user) || empty($role)) {
            return false;
        }

        // Remove the role from the $user['roles'] array.
        $user['roles'] = array_diff($user['roles'], [(string) $role]);

        return $this->saveUser($user);
    }
7561
protected function applyAcl(\MUtil_Acl $acl, $userRole)
    {
        foreach ($this->_subItems as $item) {

            $allowed = $item->get('allowed', true);

            if ($allowed && ($privilege = $item->get('privilege'))) {
                $allowed = $acl->isAllowed($userRole, null, $privilege);
            }

            if ($allowed) {
                $item->applyAcl($acl, $userRole);
            } else {
                // As an item can be invisible but allowed,
                // but not disallowed but visible we need to
                // set both.
                $item->set('allowed', false);
                $item->set('visible', false);
                $item->setForChildren('allowed', false);
                $item->setForChildren('visible', false);
            }
        }

        return $this;
    }
368350
public function removeRole($role)
    {
        $roleElement = $this->getRole($role);
        if ($roleElement) {
            $this->roles->removeElement($roleElement);
        }

        return $this;
    }
73463
@Override
	public void deleteRole(String rolename) throws RolesException {
		if (role_list.containsKey(rolename)) {
			List<String> users_with_role = role_list.get(rolename);
			for (String user : users_with_role) {
				// Remove the role from this user
				List<String> roles_of_user = user_list.get(user);
				roles_of_user.remove(rolename);
				user_list.put(user, roles_of_user);

				// Update our file_store
				String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
				file_store.setProperty(user, roles);
			}
			// Remove the role entry
			role_list.remove(rolename);

			// And commit the file_store to disk
			try {
				saveRoles();
			} catch (IOException e) {
				throw new RolesException(e);
			}
		} else {
			throw new RolesException("Cannot find role '" + rolename + "'!");
		}
	}
868929
public function revokeRole($role, $user_id)
    {
        $user = \App\User::findorfail($user_id);

        $user->removeRole(str_slug($role, ' '));

        return redirect('scaffold-users/edit/'.$user_id);
    }
273278
def delete_user_role(deleted_user_id, role_id,**kwargs):
    
    #check_perm(kwargs.get('user_id'), 'edit_role')
    try:
        _get_user(deleted_user_id)
        _get_role(role_id)
        roleuser_i = db.DBSession.query(RoleUser).filter(RoleUser.user_id==deleted_user_id, RoleUser.role_id==role_id).one()
        db.DBSession.delete(roleuser_i)
    except NoResultFound:
        raise ResourceNotFoundError("User Role does not exist")

    return 'OK'
1294372
public function removeRoleAssignment(RoleAssignment $roleAssignment)
    {
        if ($this->repository->canUser('role', 'assign', $roleAssignment) !== true) {
            throw new UnauthorizedException('role', 'assign');
        }

        $spiRoleAssignment = $this->userHandler->loadRoleAssignment($roleAssignment->id);

        $this->repository->beginTransaction();
        try {
            $this->userHandler->removeRoleAssignment($spiRoleAssignment->id);
            $this->repository->commit();
        } catch (Exception $e) {
            $this->repository->rollback();
            throw $e;
        }
    }
972986
public function removeRole(RoleInterface $role)
    {
        $this->roles->removeElement($role);

        if ($role->hasUser($this) === true)
            $role->removeUser($this);
        
        return $this;
    }
465707
public function removeWebmasters(Site $site, $userIdList)
    {
        $this->removeUsersWithRole($site, $userIdList, Access::ROLE_WEBMASTER);
    }