Remove role from given user.

        Args:
            user (string): User name.
            role (string): Role to remove.

        Raises:
            requests.HTTPError on failure.
769023
def delete_user_role(self, user, role):
        
        self.project_service.set_auth(self._token_project)
        self.project_service.delete_user_role(user, role)
998167
def create_user(self, username, password, roles):
    
    return users.create_user(self, username, password, roles)
945554
def add_role_to_user(self, role, user):
        
        uri = "users/%s/roles/OS-KSADM/%s" % (utils.get_id(user),
                utils.get_id(role))
        resp, resp_body = self.method_put(uri)
1154173
def remove_user(self, name):
        
        user = self.get_user(name)
        users = self.get_users()
        users.remove(user)
602276
@Override
	public void removeRole(String username, String oldrole) throws RolesException {
		List<String> users_with_role = new ArrayList<String>();

		if (user_list.containsKey(username)) {
			List<String> roles_of_user = user_list.get(username);
			if (roles_of_user.contains(oldrole)) {
				// Update our user list
				roles_of_user.remove(oldrole);
				user_list.put(username, roles_of_user);
				// Update our roles list
				if (role_list.containsKey(oldrole))
					users_with_role = role_list.get(oldrole);
				users_with_role.remove(username);
				if (users_with_role.size() < 1) {
					role_list.remove(oldrole);
				} else {
					role_list.put(oldrole, users_with_role);
				}

				// Don't forget to update our file_store
				String roles = StringUtils.join(roles_of_user.toArray(new String[0]), ",");
				file_store.setProperty(username, roles);

				// And commit the file_store to disk
				try {
					saveRoles();
				} catch (IOException e) {
					throw new RolesException(e);
				}
			} else {
				throw new RolesException("User '" + username + "' does not have the role '" + oldrole + "'!");
			}
		} else {
			throw new RolesException("User '" + username + "' does not exist!");
		}
	}
265897
public void unmap(final RestletUtilUser user, final Role role)
    {
        this.unmap(role, SesameRealmConstants.OAS_ROLEMAPPEDUSER, user.getIdentifier());
    }
961800
def remove_role(self, databaseName, roleName, collectionName=None):
        
        role = {"databaseName" : databaseName,
                "roleName" : roleName}
        
        if collectionName:
            role["collectionName"] = collectionName
        
        if role in self.roles:
            self.roles.remove(role)
674629
def delete_user(self, user_id):
        
        api = self._get_api(iam.AccountAdminApi)
        api.delete_user(user_id)
        return
1339243
def roles_remove(user, role):
    """"""
    user, role = _datastore._prepare_role_modify_args(user, role)
    if user is None:
        raise click.UsageError('Cannot find user.')
    if role is None:
        raise click.UsageError('Cannot find role.')
    if _datastore.remove_role_from_user(user, role):
        click.secho('Role "{0}" removed from user "{1}" '
                    'successfully.'.format(role, user), fg='green')
    else:
        raise click.UsageError('Cannot remove role from user.')
449481
def delete_user(self, name):
        
        self._api_delete('/api/users/{0}'.format(
            urllib.parse.quote_plus(name)
        ))
491838
def add_role(user, roles):
        
        def _add_role(role):
            user_role = UserRole()
            user_role.user_id = user.user_id
            user_role.role_id = role.role_id
            db.session.add(user_role)
            db.session.commit()
        [_add_role(role) for role in roles]
348172
def remove_role role
      raise ArgumentError, '#remove_role takes a single role String or Symbol as the argument' if !role || role.kind_of?(Array)
      remove_roles role
    end
1315279
def remove_user(config, group, username):
        """"""
        client = Client()
        client.prepare_connection()
        group_api = API(client)
        try:
            group_api.remove_user(group, username)
        except ldap_tools.exceptions.NoGroupsFound:  # pragma: no cover
            print("Group ({}) not found".format(group))
        except ldap_tools.exceptions.TooManyResults:  # pragma: no cover
            print("Query for group ({}) returned multiple results.".format(
                group))
        except ldap3.NO_SUCH_ATTRIBUTE:  # pragma: no cover
            print("{} does not exist in {}".format(username, group))
1016400
def RemoveUser(self, user):
    
    self.logger.info('Removing user %s.', user)
    if self.remove:
      command = self.userdel_cmd.format(user=user)
      try:
        subprocess.check_call(command.split(' '))
      except subprocess.CalledProcessError as e:
        self.logger.warning('Could not remove user %s. %s.', user, str(e))
      else:
        self.logger.info('Removed user account %s.', user)
    self._RemoveAuthorizedKeys(user)
    self._UpdateSudoer(user, sudoer=False)
536611
def _role_remove(name, user=None, host=None, port=None, maintenance_db=None,
                 password=None, runas=None):
    '''
    
    '''

    # check if user exists
    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        log.info('User \'%s\' does not exist', name)
        return False

    # user exists, proceed
    sub_cmd = 'DROP ROLE "{0}"'.format(name)
    _psql_prepare_and_run(
        ['-c', sub_cmd],
        runas=runas, host=host, user=user, port=port,
        maintenance_db=maintenance_db, password=password)

    if not user_exists(name, user, host, port, maintenance_db,
                       password=password, runas=runas):
        return True
    else:
        log.info('Failed to delete user \'%s\'.', name)
        return False
683131
def delete_user(self, user):
        
        name = utils.get_name(user)
        self._user_manager.delete(name)
1255076
def remove_role_from_user(self, user, role):
        
        user, role = self._prepare_role_modify_args(user, role)
        result = self.UserRole.select().where(
            self.UserRole.user == user,
            self.UserRole.role == role,
        )
        if result.count():
            query = self.UserRole.delete().where(
                self.UserRole.user == user, self.UserRole.role == role)
            query.execute()
            return True
        else:
            return False