viktor.api_v1
User
- class
viktor.api_v1.
User
(*, first_name, last_name, email, job_title)¶ -
User information.
- Parameters
first_name (
str
) – user’s first namelast_name (
str
) – user’s last nameemail (
str
) – user’s email addressjob_title (
str
) – user’s job title
- property
full_name
¶ User’s full name (first name + last name).
- Return type
str
EntityType
Entity
- class
viktor.api_v1.
Entity
(api, origin_id, operations, resolved=None)¶ -
Warning
Do not instantiate this class directly in an application. It is created by the API.
- property
name
¶ - Return type
str
- property
entity_type
¶ - Return type
- property
id
¶ - Return type
int
- property
last_saved_params
¶ Get the params of the last saved entity revision.
- Return type
Munch
- property
last_saved_summary
¶ Get the summary of the last saved entity revision.
- Return type
Munch
-
parent
(*, privileged=False)¶ Get the parent of the entity.
- Parameters
privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
children
(*, include_params=True, entity_type_names=None, privileged=False)¶ Get the child entities.
- Parameters
include_params (
bool
) – True to include the parameters of the child entities.entity_type_names (
Optional
[List
[str
]]) – Only filters the entities of the defined type(s) (default = None, returns all).privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
siblings
(*, include_params=True, entity_type_names=None, privileged=False)¶ Get the sibling entities.
- Parameters
include_params (
bool
) – True to include the parameters of the sibling entities.entity_type_names (
Optional
[List
[str
]]) – Only filters the entities of the defined type(s) (default = None, returns all).privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
- property
EntityList
- class
viktor.api_v1.
EntityList
(api, relation, origin, entity_type_names, include_params, *, privileged=False)¶ -
Warning
Do not instantiate this class directly in an application. It is created by the API.
Object which resembles a list of Entity’s.
Most commonly used list operations are supported:
# indexing children = entity.children() children[0] # first child entity children[-1] # last child entity # length number_of_children = len(children) # for loop for child in children: # perform operation on child
API
- class
viktor.api_v1.
API
¶ -
Starting point of making an API call to, for example, retrieve properties of a parent or child entity.
Note that the permissions of a user (group) are reflected on the permissions of this API call, e.g. if a user only has read-navigate or read-basic permission, calling the properties (read-all) of the object using this API will NOT work for this specific user.
Example:
current_entity = API().get_entity(entity_id) parent = entity.parent() parent_params = parent.last_saved_params
-
get_entity
(id_, *, privileged=False)¶ Get the entity with given id.
- Parameters
id – entity_id
privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
get_root_entities
(*, include_params=True, entity_type_names=None, privileged=False)¶ Get the root entities.
- Parameters
include_params (
bool
) – True to include the parameters of the root entities.entity_type_names (
Optional
[List
[str
]]) – Only filters the entities of the defined type(s) (default = None, returns all).privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
get_entity_file
(entity_id, *, privileged=False)¶ Get the file of the entity.
- Parameters
entity_id (
int
) – id of the entity to get the file from.privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
- Returns
File object (SourceType.URL)
- Raises
ValueError – if file does not have a file associated with it.
-
PrivilegedAPI
- class
viktor.api_v1.
PrivilegedAPI
¶ -
For making API calls that bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this class:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
Note
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
-
get_entity
(id_, *, privileged=False)¶ Get the entity with given id.
- Parameters
id – entity_id
privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
get_root_entities
(*, include_params=True, entity_type_names=None, privileged=False)¶ Get the root entities.
- Parameters
include_params (
bool
) – True to include the parameters of the root entities.entity_type_names (
Optional
[List
[str
]]) – Only filters the entities of the defined type(s) (default = None, returns all).privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
-
get_entity_file
(entity_id, *, privileged=False)¶ Get the file of the entity.
- Parameters
entity_id (
int
) – id of the entity to get the file from.privileged (
bool
) –bypass the user access restrictions managed by the admin of an application.
Warning
If not used properly, (confidential) information which SHOULD NOT be accessible by a user may leak (for instance by including data in a view). Please consider the following when using this flag:
Make sure the app’s admin is aware that the code circumvents certain permissions at specific places.
Make sure to test the implementation thoroughly, to ensure no confidential data is leaked.
API calls can only bypass the restrictions if the key uses_privileged_api is set to true in the manifest. This is to provide an additional layer of security / awareness.
- Return type
- Returns
File object (SourceType.URL)
- Raises
ValueError – if file does not have a file associated with it.