models.server.User Class
Server User model
Item Index
Methods
- byEmailAddress static
- byExternalId static
- byUsername static
- createdAt
- deletedAt
- ensureUserByEmail
- ensureUserByUsername static
- ensureUserFromJWTToken static
- fetchOrCreate
- getDomainUsername
- getEmail
- getExternalId
- getFullName
- getOrganisationAdminVisibility
- getOrganisationDomain
- getOrganisationName
- getOrganisationVisibility
- getPersonalVisibility
- getProfileImage
- getSocketIORoom
- getUsername
- getVisibilities
- hasVisibility
- isEmailOnly
- isImage
- isManager
- isSame
- isSoftDeleted
- softDelete
- toURL
- uniqueId
- updatedAt
Methods
byEmailAddress
-
emailAddress
Shortcut for getting user models by the email address
Parameters:
-
emailAddressString
Returns:
byExternalId
()
models.server.User
static
Shortcut for getting user models by the externalId
Returns:
byUsername
()
models.server.User
static
Shortcut for getting user model by the username (externalData)
Returns:
createdAt
()
Date
Returns:
deletedAt
()
Date
Returns:
ensureUserByEmail
-
emailAddress -
first_name -
last_name
Ensure that user exists for this email address
Parameters:
-
emailAddressString -
first_nameString -
last_nameString
Returns:
models.server.User
ensureUserByUsername
-
username -
puavoDomain
Fetch user from puavo-rest, save it to the local SQL DB and return it in a Promise.
Parameters:
-
usernameString -
puavoDomainString
Returns:
with models.server.User
ensureUserFromJWTToken
-
JWT
Ensure that user from a Opinsys JWT token Object exists and is up to date
Parameters:
-
JWTObjecttoken object from Opinsys SSO
Returns:
models.server.User
fetchOrCreate
-
identifier
Fetch or create a model uniquely identified by the columns defined in
the identifier
Parameters:
-
identifierObjectObject of table columns
Returns:
with the model instance
getDomainUsername
()
String
Returns:
getEmail
()
String
Returns:
getExternalId
()
String
Returns:
getFullName
()
String
Returns:
getOrganisationAdminVisibility
()
String
Returned in User#getVisibilities() if the user is an organisation admin
Returns:
getOrganisationDomain
()
String
Returns:
getOrganisationName
()
Get human readable organisation name
getOrganisationVisibility
()
String
Returns:
getPersonalVisibility
()
String
Returns:
getProfileImage
()
String
Returns:
url to the profile image
getSocketIORoom
()
String
Same as models.server.Follower#getSocketIORoom()
Returns:
getUsername
()
String
WARNING this is not unique between different organisations in puavo-ticket. Use User#getDomainUsername() when possible.
Returns:
getVisibilities
()
Array
Get visibility strings for the user
Returns:
Array of visibility strings. Eg organisation:testing.opinsys.fi
hasVisibility
-
visibility -
models
Visibility assertion helper
Parameters:
-
visibilityString -
modelsArrayArray of models.server.Visibility models
Returns:
Boolean
isEmailOnly
()
Boolean
Return true for users that have not ever logged in puavo-ticket and have used it only via email
Returns:
isImage
()
Boolean
Return true if the attachment is an image which can be displayed in a
tag
Returns:
isManager
()
Boolean
Return true if the user a manager
Returns:
isSame
-
other
Return true if the other object is built using the same constructor and they have the same id
Parameters:
-
otherBackbone.Model
Returns:
Boolean
isSoftDeleted
()
Boolean
Returns:
softDelete
-
byUser
Set timestamp to deletedAt
Parameters:
-
byUsermodels.server.User | NumberThe user who deleted the model
Returns:
toURL
()
String
Return url to this attachment
Returns:
uniqueId
()
String
Returns:
updatedAt
()
Date
Returns:
Properties
type
String
The database table name
Virtual database field. Use .get("type") to access it.
unique_id
String
Unique id between tables.
Virtual database field. Use .get("unique_id") to access it.
