|
8 | 8 | import fire |
9 | 9 | from aws_session_assume import get_boto_session |
10 | 10 |
|
| 11 | +from nrlf.core.constants import TYPE_ATTRIBUTES, AccessControls |
| 12 | + |
11 | 13 | nrl_env = os.getenv("ENV", "dev") |
12 | 14 | nrl_auth_bucket_name = os.getenv( |
13 | 15 | "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: |
123 | 125 | print(f"- {org}") |
124 | 126 |
|
125 | 127 |
|
| 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 | + |
126 | 148 | if __name__ == "__main__": |
127 | 149 | fire.Fire( |
128 | 150 | { |
129 | 151 | "list_apps": list_apps, |
130 | 152 | "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, |
132 | 155 | # "show_perms": show_perms, |
133 | 156 | # "set_perms": set_perms, |
134 | 157 | # "clear_perms": clear_perms, |
|
0 commit comments