Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Jul 25, 2024
1 parent 295e5ce commit c605552
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions dsp_permissions_scripts/models/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from dsp_permissions_scripts.models.errors import EmptyScopeError
from dsp_permissions_scripts.models.group import CREATOR
from dsp_permissions_scripts.models.group import KNOWN_USER
from dsp_permissions_scripts.models.group import PROJECT_ADMIN
from dsp_permissions_scripts.models.group import PROJECT_MEMBER
from dsp_permissions_scripts.models.group import UNKNOWN_USER
Expand Down Expand Up @@ -123,7 +122,7 @@ def remove(
PUBLIC = PermissionScope.create(
CR={PROJECT_ADMIN},
M={PROJECT_MEMBER},
V={UNKNOWN_USER, KNOWN_USER},
V={UNKNOWN_USER},
)

PRIVATE = PermissionScope.create(
Expand Down
13 changes: 6 additions & 7 deletions dsp_permissions_scripts/wordweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from dsp_permissions_scripts.oap.oap_get import get_all_oaps_of_project
from dsp_permissions_scripts.oap.oap_model import Oap
from dsp_permissions_scripts.oap.oap_model import OapRetrieveConfig
from dsp_permissions_scripts.oap.oap_model import ResourceOap
from dsp_permissions_scripts.oap.oap_model import ValueOap
from dsp_permissions_scripts.oap.oap_serialize import serialize_oaps
from dsp_permissions_scripts.oap.oap_set import apply_updated_oaps_on_server
from dsp_permissions_scripts.utils.authentication import login
Expand All @@ -29,21 +31,18 @@ def modify_doaps(doaps: list[Doap]) -> list[Doap]:
return modified_doaps


def modify_oaps(oaps: list[Oap]) -> list[Oap]:
def modify_oaps(oaps: list[Oap]) -> list[ResourceOap | ValueOap]:
"""Adapt this sample to your needs."""
modified_oaps = []
modified_oaps: list[ResourceOap | ValueOap] = []
for oap in copy.deepcopy(oaps):
modified = False
if oap.resource_oap:
if group.UNKNOWN_USER not in oap.resource_oap.scope.V:
oap.resource_oap.scope = oap.resource_oap.scope.add("V", group.UNKNOWN_USER)
modified = True
modified_oaps.append(oap.resource_oap)
for value_oap in oap.value_oaps:
if group.UNKNOWN_USER not in value_oap.scope.V:
value_oap.scope = value_oap.scope.add("V", group.UNKNOWN_USER)
modified = True
if modified:
modified_oaps.append(oap)
modified_oaps.append(value_oap)
return modified_oaps


Expand Down

0 comments on commit c605552

Please sign in to comment.