@InterfaceAudience.Private public final class PermissionStorage extends Object
AccessController.
Access control lists are stored in an "internal" metadata table named _acl_. Each table's
permission grants are stored as a separate row, keyed by the table name. KeyValues for
permissions assignments are stored in one of the formats:
Key Desc -------- -------- user table level permissions for a user [R=read, W=write] group table level permissions for a group user,family column family level permissions for a user group,family column family level permissions for a group user,family,qualifier column qualifier level permissions for a user group,family,qualifier column qualifier level permissions for a group
All values are encoded as byte arrays containing the codes from the org.apache.hadoop.hbase.security.access.TablePermission.Action enum.
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
ACL_GLOBAL_NAME |
static char |
ACL_KEY_DELIMITER
Delimiter to separate user, column family, and qualifier in _acl_ table info: column keys
|
static byte[] |
ACL_LIST_FAMILY |
static String |
ACL_LIST_FAMILY_STR
Column family used to store ACL grants
|
static TableName |
ACL_TABLE_NAME
Internal storage table for access control lists
|
static byte |
ACL_TAG_TYPE
KV tag to store per cell access control lists
|
static char |
NAMESPACE_PREFIX |
| Modifier and Type | Method and Description |
|---|---|
static void |
addUserPermission(org.apache.hadoop.conf.Configuration conf,
UserPermission userPerm,
Table t,
boolean mergeExistingPermissions)
Stores a new user permission grant in the access control lists table.
|
static byte[] |
fromNamespaceEntry(byte[] namespace) |
static String |
fromNamespaceEntry(String namespace) |
static List<Permission> |
getCellPermissionsForUser(User user,
Cell cell) |
static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> |
getGlobalPermissions(org.apache.hadoop.conf.Configuration conf) |
static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> |
getNamespacePermissions(org.apache.hadoop.conf.Configuration conf,
String namespace) |
static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> |
getTablePermissions(org.apache.hadoop.conf.Configuration conf,
TableName tableName) |
static List<UserPermission> |
getUserNamespacePermissions(org.apache.hadoop.conf.Configuration conf,
String namespace,
String user,
boolean hasFilterUser)
Returns the currently granted permissions for a given namespace as the specified user plus
associated permissions.
|
static List<UserPermission> |
getUserPermissions(org.apache.hadoop.conf.Configuration conf,
byte[] entryName,
byte[] cf,
byte[] cq,
String user,
boolean hasFilterUser)
Returns the currently granted permissions for a given table/namespace with associated
permissions based on the specified column family, column qualifier and user name.
|
static List<UserPermission> |
getUserTablePermissions(org.apache.hadoop.conf.Configuration conf,
TableName tableName,
byte[] cf,
byte[] cq,
String userName,
boolean hasFilterUser)
Returns the currently granted permissions for a given table as the specified user plus
associated permissions.
|
static boolean |
isGlobalEntry(byte[] entryName) |
static boolean |
isNamespaceEntry(byte[] entryName) |
static boolean |
isNamespaceEntry(String entryName) |
static boolean |
isTableEntry(byte[] entryName) |
static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,Permission> |
readPermissions(byte[] data,
org.apache.hadoop.conf.Configuration conf) |
static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> |
readUserPermission(byte[] data,
org.apache.hadoop.conf.Configuration conf) |
static void |
removeUserPermission(org.apache.hadoop.conf.Configuration conf,
UserPermission userPerm,
Table t)
Removes a previously granted permission from the stored access control lists.
|
static byte[] |
toNamespaceEntry(byte[] namespace) |
static String |
toNamespaceEntry(String namespace) |
static byte[] |
writePermissionsAsBytes(org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> perms,
org.apache.hadoop.conf.Configuration conf)
Writes a set of permissions as
Writable instances and returns the
resulting byte array. |
public static final TableName ACL_TABLE_NAME
public static final byte[] ACL_GLOBAL_NAME
public static final String ACL_LIST_FAMILY_STR
public static final byte[] ACL_LIST_FAMILY
public static final byte ACL_TAG_TYPE
public static final char NAMESPACE_PREFIX
public static final char ACL_KEY_DELIMITER
public static void addUserPermission(org.apache.hadoop.conf.Configuration conf,
UserPermission userPerm,
Table t,
boolean mergeExistingPermissions)
throws IOException
conf - the configurationuserPerm - the details of the permission to be grantedt - acl table instance. It is closed upon method return.IOException - in the case of an error accessing the metadata tablepublic static void removeUserPermission(org.apache.hadoop.conf.Configuration conf,
UserPermission userPerm,
Table t)
throws IOException
TablePermission being removed must exactly match what is stored -- no wildcard matching
is attempted. Ie, if user "bob" has been granted "READ" access to the "data" table, but only to
column family plus qualifier "info:colA", then trying to call this method with only user "bob"
and the table name "data" (but without specifying the column qualifier "info:colA") will have
no effect.conf - the configurationuserPerm - the details of the permission to be revokedt - acl tableIOException - if there is an error accessing the metadata tablepublic static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> getTablePermissions(org.apache.hadoop.conf.Configuration conf, TableName tableName) throws IOException
IOExceptionpublic static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> getNamespacePermissions(org.apache.hadoop.conf.Configuration conf, String namespace) throws IOException
IOExceptionpublic static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> getGlobalPermissions(org.apache.hadoop.conf.Configuration conf) throws IOException
IOExceptionpublic static List<UserPermission> getUserTablePermissions(org.apache.hadoop.conf.Configuration conf, TableName tableName, byte[] cf, byte[] cq, String userName, boolean hasFilterUser) throws IOException
IOExceptionpublic static List<UserPermission> getUserNamespacePermissions(org.apache.hadoop.conf.Configuration conf, String namespace, String user, boolean hasFilterUser) throws IOException
IOExceptionpublic static List<UserPermission> getUserPermissions(org.apache.hadoop.conf.Configuration conf, byte[] entryName, byte[] cf, byte[] cq, String user, boolean hasFilterUser) throws IOException
conf - the configurationentryName - Table name or the namespacecf - Column familycq - Column qualifieruser - User name to be filtered from permission as requestedhasFilterUser - true if filter user is provided, otherwise false.IOException - on failurepublic static byte[] writePermissionsAsBytes(org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> perms, org.apache.hadoop.conf.Configuration conf)
Writable instances and returns the
resulting byte array. Writes a set of permission [user: table permission]public static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,UserPermission> readUserPermission(byte[] data, org.apache.hadoop.conf.Configuration conf) throws DeserializationException
DeserializationExceptionpublic static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,Permission> readPermissions(byte[] data, org.apache.hadoop.conf.Configuration conf) throws DeserializationException
DeserializationExceptionpublic static boolean isGlobalEntry(byte[] entryName)
public static boolean isNamespaceEntry(String entryName)
public static boolean isNamespaceEntry(byte[] entryName)
public static boolean isTableEntry(byte[] entryName)
public static byte[] toNamespaceEntry(byte[] namespace)
public static byte[] fromNamespaceEntry(byte[] namespace)
public static List<Permission> getCellPermissionsForUser(User user, Cell cell) throws IOException
IOExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.