Difference between revisions of "OKMAuth"

From OpenKM Documentation
Jump to: navigation, search
(void revokeRole(String token, String nodePath, String user, int permissions, boolean recursive))
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TOCright}} __TOC__
+
__TOC__
  
 
Methods related to authentication, granting and revoking privileges.
 
Methods related to authentication, granting and revoking privileges.
  
== String login(String user, String pas) ==
+
== String login(String user, String pass) ==
Login into the repository and gets a token with user info for future API invocations
+
Login into the repository and gets an authorization token with user info for future API invocations
  
 
'''Parameters'''
 
'''Parameters'''
* user - User nam for login.
+
* ''user'' - User nam for login.
* pass - Password for login.
+
* ''pass'' - Password for login.
  
 
'''Returns'''
 
'''Returns'''
Line 14: Line 14:
  
 
'''Throws'''
 
'''Throws'''
* UserAlreadyLoggerException - If the user is already logged into the system.   
+
* ''UserAlreadyLoggerException'' - If the user is already logged into the system.   
* AccessDeniedException - If authorization fails.
+
* ''AccessDeniedException'' - If authorization fails.
* RepositoryException - If there is an error accessing to repository.
+
* ''RepositoryException'' - If there is an error accessing to repository.
  
 
== void logout(String token) ==
 
== void logout(String token) ==
Line 22: Line 22:
  
 
'''Parameters'''
 
'''Parameters'''
* token - The session authorization token.
+
* ''token'' - The session authorization token.
  
 
'''Returns'''
 
'''Returns'''
Line 28: Line 28:
  
 
'''Throws'''
 
'''Throws'''
* AccessDeniedException - If token is not valid.
+
* ''AccessDeniedException'' - If token is not valid.
* RepositoryException If there is an error accessing to repository.
+
* ''RepositoryException'' - If there is an error accessing to repository.
  
 
== StringArray getUsers(String token) ==
 
== StringArray getUsers(String token) ==
Line 35: Line 35:
  
 
'''Parameters'''
 
'''Parameters'''
* token The session authorization token.
+
* ''token'' - The session authorization token.
  
 
'''Returns'''
 
'''Returns'''
Line 41: Line 41:
  
 
'''Throws'''
 
'''Throws'''
* RepositoryException If there is any error retrieving the users list.
+
* ''RepositoryException'' - If there is any error retrieving the users list.
  
 
== StringArray getRoles(String token) ==
 
== StringArray getRoles(String token) ==
Line 47: Line 47:
  
 
'''Parameters'''
 
'''Parameters'''
* token The session authorization token.
+
* ''token'' - The session authorization token.
  
 
'''Returns'''
 
'''Returns'''
Line 53: Line 53:
  
 
'''Throws'''
 
'''Throws'''
* RepositoryException If there is any error retrieving the roles list.
+
* ''RepositoryException'' - If there is any error retrieving the roles list.
 +
 
 +
== void grantUser(String token, String nodePath, String user, int permissions, boolean recursive) ==
 +
Add user permissions to a node.
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
* ''user'' - User 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.
 +
 
 +
'''Returns'''
 +
* none
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid.
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
 +
 
 +
== void revokeUser(String token, String nodePath, String user, int permissions, boolean recursive) ==
 +
Revoke user permissions from a node.
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
* ''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.
 +
 
 +
'''Returns'''
 +
* none
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
 +
 
 +
== BytePairArray getGrantedUsers(String token, String nodePath) ==
 +
Get user permissions from a node (document or folder).
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
 
 +
'''Returns'''
 +
* A hashmap with pairs of user / permissions.
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
 +
 
 +
== void grantRole(String token, String nodePath, String role, int permissions, boolean recursive) ==
 +
Grant role permissions for a node.
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
* ''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.
 +
 
 +
'''Returns'''
 +
* none
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
 +
 
 +
== void revokeRole(String token, String nodePath, String role, int permissions, boolean recursive) ==
 +
Revoke role permissions from a node.
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
* ''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.
 +
 
 +
'''Returns'''
 +
* none
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
 +
 
 +
== BytePairArray getGrantedRoles(String token, String nodePath) ==
 +
Get roles permissions from a node (document or folder).
 +
 
 +
'''Parameters'''
 +
* ''token'' - The session authorization token.
 +
* ''nodePath'' - The complete path to the node.
 +
 
 +
'''Returns'''
 +
* A hashmap with pairs of role / permissions.
 +
 
 +
'''Throws'''
 +
* ''ItemNotFoundException'' - If the node defined by nodePath do not exists.
 +
* ''AccessDeniedException'' - If the token authorization information is not valid
 +
* ''RepositoryException'' - If there is any error accessing to the repository.
  
 
[[Category: Webservices Guide]]
 
[[Category: Webservices Guide]]

Latest revision as of 19:25, 18 April 2012

Methods related to authentication, granting and revoking privileges.

String login(String user, String pass)

Login into the repository and gets an authorization token with user info for future API invocations

Parameters

  • user - User nam for login.
  • pass - Password for login.

Returns

  • A token with authorization session info for next API invocations.

Throws

  • UserAlreadyLoggerException - If the user is already logged into the system.
  • AccessDeniedException - If authorization fails.
  • RepositoryException - If there is an error accessing to repository.

void logout(String token)

Log out from the repository. Invalidates the authorization token.

Parameters

  • token - The session authorization token.

Returns

  • none

Throws

  • AccessDeniedException - If token is not valid.
  • RepositoryException - If there is an error accessing to repository.

StringArray getUsers(String token)

Retrieves a list of repository users.

Parameters

  • token - The session authorization token.

Returns

  • A collection of repository users.

Throws

  • RepositoryException - If there is any error retrieving the users list.

StringArray getRoles(String token)

Retrieves a list of repository roles.

Parameters

  • token - The session authorization token.

Returns

  • A collection of repository roles.

Throws

  • RepositoryException - If there is any error retrieving the roles list.

void grantUser(String token, String nodePath, String user, int permissions, boolean recursive)

Add user permissions to a node.

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.
  • user - User 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.

Returns

  • none

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid.
  • RepositoryException - If there is any error accessing to the repository.

void revokeUser(String token, String nodePath, String user, int permissions, boolean recursive)

Revoke user permissions from a node.

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.
  • 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.

Returns

  • none

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid
  • RepositoryException - If there is any error accessing to the repository.

BytePairArray getGrantedUsers(String token, String nodePath)

Get user permissions from a node (document or folder).

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.

Returns

  • A hashmap with pairs of user / permissions.

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid
  • RepositoryException - If there is any error accessing to the repository.

void grantRole(String token, String nodePath, String role, int permissions, boolean recursive)

Grant role permissions for a node.

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.
  • 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.

Returns

  • none

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid
  • RepositoryException - If there is any error accessing to the repository.

void revokeRole(String token, String nodePath, String role, int permissions, boolean recursive)

Revoke role permissions from a node.

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.
  • 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.

Returns

  • none

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid
  • RepositoryException - If there is any error accessing to the repository.

BytePairArray getGrantedRoles(String token, String nodePath)

Get roles permissions from a node (document or folder).

Parameters

  • token - The session authorization token.
  • nodePath - The complete path to the node.

Returns

  • A hashmap with pairs of role / permissions.

Throws

  • ItemNotFoundException - If the node defined by nodePath do not exists.
  • AccessDeniedException - If the token authorization information is not valid
  • RepositoryException - If there is any error accessing to the repository.