public class LocalUserAdministration extends Object implements UserAdministration
Constructor and Description |
---|
LocalUserAdministration(UserSession session) |
Modifier and Type | Method and Description |
---|---|
void |
addUser(String username,
String allowedHost,
String password)
Add a new user to the database, this user will be allowed to connected from the specified host or all hosts
if the wildcard '*' is used.
|
void |
deleteUser(String username)
Deletes a user from the database, does not revoke grants
|
List<String> |
getUsers()
Gets a list of all the users
|
void |
grant(String username,
String object,
AccessMode mode)
GrantObject the user access to the specified object with the given access level
|
void |
revoke(String username,
String object)
Revokes a grant for a given user
|
public LocalUserAdministration(UserSession session) throws JasDBStorageException
JasDBStorageException
public void addUser(String username, String allowedHost, String password) throws JasDBStorageException
UserAdministration
addUser
in interface UserAdministration
username
- The name of the userallowedHost
- The allowed host, '*' for wildcardpassword
- The password of the userJasDBStorageException
- If unable to create the user due to insufficient permissionspublic void deleteUser(String username) throws JasDBStorageException
UserAdministration
deleteUser
in interface UserAdministration
username
- The name of the userJasDBStorageException
- If unable to delete the user due to insufficient permissionspublic List<String> getUsers() throws JasDBStorageException
UserAdministration
getUsers
in interface UserAdministration
JasDBStorageException
- If unable to get the list of userspublic void grant(String username, String object, AccessMode mode) throws JasDBStorageException
UserAdministration
grant
in interface UserAdministration
username
- The usernameobject
- The object to grant permissions tomode
- The mode of allowed accessJasDBStorageException
- If unable to grant, for example with insufficient permissionspublic void revoke(String username, String object) throws JasDBStorageException
UserAdministration
revoke
in interface UserAdministration
username
- The user to revoke the grant fromobject
- The object to revoke onJasDBStorageException
- If unable to revoke the grant, for example with insufficient permissionseCopyright © 2015. All rights reserved.