/
Authorisation Service (python)
NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Authorisation Service (python)
If you need more information on this subject, please, see Authorisations.
List of all options:
Authorisations management
Authorisation types management
Authorisation sources management
Authorisation grant right management (OIDC only)
Authorisations management
from trivoreid.models.paycard import Authorisation
from trivoreid.utils.criteria import Filter
# Get list of all authorizations
page = api.authorization_service.get_all()
# Apply filter
filt = Filter(Filter.EQUAL, 'revoked', True)
page = api.paycard_service.get_all(filt)
# Add new Authorisation
auth = Authorisation()
auth.subject.type = 'User'
auth.object.type = 'User'
authType = api.authorization_service.get_all_types().resources[0]
auth.authType = authType.code
# This method returns authorisation object with the generated ID
auth = api.authorization_service.create(auth)
authId = auth.id
# Revoke Authorization
api.authorization_service.revoke(authId)
# Get one, Update and Delete
auth = api.authorization_service.get(authId)
auth.validTo = '2022-10-20T07:17:17.606Z'
auth = api.authorization_service.update(auth)
api.authorization_service.delete(authId)
Authorisation types management
from trivoreid.models.paycard import AuthorisationType
from trivoreid.utils.criteria import Filter
# Get list of all authorization types
page = api.authorization_service.get_all_types()
# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.paycard_service.get_all_types(filt)
# Add new Authorisation Type
auth_type = AuthorisationType()
auth_type.nsCode = 'nsCode'
auth_type.code = 'exampleCode'
# This method returns authorisation type object with the generated ID
auth_type = api.authorization_service.create_type(auth_type)
typeId = auth_type.id
# Get one, Update and Delete
auth_type = api.authorization_service.get_type(typeId)
auth_type.description = 'Example'
auth_type = api.authorization_service.update_type(auth_type)
api.authorization_service.delete_type(typeId)
Authorisation sources management
from trivoreid.models.paycard import AuthorisationType
from trivoreid.utils.criteria import Filter
# Get list of all authorization sources
page = api.authorization_service.get_all_sources()
# Apply filter
filt = Filter(Filter.EQUAL, 'code', 'examplecode')
page = api.paycard_service.get_all_sources(filt)
# Add new Authorisation Type
auth_source = AuthorisationType()
auth_source.nsCode = 'nsCode'
auth_source.code = 'exampleCode'
# This method returns authorisation type object with the generated ID
auth_source = api.authorization_service.create_source(auth_source)
sourceId = auth_source.id
# Get one, Update and Delete
auth_source = api.authorization_service.get_source(sourceId)
auth_source.description = 'Example'
auth_source = api.authorization_service.update_source(auth_source)
api.authorization_service.delete_source(sourceId)