com.clarkparsia.stardog.security
Interface UserManager


public interface UserManager

API for managing users in Stardog.

Since:
0.9
Version:
2.0
Author:
Blazej Bulka, Hector Perez-Urbina

Method Summary
 void addUser(String theUsername, boolean theSuperuser)
          Deprecated. use addUser(String, boolean, char[]) this method will use the provide username as the initial password
 void addUser(String theUsername, boolean theSuperuser, char[] thePassword)
          Adds a new user.
 void addUserRole(String theUserName, String theRole)
          Assigns a role to a user.
 void changePassword(String theUsername, char[] theNewPassword)
          Changes the password for the user.
 void deleteUser(String theUsername)
          Removes an existing user.
 void deleteUserRole(String theUserName, String theRole)
          Unassigns a role from a user.
 Collection<String> getAllUsers()
          Gets the names of all users in the system that the authenticated user is allowed to see.
 Collection<String> getUserRoles(String theUsername)
          Retrieves all roles of the specified user.
 boolean isSuperUser(String theUsername)
          Checks whether the specified user is a super user
 boolean isUserEnabled(String theUsername)
          Checks whether the specified user is enabled
 void setUserEnabled(String theUsername, boolean theEnabled)
          Enables/disables the user.
 void setUserRoles(String theUserName, Collection<String> theRoles)
          Changes the user roles.
 

Method Detail

addUser

@Deprecated
void addUser(String theUsername,
                        boolean theSuperuser)
             throws com.clarkparsia.stardog.security.StardogSecurityException,
                    com.clarkparsia.stardog.security.ResourceExistsException,
                    com.clarkparsia.stardog.security.StardogAuthorizationException
Deprecated. use addUser(String, boolean, char[]) this method will use the provide username as the initial password

Adds a new user.

Parameters:
theUsername - the username of the new user
theSuperuser - true, if the new user should be a super user; false, otherwise
Throws:
ResourceExistsException - if there is already a user with that name
StardogAuthorizationException - if the current user does not have a permission to create the new user
StardogSecurityException - if the operation should fail for any other reason

addUser

void addUser(String theUsername,
             boolean theSuperuser,
             char[] thePassword)
             throws com.clarkparsia.stardog.security.StardogSecurityException,
                    com.clarkparsia.stardog.security.ResourceExistsException,
                    com.clarkparsia.stardog.security.IllegalPasswordException,
                    com.clarkparsia.stardog.security.StardogAuthorizationException
Adds a new user.

Parameters:
theUsername - the username of the new user
theSuperuser - true, if the new user should be a super user; false, otherwise
thePassword - the initial password for the user
Throws:
ResourceExistsException - if there is already a user with that name
StardogAuthorizationException - if the current user does not have a permission to create the new user
IllegalPasswordException - if the password is invalid
StardogSecurityException - if the operation should fail for any other reason

deleteUser

void deleteUser(String theUsername)
                throws com.clarkparsia.stardog.security.StardogSecurityException,
                       com.clarkparsia.stardog.security.ResourceNotFoundException,
                       com.clarkparsia.stardog.security.OperationNotSupportedException,
                       com.clarkparsia.stardog.security.StardogAuthorizationException
Removes an existing user. It is not possible to remove the last active (enabled) super user from the system.

Parameters:
theUsername - the user to be removed.
Throws:
ResourceNotFoundException - if there is no such username
OperationNotSupportedException - if the operation is not supported for this user (e.g., it is the last active super user in the system).
StardogAuthorizationException - if the current user does not have a permission to remove the user
StardogSecurityException - if the operation should fail for any other reason

getAllUsers

Collection<String> getAllUsers()
                               throws com.clarkparsia.stardog.security.StardogSecurityException
Gets the names of all users in the system that the authenticated user is allowed to see.

Returns:
Throws:
StardogSecurityException - if the operation should fail for any other reason

changePassword

void changePassword(String theUsername,
                    char[] theNewPassword)
                    throws com.clarkparsia.stardog.security.StardogSecurityException,
                           com.clarkparsia.stardog.security.ResourceNotFoundException,
                           com.clarkparsia.stardog.security.StardogAuthorizationException,
                           IllegalArgumentException,
                           com.clarkparsia.stardog.security.IllegalPasswordException
Changes the password for the user. In general, users are only allowed to change their own password. The only exceptions to this rule are: (1) superusers are allowed to change password of any user; (2) some users may not be allowed to change their own password.

Parameters:
theUsername - the name of the user whose password should be changed
theNewPassword - the new password for the user
Throws:
ResourceNotFoundException - if there is no user with the specified name
StardogAuthorizationException - if the current user does not have the permission to change the password for the specified user
StardogSecurityException - if the operation should fail for any other reason
IllegalArgumentException - if the password is empty
IllegalPasswordException - if the password is invalid

