Skip to content
Snippets Groups Projects
Commit 70bb4fa4 authored by Alexander Kaschta's avatar Alexander Kaschta :owl:
Browse files

FIX: Perform requests as logged in user

parent 9df11918
No related branches found
No related tags found
No related merge requests found
Pipeline #419738 passed
......@@ -16,7 +16,7 @@ js_mods = ['bcdrequest']
@router.post('')
async def handle_request(bcd_request: BCDRequestModel, token: APIToken = Depends(check_auth), conn=Depends(get_conn)):
Mgr.check_token(conn, token)
user = Mgr.check_token(conn, token)
ou_request = execute_wapi_function(conn, [
{"idx": "own_mgr2ou_list", "name": "cntl.mgr2ou.list", "old": {"is_own": True}},
......@@ -29,7 +29,8 @@ async def handle_request(bcd_request: BCDRequestModel, token: APIToken = Depends
{"name": "dns.fqdn2ou.list", "inner_join_ref": {"unit_list_superset": "default"}, "idx": "fqdn2ou_list"},
{"name": "nd.bcd2ou.list", "inner_join_ref": {"unit_list_superset": "default"}, "idx": "bcd2ou_list"},
{"name": "nd.bcd.list", "inner_join_ref": {"bcd2ou_list": "default"}, "idx": "bcd_list"},
{"name": "org.unit_type.list", "inner_join_ref": {"unit_list": "default"}, "idx": "unit_type_list"}])
{"name": "org.unit_type.list", "inner_join_ref": {"unit_list": "default"}, "idx": "unit_type_list"}],
user=user.login_name)
ous = [item["short_name"] for item in ou_request["unit_list"]]
......@@ -59,7 +60,8 @@ async def handle_request(bcd_request: BCDRequestModel, token: APIToken = Depends
{"idx": "recursive_mgr2ou_list", "name": "cntl.mgr2ou.list", "inner_join_ref": {"parent_ous": "default"}},
{"idx": "recursive_mgr_list", "name": "cntl.mgr.list", "inner_join_ref": {"recursive_mgr2ou_list": "default"}},
{"idx": "recursive_bcd_list", "name": "nd.bcd.list", "inner_join_ref": {"recursive_bcd2ou_list": "default"}},
{"name": "org.unit_type.list", "inner_join_ref": {"current_ou": "default"}, "idx": "unit_type_list"}])
{"name": "org.unit_type.list", "inner_join_ref": {"current_ou": "default"}, "idx": "unit_type_list"}],
user=user.login_name)
groups = [item["name"] for item in group_request["group_list"]]
......@@ -77,7 +79,6 @@ async def handle_request(bcd_request: BCDRequestModel, token: APIToken = Depends
def validate_bcd_request(bcd_request: BCDRequestModel) -> bool:
if (bcd_request.protection_requirement == BCDProtectionRequirements.SPECIAL and
bcd_request.protection_requirement_note is None):
raise HTTPException(
......
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