Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TRIVIAL: fix wrong definition for workspace permissions #406

Merged
3 commits merged into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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