kepler.models.user module

The module defines the classes for database models related to users.

class kepler.models.user.User(jyu_account_name, jyu_guid, last_name, first_names, call_name=None)

Bases: sqlalchemy.ext.declarative.api.Base

The class represents the rows in the database table User. All the users of the system are in the stored as rows in this table containing all needed information

The user name is composed from three parts: last name, first names and call name. Both first names and call name can be null, but the last name must always be non-null.

jyu_guid is the unique identifier that is used to link the OAuth2 authenticated user to the user in Kepler.

call_name

The call name of the user.

first_names

The first names of the user.

get_call_fullname()

The function returns the concatenation of the call name and last name of the user or in the case the user has no call name or first names, only the last name is returned.

get_call_name()

The function returns the call name of the user. If the user does not have a call name, then the first names are returned. If the user only has last name, then it is returned.

get_fullname()

The function returns the full name of the user. If the user has first names, then they are prepended to the last name. Otherwise only the last name is returned.

id

The ID of the user.

jyu_account_name

The account name of the user in the services of JYU.

jyu_guid

The globally uniquie identifier of the user in the services of JYU.

language_id

The saved language setting of the user.

last_name

The last name of the user.

last_update
sort_key()

The function returns the sort key value for sorting the names. The return value is the same as get_call_fullname() would return, but the last name comes first, and then the call name.

Returns:The full call name with last name first.
class kepler.models.user.UserInfo(user_id, user_info_type_id, value)

Bases: sqlalchemy.ext.declarative.api.Base

User information, like email addresses and phone numbers, are stored in the database as UserInfo table rows. The type of the information is specified by UserInfoType table. One user can have multiple user information rows with many different types.

id

The ID of the user info.

user_id

The ID of the user whose information this row contains.

user_info_type_id

The ID of type of the user info.

value

The actual value of the user info as string.

class kepler.models.user.UserInfoType(id, name_tr_id)

Bases: sqlalchemy.ext.declarative.api.Base

UserInfoType specifies the type for the generic user information in UserInfo table.

active

Specifies if the user info type is active or has been deactivated.

id

The ID of the user info type.

name_tr_id

The translation ID of the name of the user info type.