AuthZ | Python SDK
init
AuthZ()Perform a check request.
AuthZ.check(resource, action, subject, debug, attributes)Check if a subject has permission to perform an action on the resource.
response = authz.check(
resource=Resource(type="file", id="file_1"),
action="update",
subject=Subject(type="user", id="user_1"),
debug=True,
)
download-file
AuthZ.download_file()List resources.
AuthZ.list_resources(type, action, subject, attributes)Given a type, action, and subject, list all the resources in the type that the subject has access to the action with.
authz.list_resources(
type="file",
action="update",
subject=Subject(type="user", id="user_1"),
)
List subjects.
AuthZ.list_subjects(resource, action, attributes)Given a resource and an action, return the list of subjects who have access to the action for the given resource.
response = authz.list_subjects(
resource=Resource(type="file", id="file_1"),
action="update",
)
Poll result
AuthZ.poll_result(exception)Returns request's result that has been accepted by the server
response = service.poll_result(exception)
Create tuples.
AuthZ.tuple_create(tuples)Create tuples in the AuthZ Service. The request will fail if there is no schema or the tuples do not validate against the schema.
response = authz.tuple_create(
tuples=[
Tuple(
resource=Resource(type="file", id="file_1"),
relation="owner",
subject=Subject(type="user", id="user_1"),
)
]
)
Delete tuples.
AuthZ.tuple_delete(tuples)Delete tuples in the AuthZ Service.
response = authz.tuple_delete(
tuples=[
Tuple(
resource=Resource(type="file", id="file_1"),
relation="owner",
subject=Subject(type="user", id="user_1"),
)
]
)
List tuples.
AuthZ.tuple_list(filter, size, last, order, order_by)Return a paginated list of filtered tuples. The filter is given in terms of a tuple. Fill out the fields that you want to filter. If the filter is empty it will return all the tuples.
authz.tuple_list(TupleListFilter(subject_type="user", subject_id="user_1"))