From 3b6f1ff3b642e8240ed7bb2e3e2557718db651fb Mon Sep 17 00:00:00 2001 From: Anshul Saha Date: Tue, 23 Jul 2024 19:29:11 +0530 Subject: [PATCH] update policies pre-commit formatting issues fixed --- esi_leap/common/policy.py | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/esi_leap/common/policy.py b/esi_leap/common/policy.py index a2f6b978..35581cea 100644 --- a/esi_leap/common/policy.py +++ b/esi_leap/common/policy.py @@ -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( @@ -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( @@ -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