Users

Import the users module and instantiate a user client with a custom session

[ ]:
from peak import Session
from peak.resources import users

# Create a custom session with an auth token. If not provided, the default session will be used.
custom_session = Session(auth_token="<your_auth_token>")  # noqa: S106

# Create a user client with the custom session.
user_client = users.get_client(session=custom_session)

Check feature permissions for a user

[ ]:
custom_session = Session(auth_token="<your_auth_token>")  # noqa: S106
user_client = users.get_client(session=custom_session)

feature_actions = {
    "FEATURE.SUBFEATURE": "write",
    "ANOTHER FEATURE.ANOTHER SUBFEATURE": "read",
}

permissions = user_client.check_permissions(feature_actions)

# Example output:
# {
#     "FEATURE.SUBFEATURE": False,
#     "ANOTHER FEATURE.ANOTHER SUBFEATURE": True
# }