Skip to content

Commit

Permalink
Merge pull request #406 from hkad98/trivial
Browse files Browse the repository at this point in the history
TRIVIAL: fix wrong definition for workspace permissions

Reviewed-by: Jan Kadlec
             https://github.com/hkad98
  • Loading branch information
gdgate authored Nov 2, 2023
2 parents 5af29ca + 49ac3a5 commit dbe406a
Show file tree
Hide file tree
Showing 7 changed files with 2,291 additions and 50 deletions.
2 changes: 1 addition & 1 deletion gooddata-sdk/gooddata_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
)
from gooddata_sdk.catalog.permission.declarative_model.manage_dashboard_permissions import (
CatalogDashboardAssigneeIdentifier,
CatalogPermissionsForAssignee,
CatalogPermissionsForAssigneeIdentifier,
CatalogPermissionsForAssigneeRule,
)
from gooddata_sdk.catalog.permission.declarative_model.permission import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CatalogDashboardAssigneeIdentifier(CatalogAssigneeIdentifier):


@attr.s(auto_attribs=True, kw_only=True)
class CatalogPermissionsForAssignee(Base):
class CatalogPermissionsForAssigneeIdentifier(Base):
permissions: List[str] = attr.field(factory=list)
assignee_identifier: CatalogAssigneeIdentifier

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def client_class() -> Type[DeclarativeWorkspacePermissions]:
@attr.s(auto_attribs=True, kw_only=True)
class CatalogDeclarativeDashboardPermissionsForAssignee(Base):
name: str = attr.field(validator=value_in_allowed)
assignee_identifier: CatalogAssigneeIdentifier
assignee: CatalogAssigneeIdentifier

@staticmethod
def client_class() -> Type[DeclarativeAnalyticalDashboardPermissionForAssignee]:
Expand Down
12 changes: 7 additions & 5 deletions gooddata-sdk/gooddata_sdk/catalog/permission/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
CatalogDeclarativeOrganizationPermission,
CatalogDeclarativeWorkspacePermissions,
CatalogOrganizationPermissionAssignment,
CatalogPermissionsForAssignee,
CatalogPermissionsForAssigneeIdentifier,
CatalogPermissionsForAssigneeRule,
GoodDataApiClient,
)
Expand Down Expand Up @@ -87,7 +87,9 @@ def manage_dashboard_permissions(
self,
workspace_id: str,
dashboard_id: str,
permissions_for_assignee: List[Union[CatalogPermissionsForAssignee, CatalogPermissionsForAssigneeRule]],
permissions_for_assignee: List[
Union[CatalogPermissionsForAssigneeIdentifier, CatalogPermissionsForAssigneeRule]
],
) -> None:
"""Provide managing dashboard permissions for user and user groups.
Expand All @@ -96,9 +98,9 @@ def manage_dashboard_permissions(
Workspace identification string. e.g. "demo"
dashboard_id (str):
Dashboard identification string. e.g. "campaign"
permissions_for_assignee ([CatalogPermissionsForAssignee]):
Object containing List of users and user group and desired dashboard permissions. Set empty list
permissions for user/user group means remove dashboard permissions.
permissions_for_assignee ([Union[CatalogPermissionsForAssignee, CatalogPermissionsForAssigneeRule]]):
Object containing a List of permission assignments. An empty list of permissions in the assignment
removes existing dashboard permissions.
Returns:
None
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def structure_permissions(
) -> Union[
CatalogDeclarativeDashboardPermissionsForAssignee, CatalogDeclarativeDashboardPermissionsForAssigneeRule
]:
if v.get("assignee_identifier") is not None:
if v.get("assignee") is not None:
return structure(v, CatalogDeclarativeDashboardPermissionsForAssignee)
else:
return structure(v, CatalogDeclarativeDashboardPermissionsForAssigneeRule)
Expand Down
Loading

0 comments on commit dbe406a

Please sign in to comment.