@Component public class DbAuthModule extends Object implements AuthModule, org.springframework.context.ApplicationContextAware
| Constructor and Description |
|---|
DbAuthModule() |
| Modifier and Type | Method and Description |
|---|---|
void |
assignRole(String token,
String user,
String role)
Method to assign a role
|
void |
changeSecurity(String token,
String nodeId,
Map<String,Integer> grantUsers,
Map<String,Integer> revokeUsers,
Map<String,Integer> grantRoles,
Map<String,Integer> revokeRoles,
boolean recursive)
Change several security permissions in the same call.
|
void |
createRole(String token,
String role,
boolean active)
Method to create a new role
|
void |
createUser(String token,
String user,
String password,
String email,
String name,
boolean active)
Method to create a new user
|
void |
deleteRole(String token,
String role)
Method to create a delete a role
|
void |
deleteUser(String token,
String user)
Method to create a delete a user
|
Map<String,Integer> |
getGrantedRoles(String token,
String nodeId)
Get roles permissions from am item (document or folder).
|
Map<String,Integer> |
getGrantedUsers(String token,
String nodeId)
Get user permissions from am item (document or folder).
|
String |
getMail(String token,
String user)
Retrieves the mail from an user.
|
String |
getName(String token,
String user)
Retrieves the name from an user.
|
List<String> |
getRoles(String token)
Retrieves a list of repository roles.
|
List<String> |
getRolesByUser(String token,
String user)
Retrieves a list of roles by user.
|
List<String> |
getUsers(String token)
Retrieves a list of repository users
|
List<String> |
getUsersByRole(String token,
String role)
Retrieves a list of users by role.
|
void |
grantRole(String token,
String nodeId,
String role,
int permissions,
boolean recursive)
Grant role permissions for a node.
|
void |
grantUser(String token,
String nodeId,
String guser,
int permissions,
boolean recursive)
Add user permissions to a node.
|
static void |
loadUserData(String user)
Load user data
|
void |
login()
Logins into the repository.
|
String |
login(String user,
String password) |
void |
logout(String token)
Log out from the repository.
|
void |
removeRole(String token,
String user,
String role)
Method to remove a role
|
void |
revokeRole(String token,
String nodeId,
String role,
int permissions,
boolean recursive)
Revoke role permissions from a node.
|
void |
revokeUser(String token,
String nodeId,
String guser,
int permissions,
boolean recursive)
Revoke user permissions from a node.
|
void |
setApplicationContext(org.springframework.context.ApplicationContext appCtx) |
void |
updateRole(String token,
String role,
boolean active)
Update role information
|
void |
updateUser(String token,
String user,
String password,
String email,
String name,
boolean active)
Update user information
|
public void setApplicationContext(org.springframework.context.ApplicationContext appCtx)
throws org.springframework.beans.BeansException
setApplicationContext in interface org.springframework.context.ApplicationContextAwareorg.springframework.beans.BeansExceptionpublic void login()
throws RepositoryException,
DatabaseException
AuthModulelogin in interface AuthModuleRepositoryExceptionDatabaseExceptionpublic String login(String user, String password) throws AccessDeniedException, RepositoryException, DatabaseException
login in interface AuthModuleAccessDeniedExceptionRepositoryExceptionDatabaseExceptionpublic void logout(String token) throws RepositoryException, DatabaseException
AuthModulelogout in interface AuthModuleRepositoryExceptionDatabaseExceptionpublic void grantUser(String token, String nodeId, String guser, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegrantUser in interface AuthModulenodeId - The complete path to the node or its UUID.guser - User name which permissions are changed.permissions - A mask with the permissions to be added.recursive - recursive – If the nodePath indicated a folder,
the permissions can be applied recursively.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic void revokeUser(String token, String nodeId, String guser, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulerevokeUser in interface AuthModulenodeId - The complete path to the node or its UUID.guser - User name which permissions are changed.permissions - A mask with the permissions to be removed.recursive - If the nodePath indicates a folder, the
permissions can be revoked recursively.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic Map<String,Integer> getGrantedUsers(String token, String nodeId) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegetGrantedUsers in interface AuthModulenodeId - The complete path to the node or its UUID.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic void grantRole(String token, String nodeId, String role, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegrantRole in interface AuthModulenodeId - The complete path to the node or its UUID.role - Role name which permissions are changed.permissions - A mask with the permissions to be added.recursive - If the nodePath indicates a folder, the permissions can
be applied recursively.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic void revokeRole(String token, String nodeId, String role, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulerevokeRole in interface AuthModulenodeId - The complete path to the node or its UUID.role - Role name which permissions are changed.permissions - A mask with the permissions to be removed.recursive - If the nodePath indicates a folder, the
permissions can be applied recursively.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic void changeSecurity(String token, String nodeId, Map<String,Integer> grantUsers, Map<String,Integer> revokeUsers, Map<String,Integer> grantRoles, Map<String,Integer> revokeRoles, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulechangeSecurity in interface AuthModulePathNotFoundExceptionAccessDeniedExceptionRepositoryExceptionDatabaseExceptionpublic Map<String,Integer> getGrantedRoles(String token, String nodeId) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegetGrantedRoles in interface AuthModulenodeId - The complete path to the node or its UUID.PathNotFoundException - If the node defined by nodePath do not exists.AccessDeniedException - If the authorization information is not valid.RepositoryException - If there is any error accessing to the repository.DatabaseExceptionpublic List<String> getUsers(String token) throws PrincipalAdapterException
AuthModulegetUsers in interface AuthModulePrincipalAdapterExceptionpublic List<String> getRoles(String token) throws PrincipalAdapterException
AuthModulegetRoles in interface AuthModulePrincipalAdapterExceptionpublic List<String> getUsersByRole(String token, String role) throws PrincipalAdapterException
AuthModulegetUsersByRole in interface AuthModulePrincipalAdapterExceptionpublic List<String> getRolesByUser(String token, String user) throws PrincipalAdapterException
AuthModulegetRolesByUser in interface AuthModulePrincipalAdapterExceptionpublic String getMail(String token, String user) throws PrincipalAdapterException
AuthModulegetMail in interface AuthModuleuser - The user id.PrincipalAdapterExceptionpublic String getName(String token, String user) throws PrincipalAdapterException
AuthModulegetName in interface AuthModuleuser - The user id.PrincipalAdapterExceptionpublic static void loadUserData(String user) throws PathNotFoundException, AccessDeniedException, ItemExistsException, DatabaseException
public void createUser(String token, String user, String password, String email, String name, boolean active) throws PrincipalAdapterException
AuthModulecreateUser in interface AuthModuleuser - A user id.password - The password of the user.email - The user mail.name - The full user name.PrincipalAdapterException - If any error occurs.public void deleteUser(String token, String user) throws PrincipalAdapterException
AuthModuledeleteUser in interface AuthModuleuser - A user id.PrincipalAdapterException - If any error occurs.public void updateUser(String token, String user, String password, String email, String name, boolean active) throws PrincipalAdapterException
AuthModuleupdateUser in interface AuthModuleuser - A user id.password - The password of the user.email - The user mail.name - The full user name.PrincipalAdapterException - If any error occurs.public void createRole(String token, String role, boolean active) throws PrincipalAdapterException
AuthModulecreateRole in interface AuthModulerole - A role id.PrincipalAdapterException - If any error occurs.public void deleteRole(String token, String role) throws PrincipalAdapterException
AuthModuledeleteRole in interface AuthModulerole - A role id.PrincipalAdapterException - If any error occurs.public void updateRole(String token, String role, boolean active) throws PrincipalAdapterException
AuthModuleupdateRole in interface AuthModulerole - A role id..PrincipalAdapterException - If any error occurs.public void assignRole(String token, String user, String role) throws PrincipalAdapterException
AuthModuleassignRole in interface AuthModuleuser - A user id.role - A role id.PrincipalAdapterException - If any error occurs.public void removeRole(String token, String user, String role) throws PrincipalAdapterException
AuthModuleremoveRole in interface AuthModuleuser - A user id.role - A role id.PrincipalAdapterException - If any error occurs.Copyright © 2016. All rights reserved.