getUserRoles

Collection<String> getUserRoles(String theUsername)
                                throws com.clarkparsia.stardog.security.StardogSecurityException,
                                       com.clarkparsia.stardog.security.ResourceNotFoundException,
                                       com.clarkparsia.stardog.security.StardogAuthorizationException
Retrieves all roles of the specified user.

Parameters:
theUsername - the user name whose roles should be retrieved
Returns:
a collection of all role names for the user
Throws:
ResourceNotFoundException - if there is no user with the specified name
StardogAuthorizationException - if the current user does not have the permission to retrieve the roles of the specified user
StardogSecurityException - if the operation should fail for any other reason

setUserRoles

void setUserRoles(String theUserName,
                  Collection<String> theRoles)
                  throws com.clarkparsia.stardog.security.StardogSecurityException,
                         com.clarkparsia.stardog.security.ResourceNotFoundException,
                         com.clarkparsia.stardog.security.StardogAuthorizationException
Changes the user roles.

Parameters:
theUserName - the user name whose roles should be changed
theRoles - a new set of roles for the user (this set will replace the existing set of roles for the user)
Throws:
ResourceNotFoundException - if one of the resources (username or role name) does not exist
StardogAuthorizationException - if the current user does not have the permission to set the roles for the specified user
StardogSecurityException - if the operation should fail for any other reason

addUserRole

void addUserRole(String theUserName,
                 String theRole)
                 throws com.clarkparsia.stardog.security.StardogSecurityException,
                        com.clarkparsia.stardog.security.ResourceNotFoundException,
                        com.clarkparsia.stardog.security.StardogAuthorizationException
Assigns a role to a user.

Parameters:
theUserName - the user name
theRoles - a new role for the user
Throws:
ResourceNotFoundException - if one of the resources (username or role name) does not exist
StardogAuthorizationException - if the current user does not have the permission to set the roles for the specified user
StardogSecurityException - if the operation should fail for any other reason

deleteUserRole

void deleteUserRole(String theUserName,
                    String theRole)
                    throws com.clarkparsia.stardog.security.StardogSecurityException,
                           com.clarkparsia.stardog.security.ResourceNotFoundException,
                           com.clarkparsia.stardog.security.StardogAuthorizationException
Unassigns a role from a user.

Parameters:
theUserName - the user name
theRoles - the role name
Throws:
ResourceNotFoundException - if one of the resources (username or role name) does not exist
StardogAuthorizationException - if the current user does not have the permission to set the roles for the specified user
StardogSecurityException - if the operation should fail for any other reason

isSuperUser

boolean isSuperUser(String theUsername)
                    throws com.clarkparsia.stardog.security.StardogSecurityException,
                           com.clarkparsia.stardog.security.ResourceNotFoundException,
                           com.clarkparsia.stardog.security.StardogAuthorizationException
Checks whether the specified user is a super user

Parameters:
theUsername - the username to be checked
Returns:
true, if the user is a super user; false otherwise
Throws:
ResourceNotFoundException - if there is no such user name
StardogAuthorizationException - if the current user does not have the permission to perform this operation
StardogSecurityException - if the operation should fail for any other reason

isUserEnabled

boolean isUserEnabled(String theUsername)
                      throws com.clarkparsia.stardog.security.StardogSecurityException,
                             com.clarkparsia.stardog.security.ResourceNotFoundException,
                             com.clarkparsia.stardog.security.StardogAuthorizationException
Checks whether the specified user is enabled

Parameters:
theUsername - the username to be checked
Returns:
true, if the user is enabled; false otherwise
Throws:
ResourceNotFoundException - if there is no such user name
StardogAuthorizationException - if the current user does not have the permission to perform this operation
StardogSecurityException - if the operation should fail for any other reason

setUserEnabled

void setUserEnabled(String theUsername,
                    boolean theEnabled)
                    throws com.clarkparsia.stardog.security.StardogSecurityException,
                           com.clarkparsia.stardog.security.ResourceNotFoundException,
                           com.clarkparsia.stardog.security.OperationNotSupportedException,
                           com.clarkparsia.stardog.security.StardogAuthorizationException
Enables/disables the user. This operation must not disable the last active super user in the system.

Parameters:
theUsername - the name of the user to be enabled/disabled
theEnabled - true if the user is to become a enabled (active); false if the user should become disabled
Throws:
ResourceNotFoundException - if there is no such user name
OperationNotSupportedException - if the operation would disable the last super user
StardogAuthorizationException - if the current user does not have the permission to perform this operation
StardogSecurityException - if the operation should fail for any other reason


Copyright © 2010-2013 Clark & Parsia. All Rights Reserved.