Skip to content

Commit

Permalink
update policies
Browse files Browse the repository at this point in the history
pre-commit formatting issues fixed
  • Loading branch information
sheldor1510 committed Jul 23, 2024
1 parent f8001f3 commit 3b6f1ff
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 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,40 @@
),
]

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,
default_policies, lease_policies, offer_policies, node_policies, event_policies
)
return policies

Expand Down

0 comments on commit 3b6f1ff

Please sign in to comment.