Previous topic

stalker.models.auth.RootFactory

Next topic

stalker.models.department.Department

This Page

stalker.models.auth.User

Inheritance diagram of stalker.models.auth.User

class stalker.models.auth.User(name=None, login=None, email=None, password=None, departments=None, groups=None, projects_lead=None, sequences_lead=None, tasks=None, watching=None, last_login=None, **kwargs)[source]

Bases: stalker.models.entity.Entity, stalker.models.mixins.ACLMixin

The user class is designed to hold data about a User in the system.

There are a couple of points to take your attention to:

  • The code attribute is derived from the nice_name as it is in a SimpleEntity, but the nice_name is derived from the login instead of the name attribute, so the code of a User and a SimpleEntity will be different then each other. The formatting of the code attribute is as follows:

    • no underscore character is allowed, so while in the SimpleEntity class the code could have underscores, in User class it is not allowed.
    • all the letters in the code will be converted to lower case.

    Other than these two new rules all the previous formatting rules from the SimpleEntity are valid.

Parameters:
  • email (str, unicode) – holds the e-mail of the user, should be in [part1]@[part2] format
  • login (str, unicode) – This is the login name of the user, it should be all lower case. Giving a string or unicode that has uppercase letters, it will be converted to lower case. It can not be an empty string or None and it can not contain any white space inside.
  • departments (list of Departments) – It is the departments that the user is a part of. It should be a list of Department objects. One user can be listed in multiple departments.
  • password (str, unicode) – it is the password of the user, can contain any character. Stalker doesn’t store the raw passwords of the users. To check a stored password with a raw password use check_password() and to set the password you can use the password property directly.
  • groups (list of Group) – It is a list of Group instances that this user belongs to.
  • tasks (list of Tasks) – it is a list of Task objects which holds the tasks that this user has been assigned to
  • projects_lead (list of Projects) – it is a list of Project objects that this user is the leader of, it is for back referencing purposes.
  • sequences_lead (list of Sequence) – it is a list of Sequence objects that this user is the leader of, it is for back referencing purposes
  • last_login (datetime.datetime) – it is a datetime.datetime object holds the last login date of the user (not implemented yet)
__init__(name=None, login=None, email=None, password=None, departments=None, groups=None, projects_lead=None, sequences_lead=None, tasks=None, watching=None, last_login=None, **kwargs)[source]

Methods

__init__([name, login, email, password, ...])
check_password(raw_password) Checks the given raw_password.

Attributes

created_by The User who has created this object.
created_by_id The id of the User who has created
date_created A datetime.datetime instance showing the creation date and time of this object.
date_updated A datetime.datetime instance showing the update date and time of this object.
departments A list of Departments that
description Description of this object.
email email of the user, accepts strings or unicode
entities_created
entities_updated
entity_id
entity_type
generic_data This attribute can hold any kind of data which exists in SOM.
groups Permission groups that this users is a member of.
id
last_login The last login time of this user.
login The login name of the user.
metadata A collection of Table objects and their associated schema
name Name of this object
nice_name Nice name of this object.
notes All the Notess attached to this entity.
open_tickets The list of open Tickets that this user has.
password The password of the user.
permissions
plural_class_name the plural name of this class
projects
projects_lead Projects lead by this user.
query ORM-level SQL construction object.
sequences_lead Sequences lead by this user.
tags A list of tags attached to this object.
tasks Tasks assigned to this user.
thumbnail
thumbnail_id
tickets The list of Tickets that this user has.
time_logs A list of TimeLog instances which
tjp_id returns TaskJuggler compatible id
to_tjp outputs a TaskJuggler formatted string
type The type of the object.
type_id The id of the Type of this entity.
updated_by The User who has updated this object.
updated_by_id The id of the User who has updated
user_id
watching Taskss that this user is
time_logs

A list of TimeLog instances which holds the time logs created for this User.

login

The login name of the user.

Can not be empty.

departments

A list of Departments that this user is a part of

email

email of the user, accepts strings or unicode

password

The password of the user.

It is scrambled before it is stored.

groups

Permission groups that this users is a member of.

Accepts Group object.

projects_lead

Projects lead by this user.

It is a list of Project instances.

sequences_lead

Sequences lead by this user.

It is a list of Sequence instances.

tasks

Tasks assigned to this user.

It is a list of Task instances.

watching

Taskss that this user is assigned as a watcher.

It is a list of Task instances.

last_login

The last login time of this user.

It is an instance of datetime.datetime class.

check_password(raw_password)[source]

Checks the given raw_password.

Checks the given raw_password with the current Users objects encrypted password.

Checks the given raw password with the given encrypted password. Handles the encryption process behind the scene.

created_by

The User who has created this object.

created_by_id

The id of the User who has created this entity.

date_created

A datetime.datetime instance showing the creation date and time of this object.

date_updated

A datetime.datetime instance showing the update date and time of this object.

description

Description of this object.

generic_data

This attribute can hold any kind of data which exists in SOM.

name

Name of this object

nice_name

Nice name of this object.

It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.

notes

All the Notess attached to this entity.

It is a list of Note instances or an empty list, setting it None will raise a TypeError.

plural_class_name

the plural name of this class

tags

A list of tags attached to this object.

It is a list of Tag instances which shows the tags of this object

tjp_id

returns TaskJuggler compatible id

type

The type of the object.

It is an instance of Type with a proper target_entity_type.

type_id

The id of the Type of this entity. Mainly used by SQLAlchemy to create a Many-to-One relates between SimpleEntities and Types.

updated_by

The User who has updated this object.

updated_by_id

The id of the User who has updated this entity.

tickets[source]

The list of Tickets that this user has.

returns a list of Ticket instances which are derived from the Tasks that this user is assigned to (Stalker checks the related Version instances and then the ~stalker.models.ticket.Ticket instances assigned to the Versions.).

open_tickets[source]

The list of open Tickets that this user has.

returns a list of Ticket instances which has a status of Open and are derived from the Tasks that this user is assigned to (Stalker checks the related Version instances and then the ~stalker.models.ticket.Ticket instances assigned to the Version and has a status of Open.).

to_tjp[source]

outputs a TaskJuggler formatted string