Skip to content

Commit

Permalink
add AP to tanner
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Oct 15, 2023
1 parent 944f5b1 commit 2ab4817
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions dsp_permissions_scripts/scenario-tanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

from dotenv import load_dotenv

from dsp_permissions_scripts.ap.ap_get import get_aps_of_project
from dsp_permissions_scripts.ap.ap_serialize import serialize_aps_of_project
from dsp_permissions_scripts.ap.ap_set import delete_ap
from dsp_permissions_scripts.doap.doap_get import get_doaps_of_project
from dsp_permissions_scripts.doap.doap_model import Doap
from dsp_permissions_scripts.doap.doap_serialize import serialize_doaps_of_project
Expand Down Expand Up @@ -31,6 +34,40 @@ def modify_oaps(oaps: list[Oap]) -> list[Oap]:
return oaps


def update_aps(
host: str,
shortcode: str,
token: str,
) -> None:
"""Delete the Administrative Permission that allows the ProjectMember to create resources."""
project_aps = get_aps_of_project(
host=host,
shortcode=shortcode,
token=token,
)
serialize_aps_of_project(
project_aps=project_aps,
shortcode=shortcode,
mode="original",
)
_ = delete_ap(
host=host,
token=token,
existing_aps=project_aps,
forGroup=builtin_groups.PROJECT_MEMBER,
)
project_aps_updated = get_aps_of_project(
host=host,
shortcode=shortcode,
token=token,
)
serialize_aps_of_project(
project_aps=project_aps_updated,
shortcode=shortcode,
mode="modified",
)


def update_doaps(
host: str,
shortcode: str,
Expand Down Expand Up @@ -108,6 +145,11 @@ def fix_scenario_tanner() -> None:
shortcode = "0102"
token = login(host)

update_aps(
host=host,
shortcode=shortcode,
token=token,
)
update_doaps(
host=host,
shortcode=shortcode,
Expand Down

0 comments on commit 2ab4817

Please sign in to comment.