com.bazaarvoice.emodb.auth.role.RoleManager Maven / Gradle / Ivy
package com.bazaarvoice.emodb.auth.role;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
/**
* Interface for managing roles and the permissions associated with those roles.
*/
public interface RoleManager {
/**
* Gets a role by ID.
* @return The role, or null of no role with the ID exists
*/
Role getRole(RoleIdentifier id);
/**
* Gets all roles associated with a group.
* @return The roles for the group, or an empty list if no roles exist for the group
*/
List getRolesByGroup(@Nullable String group);
/**
* Gets all roles defined.
* @return A role iterator. If no roles exist the iterator will be empty
*/
Iterator getAll();
/**
* Gets all permissions associated with a role.
* @return The permissions. If the role does not exist returns an empty set
*/
Set getPermissionsForRole(RoleIdentifier id);
/**
* Creates a role.
* @return The role
* @throws RoleExistsException Another role with the same ID exists
*/
Role createRole(RoleIdentifier id, RoleModification modification);
/**
* Updates a role. This method can be used to update the role's metadata and/or permissions.
* @throws RoleNotFoundException No role with the ID exists
*/
void updateRole(RoleIdentifier id, RoleModification modification);
/**
* Deletes a role. If the role does not exist no action is performed.
*/
void deleteRole(RoleIdentifier id);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy