Skip to content

Commit

Permalink
chore: make defaults more harmless if parts of the scripts are accide…
Browse files Browse the repository at this point in the history
…ntally executed (#49)
  • Loading branch information
jnussbaum authored Oct 15, 2023
1 parent 8a436cc commit 7fb00c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions dsp_permissions_scripts/models/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,8 @@ def remove(
D={builtin_groups.CREATOR, builtin_groups.PROJECT_MEMBER},
V={builtin_groups.UNKNOWN_USER, builtin_groups.KNOWN_USER},
)

PRIVATE = PermissionScope.create(
CR={builtin_groups.PROJECT_ADMIN, builtin_groups.CREATOR},
V={builtin_groups.PROJECT_MEMBER},
)
6 changes: 3 additions & 3 deletions dsp_permissions_scripts/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def modify_aps(aps: list[Ap]) -> list[Ap]:
"""Adapt this sample to your needs."""
modified_aps = []
for ap in aps:
if ap.forGroup == builtin_groups.PROJECT_MEMBER:
if ap.forGroup == builtin_groups.UNKNOWN_USER:
if ApValue.ProjectAdminGroupAllPermission not in ap.hasPermissions:
ap.add_permission(ApValue.ProjectAdminGroupAllPermission)
modified_aps.append(ap)
Expand All @@ -33,7 +33,7 @@ def modify_doaps(doaps: list[Doap]) -> list[Doap]:
"""Adapt this sample to your needs."""
modified_doaps = []
for doap in doaps:
if doap.target.group in [builtin_groups.PROJECT_MEMBER, builtin_groups.PROJECT_ADMIN]:
if doap.target.group == builtin_groups.UNKNOWN_USER:
doap.scope = PUBLIC
modified_doaps.append(doap)
return modified_doaps
Expand Down Expand Up @@ -69,7 +69,7 @@ def update_aps(
host=host,
token=token,
existing_aps=project_aps,
forGroup=builtin_groups.PROJECT_MEMBER,
forGroup=builtin_groups.UNKNOWN_USER,
)
modified_aps = modify_aps(remaining_aps)
apply_updated_aps_on_server(
Expand Down

0 comments on commit 7fb00c5

Please sign in to comment.