Created
September 10, 2018 15:19
-
-
Save saward/3ca742fc2476db031b8dd758308c78ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"user": { | |
"id":"user_id_1", | |
"username":"user1", | |
"email":"[email protected]", | |
"Password":"JDJhJDEyJDVTU3Zvb2NGaFZpSlBScENKcVVlNXVlTGk1TExKdFZFQmtLMUozQ0xZUWl2cFkyL2g1RGN1", | |
"PasswordSalt":"MQ==" | |
}, | |
"repositories": [ | |
{ | |
"id":"282b24fa-0404-497b-94db-da85653e9039", | |
"owner_id":"user_id_3", | |
"public":true, | |
"name":"Martin" | |
}, | |
{ | |
"id":"062d1a05-4338-4788-a5c9-6c268dd82f53", | |
"owner_id":"user_id_3", | |
"public":false, | |
"name":"Taylor" | |
}, | |
{ | |
"id":"8000056c-35ea-4dae-bf0e-ebc403f80b1f", | |
"owner_id":"user_id_3", | |
"public":true, | |
"name":"Williams" | |
}, | |
{ | |
"id":"605e068b-bfab-40dc-9506-6be521f01156", | |
"owner_id":"user_id_1", | |
"public":false, | |
"name":"Jackson" | |
}, | |
{ | |
"id":"262bdeb9-390d-47ce-b946-14526defd254", | |
"owner_id":"user_id_2", | |
"public":true, | |
"name":"Johnson" | |
}, | |
{ | |
"id":"989f90f9-3f5d-404b-8d89-adb41ee7062d", | |
"owner_id":"user_id_1", | |
"public":false, | |
"name":"Garcia" | |
}, | |
{ | |
"id":"d1120b56-e3ba-4225-bb43-07a19b436c9b", | |
"owner_id":"user_id_2", | |
"public":true, | |
"name":"Harris" | |
}, | |
{ | |
"id":"e88d8559-51b7-477c-8b7b-7b27233e1900", | |
"owner_id":"user_id_1", | |
"public":false, | |
"name":"Johnson" | |
}, | |
{ | |
"id":"4826f7f3-cbc4-4f58-83c2-4f87f0c5c47f", | |
"owner_id":"user_id_2", | |
"public":true, | |
"name":"Garcia" | |
}, | |
{ | |
"id":"c11d44ab-6f95-43a3-95e6-7a1cd36b3add", | |
"owner_id":"user_id_2", | |
"public":false, | |
"name":"Davis" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Evaluated package in 141.185µs. | |
{ | |
"allowed_repos": [ | |
"282b24fa-0404-497b-94db-da85653e9039", | |
"8000056c-35ea-4dae-bf0e-ebc403f80b1f", | |
"262bdeb9-390d-47ce-b946-14526defd254", | |
"d1120b56-e3ba-4225-bb43-07a19b436c9b", | |
"4826f7f3-cbc4-4f58-83c2-4f87f0c5c47f", | |
"605e068b-bfab-40dc-9506-6be521f01156", | |
"989f90f9-3f5d-404b-8d89-adb41ee7062d", | |
"e88d8559-51b7-477c-8b7b-7b27233e1900" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package repositories.view | |
# allowed_repos is the union of these rules with shared names | |
# The following section allows any repo set to public | |
allowed_repos[allowed] { | |
input.repositories[_] = repo | |
repo.public = true | |
allowed = repo.id | |
} | |
# The following section allows any owned repo | |
allowed_repos[allowed] { | |
input.repositories[_] = repo | |
repo.owner_id = input.user.id | |
allowed = repo.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment