Skip to content

Commit

Permalink
chore: new standard DOAPs (DEV-4030) (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum authored Aug 26, 2024
1 parent d1ed804 commit 4aec059
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions dsp_permissions_scripts/models/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pydantic import model_validator

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
Expand Down Expand Up @@ -120,13 +119,19 @@ def remove(
return PermissionScope.create(**kwargs)


PUBLIC = PermissionScope.create(
CR={CREATOR, PROJECT_ADMIN},
OPEN = PermissionScope.create(
CR={PROJECT_ADMIN},
D={PROJECT_MEMBER},
V={KNOWN_USER, UNKNOWN_USER},
)

PRIVATE = PermissionScope.create(
RESTRICTED_VIEW = PermissionScope.create(
CR={PROJECT_ADMIN},
D={PROJECT_MEMBER},
RV={KNOWN_USER, UNKNOWN_USER},
)

RESTRICTED = PermissionScope.create(
CR={PROJECT_ADMIN},
M={PROJECT_MEMBER},
D={PROJECT_MEMBER},
)
4 changes: 2 additions & 2 deletions dsp_permissions_scripts/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from dsp_permissions_scripts.doap.doap_set import create_new_doap_on_server
from dsp_permissions_scripts.models import group
from dsp_permissions_scripts.models.host import Hosts
from dsp_permissions_scripts.models.scope import PUBLIC
from dsp_permissions_scripts.models.scope import OPEN
from dsp_permissions_scripts.models.scope import PermissionScope
from dsp_permissions_scripts.oap.oap_get import get_all_oaps_of_project
from dsp_permissions_scripts.oap.oap_model import Oap
Expand Down Expand Up @@ -49,7 +49,7 @@ def modify_doaps(doaps: list[Doap]) -> list[Doap]:
modified_doaps = []
for doap in copy.deepcopy(doaps):
if isinstance(doap.target, GroupDoapTarget) and doap.target.group == group.PROJECT_ADMIN:
doap.scope = PUBLIC
doap.scope = OPEN
modified_doaps.append(doap)
return modified_doaps

Expand Down

0 comments on commit 4aec059

Please sign in to comment.