Skip to main content

AuthZ | Python SDK

init

AuthZ()

Perform a check request. (Beta)

AuthZ.check(resource, action, subject, debug, attributes)

Check if a subject has permission to perform an action on the resource. How to install a Beta release.

required parameters

Resource

The resource to check.

str

The action to check.

Subject

The subject to check.

Optional[bool]

Setting this value to True will provide a detailed analysis of the check.

Optional[Dict[str, Union[int, str]]]

Additional attributes for the check.

Response Object

Pangea Response with the result of the check. Available response fields can be found in our API Documentation.

response = authz.check(
    resource=Resource(namespace="file", id="file_1"),
    action="update",
    subject=Subject(namespace="user", id="user_1"),
    debug=True,
)

download-file

AuthZ.download_file()

List resources. (Beta)

AuthZ.list_resources(namespace, action, subject)

Given a namespace, action, and subject, list all the resources in the namespace that the subject has access to the action with. How to install a Beta release.

required parameters

str

The namespace to filter resources.

str

The action to filter resources.

Subject

The subject to filter resources.

Response Object

Pangea Response with a list of resource IDs. Available response fields can be found in our API Documentation.

authz.list_resources(
    namespace="file",
    action="update",
    subject=Subject(namespace="user", id="user_1"),
)

List subjects. (Beta)

AuthZ.list_subjects(resource, action)

Given a resource and an action, return the list of subjects who have access to the action for the given resource. How to install a Beta release.

required parameters

Resource

The resource to filter subjects.

str

The action to filter subjects.

Response Object

Pangea Response with a list of subjects. Available response fields can be found in our API Documentation.

response = authz.list_subjects(
    resource=Resource(namespace="file", id="file_1"),
    action="update",
)

Poll result

AuthZ.poll_result(exception)

Returns request's result that has been accepted by the server

required parameters

AcceptedRequestException

Exception raise by SDK on the call that is been processed.

Response Object

PangeaResponse

response = service.poll_result(exception)

Create tuples. (Beta)

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. How to install a Beta release.

required parameters

List[Tuple]

List of tuples to be created.

Response Object

Pangea Response with empty result. Available response fields can be found in our API Documentation.

response = authz.tuple_create(
    tuples=[
        Tuple(
            resource=Resource(namespace="file", id="file_1"),
            relation="owner",
            subject=Subject(namespace="user", id="user_1"),
        )
    ]
)

Delete tuples. (Beta)

AuthZ.tuple_delete(tuples)

Delete tuples in the AuthZ Service. How to install a Beta release.

required parameters

List[Tuple]

List of tuples to be deleted.

Response Object

Pangea Response with empty result. Available response fields can be found in our API Documentation.

response = authz.tuple_delete(
    tuples=[
        Tuple(
            resource=Resource(namespace="file", id="file_1"),
            relation="owner",
            subject=Subject(namespace="user", id="user_1"),
        )
    ]
)

List tuples. (Beta)

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. How to install a Beta release.

required parameters

TupleListFilter

The filter for listing tuples.

Optional[int]

The size of the result set. Default is None.

Optional[str]

The last token from a previous response. Default is None.

Optional[ItemOrder]

Order results asc(ending) or desc(ending).

Optional[TupleOrderBy]

Which field to order results by.

Response Object

Pangea Response with a list of tuples and the last token. Available response fields can be found in our API Documentation.

authz.tuple_list(TupleListFilter(subject_namespace="user", subject_id="user_1"))