@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!");
		}
	}
@ 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 ) ) { roles_of_user . remove ( oldrole ) ; user_list . put ( username , roles_of_user ) ; 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 ) ; } String roles = StringUtils . join ( roles_of_user . toArray ( new String [ 0 ] ) , "," ) ; file_store . setProperty ( username , roles ) ; 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!" ) ; } }
Remove a role from a user.

@param username
The username of the user.
@param oldrole
The role to remove from the user.
@throws RolesException
if there was an error during removal.