authentication¶
Set of classes to store authentication and permissions
- class camelot.model.authentication.AuthenticationGroup(*args, **kwargs)[source]¶
- A group of users (defined by their AuthenticationMechanism).
- Different roles can be assigned to a group.
mapped to authentication_group
- roles : points to camelot.model.authentication.AuthenticationGroupRole
- members : points to camelot.model.authentication.AuthenticationMechanism
- id¶
The primary key, int, required
- name¶
str, required, length : 256
- class camelot.model.authentication.AuthenticationGroupRole(*args, **kwargs)[source]¶
Table with the different roles associated with an AuthenticationGroup
- class camelot.model.authentication.AuthenticationMechanism(*args, **kwargs)[source]¶
mapped to authentication_mechanism
- groups : points to camelot.model.authentication.AuthenticationGroup
- authentication_type¶
str, required, possible values : operating_system/database
- from_date¶
date, required
- has_role(role_name)[source]¶
Parameters: role_name – a string with the name of the role - :return; True if the user is associated to this role, otherwise
- False.
- id¶
The primary key, int, required
- last_login¶
datetime, not required
- password¶
str, not required, length : 200
- representation¶
str, not required
- set_representation(image)[source]¶
Parameters: image – a QtGui.QImage object with the avatar of the user, or None.
- thru_date¶
date, required
- username¶
str, required, length : 40
- camelot.model.authentication.get_current_authentication(_obj=None)[source]¶
Get the currently logged in :class:’AuthenticationMechanism’
- camelot.model.authentication.update_last_login(initial_group_name=None, initial_group_roles=[])[source]¶
Update the last login of the currently logged in user to now. If there is no AuthenticationGroup yet in the database, create one and add the user to it. This can be used to bootstrap the authentication system and create an admin group and add the user to it.
Parameters: - initial_group_name – The name of the authentication group that needs to be created if there is none yet.
- initial_group_roles – a list with the roles for the initial group