Skip to content

Commit

Permalink
update policies
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldor1510 committed Jul 23, 2024
1 parent f8001f3 commit 9349581
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions esi_leap/common/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
{"path": "/leases", "method": "GET"},
{"path": "/leases/{lease_ident}", "method": "GET"},
{"path": "/leases/{lease_ident}", "method": "DELETE"},
{"path": "/leases/{lease_ident}", "method": "PATCH"}
],
),
policy.DocumentedRuleDefault(
Expand Down Expand Up @@ -102,6 +103,7 @@
{"path": "/offers", "method": "GET"},
{"path": "/offers/{offer_ident}", "method": "GET"},
{"path": "/offers/{offer_ident}", "method": "DELETE"},
{"path": "/offers/{offer_ident}/claim", "method": "POST"}
],
),
policy.DocumentedRuleDefault(
Expand Down Expand Up @@ -136,12 +138,47 @@
),
]

node_policies = [
policy.DocumentedRuleDefault(
"esi_leap:node:node_admin",
"rule:is_admin",
"Complete permissions over nodes",
[
{"path": "/nodes", "method": "GET"}
],
),
policy.DocumentedRuleDefault(
"esi_leap:node:get_all",
"rule:is_admin or rule:is_owner or rule:is_lessee",
"Retrieve multiple nodes",
[{"path": "/nodes", "method": "GET"}],
)
]

event_policies = [
policy.DocumentedRuleDefault(
"esi_leap:event:event_admin",
"rule:is_admin",
"Complete permissions over events",
[
{"path": "/events", "method": "GET"}
],
),
policy.DocumentedRuleDefault(
"esi_leap:event:get_all",
"rule:is_admin or rule:is_owner or rule:is_lessee",
"Retrieve multiple events",
[{"path": "/events", "method": "GET"}],
)
]

def list_rules():
policies = itertools.chain(
default_policies,
lease_policies,
offer_policies,
node_policies,
event_policies
)
return policies

Expand Down

0 comments on commit 9349581

Please sign in to comment.