py_abac.storage.redis package

Submodules

py_abac.storage.redis.storage module

Redis policy storage

class py_abac.storage.redis.storage.RedisStorage(client: redis.client.Redis, hash_key: str = None)[source]

Bases: py_abac.storage.base.Storage

Redis policy storage backend.

Parameters
  • client – redis client.

  • hash_key – hash key under which policies are stored in database.

add(policy: py_abac.policy.policy.Policy)[source]

Store a policy

delete(uid: str)[source]

Delete a policy

get(uid: str) → Optional[py_abac.policy.policy.Policy][source]

Get specific policy

get_all(limit: int, offset: int) → Generator[py_abac.policy.policy.Policy, None, None][source]

Retrieve all the policies within a window

get_for_target(subject_id: str, resource_id: str, action_id: str) → Generator[py_abac.policy.policy.Policy, None, None][source]

Get all policies for given target IDs.

update(policy: py_abac.policy.policy.Policy)[source]

Update a policy

NOTE: The lua script is used to make sure an update

operation occurs instead of upsert.

Module contents

Exposed classes and methods