Package org.marketcetera.admin.service
Interface AuthorizationService
-
public interface AuthorizationServiceProvides services related to users and permissions.- Since:
- 1.0.1
- Version:
- $Id$
- Author:
- Colin DuPlantis
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidauthorize(String inUsername, String inPermissionName)Validate that the user with the given username has been granted the permission with the given permission name.booleanauthorizeNoException(String inUsername, String inPermissionName)Validate that the user with the given username has been granted the permission with the given permission name.voiddeletePermission(String inPermissionName)Delete thePermissionwith the given name.voiddeleteRole(String inRoleName)Delete the role with the given name.List<Permission>findAllPermissions()Find allPermissionvalues.CollectionPageResponse<Permission>findAllPermissions(PageRequest inPageRequest)Find somePermissionvalues.Set<Permission>findAllPermissionsByUsername(String inUsername)Finds allPermissionvalues granted to the user with the given username.List<Role>findAllRoles()Find allRolevalues.CollectionPageResponse<Role>findAllRoles(PageRequest inPageRequest)Find a page ofRolevalues.PermissionfindPermissionByName(String inName)Finds thePermissionwith the given name.RolefindRoleByName(String inName)Finds theRolewith the given name.SupervisorPermissionfindSupervisorPermissionByName(String inName)Find the given supervisor permission by name.Set<User>getSubjectUsersFor(User inSupervisorUser, String inPermissionName)Get the users over which the given user has the given permission.Set<User>getSupervisorsFor(String inUsername, String inPermissionName)Get the users that have the given supervisor permission over the given user.Permissionsave(Permission inPermission)Saves the givenPermission.Rolesave(Role inRole)Saves the givenRole.SupervisorPermissionsave(SupervisorPermission inSupervisorPermission)Save the given supervisor permission value.
-
-
-
Method Detail
-
save
Permission save(Permission inPermission)
Saves the givenPermission.- Parameters:
inPermission- aPermissionvalue- Returns:
- a
Permissionvalue
-
findPermissionByName
Permission findPermissionByName(String inName)
Finds thePermissionwith the given name.- Parameters:
inName- aStringvalue- Returns:
- a
Permissionvalue ornull
-
findRoleByName
Role findRoleByName(String inName)
Finds theRolewith the given name.- Parameters:
inName- aStringvalue- Returns:
- a
Rolevalue ornull
-
save
Role save(Role inRole)
Saves the givenRole.- Parameters:
inRole- aRolevalue- Returns:
- a
Rolevalue
-
findAllRoles
CollectionPageResponse<Role> findAllRoles(PageRequest inPageRequest)
Find a page ofRolevalues.- Parameters:
inPageRequest- aPageRequestvalue- Returns:
- a
CollectionPageResponse<Role>value
-
deleteRole
void deleteRole(String inRoleName)
Delete the role with the given name.- Parameters:
inRoleName- aStringvalue
-
authorize
void authorize(String inUsername, String inPermissionName)
Validate that the user with the given username has been granted the permission with the given permission name.- Parameters:
inUsername- aStringvalueinPermissionName- aStringvalue- Throws:
IllegalArgumentException- if the user or permission name is invalidNotAuthorizedException- if the user and permission are valid but the user has not been granted the permission
-
authorizeNoException
boolean authorizeNoException(String inUsername, String inPermissionName)
Validate that the user with the given username has been granted the permission with the given permission name.This method will return a boolean value indicating if the permission is granted or not.
- Parameters:
inUsername- aStringvalueinPermissionName- aStringvalue- Returns:
- a
booleanvalue - Throws:
IllegalArgumentException- if the user or permission name is invalid
-
getSupervisorsFor
Set<User> getSupervisorsFor(String inUsername, String inPermissionName)
Get the users that have the given supervisor permission over the given user.- Parameters:
inUsername- aStringvalueinPermissionName- aStringvalue- Returns:
- a
Set<User>value - Throws:
IllegalArgumentException- if the user or permission name is invalid
-
findAllPermissionsByUsername
Set<Permission> findAllPermissionsByUsername(String inUsername)
Finds allPermissionvalues granted to the user with the given username.- Parameters:
inUsername- aStringvalue- Returns:
- a
Set<Permissions>value
-
findAllPermissions
List<Permission> findAllPermissions()
Find allPermissionvalues.- Returns:
- a
List<Permission>value
-
findAllPermissions
CollectionPageResponse<Permission> findAllPermissions(PageRequest inPageRequest)
Find somePermissionvalues.- Parameters:
inPageRequest- aPageRequestvalue- Returns:
- a
CollectionPageResponse<Permission>value
-
deletePermission
void deletePermission(String inPermissionName)
Delete thePermissionwith the given name.- Parameters:
inPermissionName- aStringvalue
-
findSupervisorPermissionByName
SupervisorPermission findSupervisorPermissionByName(String inName)
Find the given supervisor permission by name.- Parameters:
inName- aStringvalue- Returns:
- a
SupervisorPermissionornull
-
save
SupervisorPermission save(SupervisorPermission inSupervisorPermission)
Save the given supervisor permission value.- Parameters:
inSupervisorPermission- aSupervisorPermissionvalue- Returns:
- a
SupervisorPermissionvalue
-
-