Skip to content
Snippets Groups Projects
Commit 4144a1b4 authored by Ahmed Osman's avatar Ahmed Osman
Browse files

Update file policy.rego

parent c5e454e3
No related branches found
No related tags found
No related merge requests found
Pipeline #357121 passed
...@@ -6,18 +6,17 @@ import input ...@@ -6,18 +6,17 @@ import input
default allow = false default allow = false
allow { allow {
path_arr := split(input.path, "/") # split path (e.g., aas.aHR0cHM6Ly93d3cuY29tcGFueS5jb20vc3VibW9kZWxzL2FyYmVpdHNhdWZ0cmFn.Auftragsstatus) in parts
print(path_arr) path_arr := split(input.path, ".")
path_id_short := split(path_arr[count(path_arr)-1], ".") # iterate through each subpath
z := array.slice(path_arr, 0, count(path_arr)-1) # e.g., 1. aas 2. aas.aHR0cHM6Ly93d3cuY29tcGFueS5jb20vc3VibW9kZWxzL2FyYmVpdHNhdWZ0cmFn
path_full := array.concat(z, path_id_short) # 3. aas.aHR0cHM6Ly93d3cuY29tcGFueS5jb20vc3VibW9kZWxzL2FyYmVpdHNhdWZ0cmFn.Auftragsstatus
print(path_id_short) some i, _ in path_arr
print(path_full) path_arr_slice := array.slice(path_arr, 0, i+1)
some i, _ in path_full path := concat(".", path_arr_slice)
path_arr_slice := array.slice(path_full, 0, i+1)
path := concat("/", path_arr_slice)
print(path) print(path)
print(data.api[path]) print(data.api[path])
# within the stored data, check if input.user can perform requested method (e.g., READ)
some user in data.api[path][input.method] some user in data.api[path][input.method]
user == input.user user == input.user
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment