Skip to content

Commit

Permalink
Permission testing (#126)
Browse files Browse the repository at this point in the history
Co-authored-by: Serge Smertin <259697+nfx@users.noreply.github.com>
  • Loading branch information
HariGS-DB and nfx authored Sep 1, 2023
1 parent 72d8ad9 commit fc2f8c0
Show file tree
Hide file tree
Showing 3 changed files with 427 additions and 47 deletions.
8 changes: 4 additions & 4 deletions src/databricks/labs/ucx/inventory/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def inventorize_permissions(self):
logger.info("Permissions were inventorized and saved")

@staticmethod
def __prepare_request_for_permissions_api(
def _prepare_request_for_permissions_api(
item: PermissionsInventoryItem,
migration_state: GroupMigrationState,
destination: Literal["backup", "account"],
Expand Down Expand Up @@ -146,7 +146,7 @@ def _prepare_permission_request_for_secrets_api(
)

@staticmethod
def __prepare_request_for_roles_and_entitlements(
def _prepare_request_for_roles_and_entitlements(
item: PermissionsInventoryItem, migration_state: GroupMigrationState, destination
) -> RolesAndEntitlementsRequestPayload:
# TODO: potential BUG - why does item.object_id hold a group name and not ID?
Expand All @@ -164,11 +164,11 @@ def _prepare_new_permission_request(
if isinstance(item.request_object_type, RequestObjectType) and isinstance(
item.typed_object_permissions, ObjectPermissions
):
return self.__prepare_request_for_permissions_api(item, migration_state, destination)
return self._prepare_request_for_permissions_api(item, migration_state, destination)
elif item.logical_object_type == LogicalObjectType.SECRET_SCOPE:
return self._prepare_permission_request_for_secrets_api(item, migration_state, destination)
elif item.logical_object_type in [LogicalObjectType.ROLES, LogicalObjectType.ENTITLEMENTS]:
return self.__prepare_request_for_roles_and_entitlements(item, migration_state, destination)
return self._prepare_request_for_roles_and_entitlements(item, migration_state, destination)
else:
logger.warning(
f"Unsupported permissions payload for object {item.object_id} "
Expand Down
Loading

0 comments on commit fc2f8c0

Please sign in to comment.