cubes.piws.importer.users.CWUsers

class cubes.piws.importer.users.CWUsers(session, users)[source]

This class enables us to add new users in CW and associate this user to one or multiple groups.

__init__(session, users)[source]

Initialize the CWUsers class.

Parameters:

session: Session (mandatory) :

a cubicweb session.

users: dict (mandatory) :

the user names as keys and a dict with the group_names, login and password.

Notes

Here is an example of the definition of the ‘users’ parameter:

users = {
    "user1": {
        "login": "user1",
        "password": "user1",
        "group_names": ["group_v0", "users"]
    },
    "user2": {
        "login": "user2",
        "password": "user2",
        "group_names": ["group_v1", "users"]
    },
    "user3": {
        "login": "user3",
        "password": "user3",
        "group_names": ["group_v0v1", "users"]
    }
}

Methods

__init__(session, users) Initialize the CWUsers class.
cleanup() Method to cleanup temporary items and to commit changes.
import_data() Method that import the users in cw.
schema(outfname[, text_font, node_text_size]) Create a view of the schema described in a python structure.

Attributes

assessment_relations
device_relations
fileset_relations
relations
__module__ = 'cubes.piws.importer.users'
import_data()[source]

Method that import the users in cw.

Note

This procedure create a user as a ‘CWUser’ entity which is related to different groups through the ‘in_group’ relation.


schema

Warning

This procedure expect that the ‘CWGroup’ of interest are already created.

relations = [('CWUser', 'in_group', 'CWGroup')]