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, companies=None, groups=None, efficiency=1.0, rate=0.0, **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.

Note

New to version 0.2.0 users can be assigned to a Task as a Watcher. Which can be used to inform the users in watchers list about the updates of certain Tasks.

Note

It is now possible to define Vacations per user.

Note

Note

Parameters:
  • rate – For future usage a rate attribute is added to the User to record the daily cost of this user as a resource. It should be either 0 or a positive integer or float value. Default is 0.
  • efficiency

    The efficiency is a multiplier for a user as a resource to a task and defines how much of the time spent for that particular task is counted as an actual effort. The default value is 1.0, lowest possible value is 0.0 and there is no upper limit.

    The efficiency of a resource can be used for three purposes. First you can use it as a crude way to model a team. A team of 5 people should have an efficiency of 5.0. Keep in mind that you cannot track the members of the team individually if you use this feature. They always act as a group.

    Another use is to model performance variations between your resources. Again, this is a fairly crude mechanism and should be used with care. A resource that isn’t every good at some task might be pretty good at another. This can’t be taken into account as the resource efficiency can only set globally for all tasks.

    One another and interesting use is to model the availability of passive resources like a meeting room or a workstation or something that needs to be free for a task to take place but does not contribute to a task as an active resource.

    All resources that do not contribute effort to the task, that is a passive resource, should have an efficiency of 0.0. Again a typical example would be a conference room. It’s necessary for a meeting, but it does not contribute any work.

  • email (str) – holds the e-mail of the user, should be in [part1]@[part2] format
  • login (str) – This is the login name of the user, it should be all lower case. Giving a string 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) – 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
  • 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, companies=None, groups=None, efficiency=1.0, rate=0.0, **kwargs)

Methods

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

Attributes

alternative_resource_in_tasks
companies A descriptor that presents a read/write view of an object attribute.
company_role A list of Clients that this user is a part of.
computed_resource_in_tasks
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.
department_role A list of Departments that
departments A descriptor that presents a read/write view of an object attribute.
description Description of this object.
efficiency
email email of the user, accepts string
entities_created
entities_updated
entity_groups
entity_id
entity_type
generic_data This attribute can hold any kind of data which exists in SOM.
generic_text This attribute can hold any text.
groups Permission groups that this users is a member of.
html_class
html_style
id
User.last_login
login The login name of the user.
metadata
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
project_role
projects A descriptor that presents a read/write view of an object attribute.
query
rate
responsible_of A list of Task instances that this user is responsible of.
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 holds the time logs created for this User.
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 this entity.
user_id
vacations A list of Vacation instances
watching Taskss that this user is
department_role

A list of Departments that this user is a part of

company_role

A list of Clients that this user is a part of.

authentication_logs

A list of AuthenticationLog instances which holds the login/logout info for this User.

watching

Taskss that this user is assigned as a watcher.

It is a list of Task instances.

responsible_of

A list of Task instances that this user is responsible of.

time_logs

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

vacations

A list of Vacation instances which holds the vacations created for this User

login

The login name of the user.

Can not be empty.

email

email of the user, accepts string

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.

tasks

Tasks assigned to this user.

It is a list of Task instances.

check_password(raw_password)[source]

Checks the given raw_password.

Checks the given raw_password with the current User object’s mangled password. Handles the encryption process behind the scene.

Note:
This function was updated to support both Python 2.7 and 3.5. It will now compare the string (str) versions of the given raw_password and the current Users object encrypted password.
tickets

The list of Tickets that this user has.

returns a list of Ticket instances which this user is the owner of.

open_tickets

The list of open Tickets that this user has.

returns a list of Ticket instances which has a status of Open that this user is assigned as the owner.

to_tjp

outputs a TaskJuggler formatted string

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.

generic_text

This attribute can hold any text.

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 to 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 a Type instance with a proper Type.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.