public abstract class BasicUserManager extends Object implements IUserManager
| 构造器和说明 |
|---|
BasicUserManager(IUserAccessor accessor)
BasicUserManager Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
createUser(String username,
String password)
Create a user with given username and password.
|
boolean |
deleteUser(String username)
Delete a user.
|
User |
getUser(String username)
Get a user object.
|
boolean |
grantPrivilegeToUser(String username,
String path,
int privilegeId)
Grant a privilege on a seriesPath to a user.
|
boolean |
grantRoleToUser(String roleName,
String username)
Add a role to a user.
|
boolean |
isUserUseWaterMark(String username)
Whether data water-mark is enabled for user 'userName'.
|
List<String> |
listAllUsers()
List all users in the database.
|
void |
replaceAllUsers(Map<String,User> users)
clear all old users info, replace the old users with the new one.
|
void |
reset()
Re-initialize this object.
|
boolean |
revokePrivilegeFromUser(String username,
String path,
int privilegeId)
Revoke a privilege on seriesPath from a user.
|
boolean |
revokeRoleFromUser(String roleName,
String username)
Revoke a role from a user.
|
void |
setUserUseWaterMark(String username,
boolean useWaterMark)
Enable or disable data water-mark for user 'userName'.
|
boolean |
updateUserPassword(String username,
String newPassword)
Modify the password of a user.
|
public BasicUserManager(IUserAccessor accessor) throws AuthException
accessor - user accessorAuthException - Authentication Exceptionpublic User getUser(String username) throws AuthException
IUserManagergetUser 在接口中 IUserManagerusername - The name of the user.AuthException - if an exception is raised when interacting with the lower storage.public boolean createUser(String username, String password) throws AuthException
IUserManagercreateUser 在接口中 IUserManagerusername - is not null or emptypassword - is not null or emptyAuthException - if the given username or password is illegal.public boolean deleteUser(String username) throws AuthException
IUserManagerdeleteUser 在接口中 IUserManagerusername - the username of the user.AuthException - .public boolean grantPrivilegeToUser(String username, String path, int privilegeId) throws AuthException
IUserManagergrantPrivilegeToUser 在接口中 IUserManagerusername - The username of the user to which the privilege should be added.path - The seriesPath on which the privilege takes effect. If the privilege is a
seriesPath-free privilege, this should be "root".privilegeId - An integer that represents a privilege.AuthException - If the user does not exist or the privilege or the seriesPath is illegal.public boolean revokePrivilegeFromUser(String username, String path, int privilegeId) throws AuthException
IUserManagerrevokePrivilegeFromUser 在接口中 IUserManagerusername - The username of the user from which the privilege should be removed.path - The seriesPath on which the privilege takes effect. If the privilege is a
seriesPath-free privilege, this should be "root".privilegeId - An integer that represents a privilege.AuthException - If the user does not exist or the privilege or the seriesPath is illegal.public boolean updateUserPassword(String username, String newPassword) throws AuthException
IUserManagerupdateUserPassword 在接口中 IUserManagerusername - The user whose password is to be modified.newPassword - The new password.AuthException - If the user does not exists.public boolean grantRoleToUser(String roleName, String username) throws AuthException
IUserManagergrantRoleToUser 在接口中 IUserManagerroleName - The name of the role to be added.username - The name of the user to which the role is added.AuthException - If the user does not exist.public boolean revokeRoleFromUser(String roleName, String username) throws AuthException
IUserManagerrevokeRoleFromUser 在接口中 IUserManagerroleName - The name of the role to be removed.username - The name of the user from which the role is removed.AuthException - If the user does not exist.public void reset()
throws AuthException
IUserManagerreset 在接口中 IUserManagerAuthExceptionpublic List<String> listAllUsers()
IUserManagerlistAllUsers 在接口中 IUserManagerpublic boolean isUserUseWaterMark(String username) throws AuthException
IUserManagerisUserUseWaterMark 在接口中 IUserManagerAuthException - if the user does not existpublic void setUserUseWaterMark(String username, boolean useWaterMark) throws AuthException
IUserManagersetUserUseWaterMark 在接口中 IUserManagerAuthException - if the user does not exist.public void replaceAllUsers(Map<String,User> users) throws AuthException
IUserManagerreplaceAllUsers 在接口中 IUserManagerusers - new users infoAuthExceptionCopyright © 2022 The Apache Software Foundation. All rights reserved.