Skip to content
Snippets Groups Projects
Commit 5b5ce21f authored by !! Julian Keck (old Account; do not use) !!'s avatar !! Julian Keck (old Account; do not use) !! :ghost:
Browse files

UPD bump middleware to api 4.1

Closes #730
Closes #729
parent b63d9f46
No related branches found
No related tags found
No related merge requests found
......@@ -97,27 +97,28 @@ class Mgr(BaseModel):
return bcd in [v.name for v in self.get_bcds(conn)]
def get_permissions(self, conn):
if self.permission_list is not None:
return self.permission_list
result = execute_wapi_function(conn, [
{'name': 'cntl.mgr.list', 'old': {'is_self': True}},
{'name': 'cntl.role.list', 'old': {
{'name': 'cntl.role.list', 'idx': 'direct_role_list', 'old': {
'is_directly_assigned': True,
'is_role': True,
}},
{'name': 'cntl.role.list', 'old': {'is_role': True}, 'idx': 'role_list', 'inner_join_ref': {
'direct_role_list': 'api_func_cntl_role_hierarchy_gfk_list_is_superset'
}},
{'name': 'cntl.role.list', 'old': {'is_role': False}, 'idx': 'permission_list', 'inner_join_ref': {
'role_list': 'api_func_cntl_role_hierarchy_gfk_list_is_superset'
}}
], user=self.login_name)
if 'cntl_role_list' not in result.keys() or len(result['cntl_role_list']) == 0:
if 'permission_list' not in result.keys() or len(result['permission_list']) == 0:
self.permission_list = []
return self.permission_list
perms = []
roles = result['cntl_role_list']
for role in roles:
for permission in role['contained_permissions'].keys():
perms.append(permission)
self.permission_list = perms
self.permission_list = list(map(lambda x: x['fq_name'], result['permission_list']))
return self.permission_list
def has_permission(self, conn, permission: str):
......
......@@ -30,7 +30,7 @@ def execute_wapi_function(conn, request: list[dict[str, str | dict]], user: str
user = settings.wapi_netvs_superuser
query = """
select * from wapi_4_0.ta_handler(
select * from wapi_4_1.ta_handler(
in_login_name => %(login_name)s,
in_http_rq_mthd => 'POST',
in_http_rq_body => %(rq)s,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment