Package org.apache.hadoop.ozone.om
Class OMMultiTenantManagerImpl
java.lang.Object
org.apache.hadoop.ozone.om.OMMultiTenantManagerImpl
- All Implemented Interfaces:
OMMultiTenantManager
Implements OMMultiTenantManager.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassImplements tenant authorizer operations.classImplements tenant cache operations. -
Field Summary
FieldsFields inherited from interface org.apache.hadoop.ozone.om.OMMultiTenantManager
OZONE_TENANT_RANGER_POLICY_DESCRIPTION, OZONE_TENANT_RANGER_ROLE_DESCRIPTION -
Constructor Summary
ConstructorsConstructorDescriptionOMMultiTenantManagerImpl(OzoneManager ozoneManager, org.apache.hadoop.hdds.conf.OzoneConfiguration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoidPasses check only when caller is an Ozone (cluster) admin, throws OMException otherwise.voidcheckTenantAdmin(String tenantId, boolean delegated) Check if caller is a tenant admin of the specified tenant.voidcheckTenantExistence(String tenantId) Check if the tenantId exists in the table, throws TENANT_NOT_FOUND if not.Generate and return a mapping from roles to a set of user principals from tenantCache.org.apache.hadoop.hdds.conf.OzoneConfigurationgetConf()org.apache.hadoop.ozone.om.OMMetadataManagerReturns the corresponding OzoneManager instance.Returns the instance of OMRangerBGSyncService.getTenantAdminRoleName(String tenantId) Retrieve admin role name of the given tenant.getTenantForAccessID(String accessID) Given an access ID return its corresponding tenant.org.apache.hadoop.ozone.om.multitenant.TenantgetTenantFromDBById(String tenantId) Get Tenant object of given tenant name from OM DB.getTenantUserRoleName(String tenantId) Retrieve user role name of the given tenant.getTenantVolumeName(String tenantId) Retrieve volume name of the tenant.getUserNameGivenAccessId(String accessId) Given an accessId, return kerberos user name for the tenant user.booleanisTenantAdmin(org.apache.hadoop.security.UserGroupInformation callerUgi, String tenantId, boolean delegated) Returns true if user is the tenant's admin or Ozone admin, false otherwise.booleanisTenantEmpty(String tenantId) Returns true if the tenant doesn't have any accessIds assigned to it Returns false otherwise.booleanisUserAccessIdPrincipalOrTenantAdmin(String accessId, org.apache.hadoop.security.UserGroupInformation ugi) org.apache.hadoop.ozone.om.helpers.TenantUserListlistUsersInTenant(String tenantID, String prefix) List all the user and accessIDs of all users that belong to this Tenant.voidstart()Start the Ranger policy and role sync thread.voidstop()Stop the Ranger policy and role sync thread.
-
Field Details
-
OZONE_OM_TENANT_DEV_SKIP_RANGER
- See Also:
-
-
Constructor Details
-
OMMultiTenantManagerImpl
public OMMultiTenantManagerImpl(OzoneManager ozoneManager, org.apache.hadoop.hdds.conf.OzoneConfiguration conf) throws IOException - Throws:
IOException
-
-
Method Details
-
getOMRangerBGSyncService
Description copied from interface:OMMultiTenantManagerReturns the instance of OMRangerBGSyncService.- Specified by:
getOMRangerBGSyncServicein interfaceOMMultiTenantManager
-
start
Start the Ranger policy and role sync thread.- Specified by:
startin interfaceOMMultiTenantManager- Throws:
IOException
-
stop
Stop the Ranger policy and role sync thread.- Specified by:
stopin interfaceOMMultiTenantManager- Throws:
IOException
-
getOmMetadataManager
public org.apache.hadoop.ozone.om.OMMetadataManager getOmMetadataManager()Description copied from interface:OMMultiTenantManagerReturns the corresponding OzoneManager instance.- Specified by:
getOmMetadataManagerin interfaceOMMultiTenantManager- Returns:
- OMMetadataManager
-
getAuthorizerOp
- Specified by:
getAuthorizerOpin interfaceOMMultiTenantManager
-
getCacheOp
- Specified by:
getCacheOpin interfaceOMMultiTenantManager
-
getUserNameGivenAccessId
Description copied from interface:OMMultiTenantManagerGiven an accessId, return kerberos user name for the tenant user.- Specified by:
getUserNameGivenAccessIdin interfaceOMMultiTenantManager
-
isTenantAdmin
public boolean isTenantAdmin(org.apache.hadoop.security.UserGroupInformation callerUgi, String tenantId, boolean delegated) Returns true if user is the tenant's admin or Ozone admin, false otherwise.- Specified by:
isTenantAdminin interfaceOMMultiTenantManager- Parameters:
callerUgi- caller's UserGroupInformationtenantId- tenant namedelegated- if set to true, checks if the user is a delegated tenant admin; if set to false, checks if the user is a tenant admin, delegated or not
-
listUsersInTenant
public org.apache.hadoop.ozone.om.helpers.TenantUserList listUsersInTenant(String tenantID, String prefix) throws IOException Description copied from interface:OMMultiTenantManagerList all the user and accessIDs of all users that belong to this Tenant. Note this read is unprotected. See OzoneManager#listUserInTenant- Specified by:
listUsersInTenantin interfaceOMMultiTenantManager- Parameters:
tenantID-- Returns:
- List of users
- Throws:
IOException
-
getTenantForAccessID
Description copied from interface:OMMultiTenantManagerGiven an access ID return its corresponding tenant.- Specified by:
getTenantForAccessIDin interfaceOMMultiTenantManager- Parameters:
accessID-- Returns:
- String tenant name
- Throws:
IOException
-
getConf
public org.apache.hadoop.hdds.conf.OzoneConfiguration getConf() -
checkAdmin
public void checkAdmin() throws org.apache.hadoop.ozone.om.exceptions.OMExceptionDescription copied from interface:OMMultiTenantManagerPasses check only when caller is an Ozone (cluster) admin, throws OMException otherwise.- Specified by:
checkAdminin interfaceOMMultiTenantManager- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException- PERMISSION_DENIED
-
checkTenantAdmin
public void checkTenantAdmin(String tenantId, boolean delegated) throws org.apache.hadoop.ozone.om.exceptions.OMException Description copied from interface:OMMultiTenantManagerCheck if caller is a tenant admin of the specified tenant. Ozone admins will always pass this check. Throws PERMISSION_DENIED if the check failed.- Specified by:
checkTenantAdminin interfaceOMMultiTenantManager- Parameters:
tenantId- tenant namedelegated- if set to true, only delegated tenant admins can pass this check; if false, both delegated and non-delegated tenant admins will pass this check.- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException- PERMISSION_DENIED
-
checkTenantExistence
public void checkTenantExistence(String tenantId) throws org.apache.hadoop.ozone.om.exceptions.OMException Description copied from interface:OMMultiTenantManagerCheck if the tenantId exists in the table, throws TENANT_NOT_FOUND if not.- Specified by:
checkTenantExistencein interfaceOMMultiTenantManager- Throws:
org.apache.hadoop.ozone.om.exceptions.OMException
-
getTenantVolumeName
Description copied from interface:OMMultiTenantManagerRetrieve volume name of the tenant. Throws OMException TENANT_NOT_FOUND if tenantId doesn't exist.- Specified by:
getTenantVolumeNamein interfaceOMMultiTenantManager- Throws:
IOException
-
getTenantUserRoleName
Description copied from interface:OMMultiTenantManagerRetrieve user role name of the given tenant.- Specified by:
getTenantUserRoleNamein interfaceOMMultiTenantManager- Parameters:
tenantId- tenant name- Returns:
- tenant user role name
- Throws:
IOException
-
getTenantAdminRoleName
Description copied from interface:OMMultiTenantManagerRetrieve admin role name of the given tenant.- Specified by:
getTenantAdminRoleNamein interfaceOMMultiTenantManager- Parameters:
tenantId- tenant name- Returns:
- tenant user role name
- Throws:
IOException
-
getTenantFromDBById
public org.apache.hadoop.ozone.om.multitenant.Tenant getTenantFromDBById(String tenantId) throws IOException Description copied from interface:OMMultiTenantManagerGet Tenant object of given tenant name from OM DB.- Specified by:
getTenantFromDBByIdin interfaceOMMultiTenantManager- Parameters:
tenantId- tenant name- Returns:
- Tenant
- Throws:
IOException
-
isUserAccessIdPrincipalOrTenantAdmin
public boolean isUserAccessIdPrincipalOrTenantAdmin(String accessId, org.apache.hadoop.security.UserGroupInformation ugi) throws IOException - Specified by:
isUserAccessIdPrincipalOrTenantAdminin interfaceOMMultiTenantManager- Throws:
IOException
-
isTenantEmpty
Description copied from interface:OMMultiTenantManagerReturns true if the tenant doesn't have any accessIds assigned to it Returns false otherwise.- Specified by:
isTenantEmptyin interfaceOMMultiTenantManager- Parameters:
tenantId-- Throws:
IOException
-
getTenantCache
-
getAllRolesFromCache
Generate and return a mapping from roles to a set of user principals from tenantCache. -
getAuthorizerLock
- Specified by:
getAuthorizerLockin interfaceOMMultiTenantManager
-