Skip to content

Commit 12cf6f4

Browse files
NRL-2099 List available pointer types and access controls that can be assigned for v2 permissions
1 parent e38ad12 commit 12cf6f4

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

scripts/manage_permissions.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import fire
99
from aws_session_assume import get_boto_session
1010

11+
from nrlf.core.constants import TYPE_ATTRIBUTES, AccessControls
12+
1113
nrl_env = os.getenv("ENV", "dev")
1214
nrl_auth_bucket_name = os.getenv(
1315
"NRL_AUTH_BUCKET_NAME", f"nhsd-nrlf--{nrl_env}-authorization-store"
@@ -123,12 +125,33 @@ def list_orgs(supplier_type: SupplierType, app_id: str) -> None:
123125
print(f"- {org}")
124126

125127

128+
def list_available_pointer_types() -> None:
129+
"""
130+
List all pointer types that can be used in permissions.
131+
"""
132+
print("The following pointer-types can be assigned:")
133+
134+
for pointer_type, attributes in TYPE_ATTRIBUTES.items():
135+
print("- %-45s (%s)" % (pointer_type, attributes["display"][:45]))
136+
137+
138+
def list_available_access_controls() -> None:
139+
"""
140+
List all access controls that can be assigned in permissions.
141+
"""
142+
print("The following access controls can be assigned:")
143+
144+
for control in AccessControls.list():
145+
print(f"- {control}")
146+
147+
126148
if __name__ == "__main__":
127149
fire.Fire(
128150
{
129151
"list_apps": list_apps,
130152
"list_orgs": list_orgs,
131-
# "list_allowed_types": list_allowed_types,
153+
"list_available_pointer_types": list_available_pointer_types,
154+
"list_available_access_controls": list_available_access_controls,
132155
# "show_perms": show_perms,
133156
# "set_perms": set_perms,
134157
# "clear_perms": clear_perms,

scripts/manage_permissions_v1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def clear_perms(app_id: str, org_ods: str) -> None:
252252
{
253253
"list_apps": list_apps,
254254
"list_orgs": list_orgs,
255-
"list_allowed_types": list_allowed_types,
255+
"list_available_types": list_available_types,
256256
"show_perms": show_perms,
257257
"set_perms": set_perms,
258258
"clear_perms": clear_perms,

0 commit comments

Comments
 (0)