[#278] Small QoL updates

Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-08-07 17:35:02 +03:00
parent 5bdacdf5ba
commit 8a8b35846e
4 changed files with 12 additions and 7 deletions

View file

@ -47,6 +47,7 @@ class ConditionType(HumanReadableEnum):
class ConditionKey(HumanReadableEnum):
ROLE = '"\\$Actor:role"'
PUBLIC_KEY = '"\\$Actor:publicKey"'
OBJECT_TYPE = '"\\$Object:objectType"'
class MatchType(HumanReadableEnum):
@ -75,6 +76,10 @@ class Condition:
def by_key(*args, **kwargs) -> "Condition":
return Condition(ConditionKey.PUBLIC_KEY, *args, **kwargs)
@staticmethod
def by_object_type(*args, **kwargs) -> "Condition":
return Condition(ConditionKey.OBJECT_TYPE, *args, **kwargs)
class Rule:
def __init__(