public class OKMAuth extends Object implements AuthModule
| Modifier and Type | Method and Description |
|---|---|
void |
assignRole(String token,
String user,
String role)
Method to assign a role
|
void |
changeSecurity(String token,
String nodePath,
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 nodePath)
Get roles permissions from am item (document or folder).
|
Map<String,Integer> |
getGrantedUsers(String token,
String nodePath)
Get user permissions from am item (document or folder).
|
static OKMAuth |
getInstance() |
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 nodePath,
String role,
int permissions,
boolean recursive)
Grant role permissions for a node.
|
void |
grantUser(String token,
String nodePath,
String user,
int permissions,
boolean recursive)
Add user permissions to a node.
|
void |
login()
Logins into the repository.
|
String |
login(String user,
String pass) |
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 nodePath,
String role,
int permissions,
boolean recursive)
Revoke role permissions from a node.
|
void |
revokeUser(String token,
String nodePath,
String user,
int permissions,
boolean recursive)
Revoke user permissions from a node.
|
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 static OKMAuth getInstance()
public void login()
throws RepositoryException,
DatabaseException
AuthModulelogin in interface AuthModuleRepositoryExceptionDatabaseExceptionpublic String login(String user, String pass) throws AccessDeniedException, RepositoryException, DatabaseException
login in interface AuthModuleAccessDeniedExceptionRepositoryExceptionDatabaseExceptionpublic void logout(String token) throws RepositoryException, DatabaseException
AuthModulelogout in interface AuthModuleRepositoryExceptionDatabaseExceptionpublic void grantUser(String token, String nodePath, String user, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegrantUser in interface AuthModulenodePath - The complete path to the node or its UUID.user - 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 nodePath, String user, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulerevokeUser in interface AuthModulenodePath - The complete path to the node or its UUID.user - 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 nodePath) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegetGrantedUsers in interface AuthModulenodePath - 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 nodePath, String role, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegrantRole in interface AuthModulenodePath - 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 nodePath, String role, int permissions, boolean recursive) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulerevokeRole in interface AuthModulenodePath - 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 Map<String,Integer> getGrantedRoles(String token, String nodePath) throws PathNotFoundException, AccessDeniedException, RepositoryException, DatabaseException
AuthModulegetGrantedRoles in interface AuthModulenodePath - 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 void changeSecurity(String token, String nodePath, 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 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 © 2017 Open Knowledge Management System S.L.. All rights reserved.