public class FileBasedPrivilegeManager extends Object implements PrivilegeManager
PrivilegeManager
based on user and privilege system tables. The directories of these
system tables are created at the root of warehouse (table-root/user.sys and
table-root/privilege.sys).
User table is the table which stores all user information. The schema of user table is:
Privilege table is the table storing what privileges each user have. Its schema is:
PrivilegeType
IDENTIFIER_WHOLE_CATALOG, PASSWORD_ANONYMOUS, USER_ANONYMOUS, USER_ROOT
Constructor and Description |
---|
FileBasedPrivilegeManager(String warehouse,
FileIO fileIO,
String user,
String password) |
Modifier and Type | Method and Description |
---|---|
void |
createUser(String user,
String password)
Create
user with password . |
void |
dropUser(String user)
Remove
user from the privilege system. |
PrivilegeChecker |
getPrivilegeChecker()
Get
PrivilegeChecker of this privilege system to check if a user has specific
privileges on an object. |
void |
grant(String user,
String identifier,
PrivilegeType privilege)
Grant
user with privilege on identifier . |
void |
initializePrivilege(String rootPassword)
Initialize the privilege system if not enabled.
|
void |
objectDropped(String identifier)
Notify the privilege system that the object with
identifier is dropped. |
void |
objectRenamed(String oldName,
String newName)
Notify the privilege system that the identifier of an object is changed from
oldName
to newName . |
boolean |
privilegeEnabled()
Check if the privilege system is enabled.
|
int |
revoke(String user,
String identifier,
PrivilegeType privilege)
Revoke
privilege from user on identifier . |
public boolean privilegeEnabled()
PrivilegeManager
privilegeEnabled
in interface PrivilegeManager
public void initializePrivilege(String rootPassword)
PrivilegeManager
initializePrivilege
in interface PrivilegeManager
public void createUser(String user, String password)
PrivilegeManager
user
with password
.createUser
in interface PrivilegeManager
public void dropUser(String user)
PrivilegeManager
user
from the privilege system.dropUser
in interface PrivilegeManager
public void grant(String user, String identifier, PrivilegeType privilege)
PrivilegeManager
user
with privilege
on identifier
.grant
in interface PrivilegeManager
public int revoke(String user, String identifier, PrivilegeType privilege)
PrivilegeManager
privilege
from user
on identifier
. Note that user
will
also lose privilege
on all descendants of identifier
.revoke
in interface PrivilegeManager
public void objectRenamed(String oldName, String newName)
PrivilegeManager
oldName
to newName
.objectRenamed
in interface PrivilegeManager
public void objectDropped(String identifier)
PrivilegeManager
identifier
is dropped.objectDropped
in interface PrivilegeManager
public PrivilegeChecker getPrivilegeChecker()
PrivilegeManager
PrivilegeChecker
of this privilege system to check if a user has specific
privileges on an object.getPrivilegeChecker
in interface PrivilegeManager
Copyright © 2023–2024 The Apache Software Foundation. All rights reserved.