Skip to content
Snippets Groups Projects

Release 0.16.o

Merged Florian Spreckelsen requested to merge release-0.16.0 into main
19 files
+ 1542
466
Compare changes
  • Side-by-side
  • Inline
Files
19
+ 38
38
@@ -37,13 +37,13 @@ from caosdb import administration as admin
def assert_user_and_role():
"""Make sure that users and roles exist.
After calling this function, there will be a user "jane" with the role "human"
and the user "xaxys" with the role "alien". These users and roles are returned.
After calling this function, there will be a user "jane" with the role "human"
and the user "xaxys" with the role "alien". These users and roles are returned.
Returns
-------
out : tuple
((human_user, human_role), (alien_user, alien_role))
Returns
-------
out : tuple
((human_user, human_role), (alien_user, alien_role))
"""
try:
@@ -81,15 +81,15 @@ out : tuple
def get_entities(count=1):
"""Retrieve one or more entities.
Parameters
----------
count : int, optional
How many entities to retrieve.
Parameters
----------
count : int, optional
How many entities to retrieve.
Returns
-------
out : Container
A container of retrieved entities, the length is given by the parameter count.
Returns
-------
out : Container
A container of retrieved entities, the length is given by the parameter count.
"""
cont = db.execute_query("FIND RECORD 'Human Food'", flags={
"P": "0L{n}".format(n=count)})
@@ -102,20 +102,20 @@ out : Container
def set_permission(role_grant, role_deny, cont=None, general=False):
"""Set the permissions of some entities.
Parameters
----------
role_grant : str
Role which is granted permissions.
Parameters
----------
role_grant : str
Role which is granted permissions.
role_deny : str
Role which is denied permissions.
role_deny : str
Role which is denied permissions.
cont : Container
Entities for which permissions are set.
cont : Container
Entities for which permissions are set.
general : bool, optional
If True, the permissions for the roles will be set. If False (the default),
permissions for the entities in the container will be set.
general : bool, optional
If True, the permissions for the roles will be set. If False (the default),
permissions for the entities in the container will be set.
"""
# Set general permissions
@@ -143,23 +143,23 @@ general : bool, optional
def test_permission(granted_user, denied_user, cont):
"""Tests if the permissions are set correctly for two users.
Parameters
----------
granted_user : (str, str)
The user which should have permissions to retrieve the entities in `cont`.
Given as (user, password).
Parameters
----------
granted_user : (str, str)
The user which should have permissions to retrieve the entities in `cont`.
Given as (user, password).
denied_user : (str, str)
The user which should have no permission to retrieve the entities in `cont`.
Given as (user, password).
denied_user : (str, str)
The user which should have no permission to retrieve the entities in `cont`.
Given as (user, password).
cont : Container
Entities for which permissions are tested.
cont : Container
Entities for which permissions are tested.
Returns
-------
None
Returns
-------
None
"""
Loading