From 4aec0597a9e2810197659696c557888c17b7ad55 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:19:44 +0200 Subject: [PATCH] chore: new standard DOAPs (DEV-4030) (#132) --- dsp_permissions_scripts/models/scope.py | 15 ++++++++++----- dsp_permissions_scripts/template.py | 4 ++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/dsp_permissions_scripts/models/scope.py b/dsp_permissions_scripts/models/scope.py index 6552dabf..69798a17 100644 --- a/dsp_permissions_scripts/models/scope.py +++ b/dsp_permissions_scripts/models/scope.py @@ -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 @@ -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}, ) diff --git a/dsp_permissions_scripts/template.py b/dsp_permissions_scripts/template.py index 99bf9dbc..752e2b66 100644 --- a/dsp_permissions_scripts/template.py +++ b/dsp_permissions_scripts/template.py @@ -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 @@ -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