UserService Class
Service for performing user specific operations.
Item Index
Methods
- _isFieldInUse
- determineUserSiteScope
- findByAccessLevel
- getAdminOptions
- getAuthors
- getByUsernameOrEmail
- getEditorSelectList deprecated
- getExistingUsernameEmailCounts
- getFormattedName static
- getFullName
- getWriterOrEditorSelectList
- hasAccessLevel
- isUsernameInUse
- isUsernameInUse
- static
- static
- isUserNameOrEmailTaken
- removePassword static
- sendPasswordResetEmail deprecated
- sendVerificationEmail
- validate
- validate static
Properties
- TYPE static
- UNVERIFIED_TYPE static
Methods
_isFieldInUse
-
value
-
field
-
[options]
-
cb
Indicates if there exists a user with the specified property value. The field is expected to be a string value. The values will be compare with case ignored.
Parameters:
-
value
String -
field
String -
[options]
Object optional-
[exclusionId]
String optional
-
-
cb
Function
determineUserSiteScope
-
accessLevel
-
siteId
Parameters:
-
accessLevel
Integer -
siteId
String
Returns:
findByAccessLevel
-
level
-
[options]
-
cb
Retrieves users by their access level (role)
Parameters:
-
level
IntegerThe admin level of the users to find
-
[options]
Object optionalThe search options
-
[select={}]
Object optionalThe fields to return
-
[orderBy]
Array optionalThe order to return the results in
-
[limit]
Integer optionalThe maximum number of results to return
-
[offset=0]
Offset optionalThe number of results to skip before returning results.
-
-
cb
Function(Error, Array) A callback that takes two parameters: an error, if occurred, and the second is an array of User objects.
getAdminOptions
-
session
-
ls
Retrieves the available access privileges to assign to a user
Parameters:
-
session
ObjectThe current session object
-
ls
LocalizationThe localization object
Returns:
getAuthors
-
objArry
-
cb
Gets the full names for the supplied authors
Parameters:
-
objArry
ArrayAn array of user object
-
cb
Function(Error, Array)
getByUsernameOrEmail
-
usernameOrEmail
-
[options]
-
cb
Parameters:
-
usernameOrEmail
String -
[options]
Object optionalSee UserService#getSingle
-
cb
Function(Error, object) The user object
getEditorSelectList
-
currId
-
cb
Retrieves a select list (id/name) of available system editors
Parameters:
-
currId
StringThe Id to be excluded from the list.
-
cb
Function(Error, Array) A callback that takes two parameters. The first is an error, if exists, the second is an array of objects that represent the editor select list.
getExistingUsernameEmailCounts
-
username
-
email
-
[id]
-
cb
Gets the total counts of a username and email in both the user and unverified_user collections
Parameters:
-
username
String -
email
String -
[id]
String optionalUser object Id to exclude from the search
-
cb
Function(Error, object)
getFormattedName
-
user
Takes the specified user object and formats the first and last name.
Parameters:
-
user
ObjectThe user object to extract a name for.
Returns:
The user's full name
getFullName
-
userId
-
cb
Gets the full name of a user
Parameters:
-
userId
StringThe object Id of the user
-
cb
Function(Error, string)
getWriterOrEditorSelectList
-
currId
-
[getWriters=false]
-
cb
Retrieves a select list (id/name) of available system writers or editors
Parameters:
-
currId
StringThe Id to be excluded from the list.
-
[getWriters=false]
Boolean optionalWhether to retrieve all writers or just editors.
-
cb
FunctionA callback that takes two parameters. The first is an error, if exists, the second is an array of objects that represent the editor select list.
hasAccessLevel
-
uid
-
accessLevel
-
cb
Verifies if a user has the provided access level or higher
Parameters:
-
uid
StringThe user's object Id
-
accessLevel
NumberThe access level to test against
-
cb
FunctionCallback function
isUsernameInUse
-
username
-
[options]
-
cb
Indicates if there exists a user with the specified username value. The field is expected to be a string value. The values will be compare with case ignored.
Parameters:
-
username
String -
[options]
Object optional-
[exclusionId]
String optional
-
-
cb
Function
isUsernameInUse
-
email
-
[options]
-
cb
Indicates if there exists a user with the specified email value. The field is expected to be a string value. The values will be compare with case ignored.
Parameters:
-
email
String -
[options]
Object optional-
[exclusionId]
String optional
-
-
cb
Function
-
context
-
cb
Parameters:
-
context
Object-
service
UserServiceAn instance of the service that triggered the event that called this handler
-
data
ObjectThe DTO
-
object
ObjectThe entity object to be persisted
-
-
cb
Function(Error) A callback that takes a single parameter: an error if occurred
-
context
-
cb
Parameters:
-
context
Object-
service
UserServiceAn instance of the service that triggered the event that called this handler
-
data
Object
-
-
cb
Function(Error) A callback that takes a single parameter: an error if occurred
isUserNameOrEmailTaken
-
username
-
email
-
id
-
cb
Checks to see if a proposed user name or email is already in the system
Parameters:
-
username
String -
email
String -
id
StringUser object Id to exclude from the search
-
cb
FunctionCallback function
removePassword
-
context
-
cb
Strips the password from one or more user objects when passed a valid base object service event context
Parameters:
-
context
Object-
data
ObjectThe DTO that was provided for persistence
-
service
UserServiceAn instance of the service that triggered the event that called this handler
-
-
cb
FunctionA callback that takes a single parameter: an error if occurred
sendPasswordResetEmail
-
user
-
passwordReset
-
cb
Sends a password reset email to a user
Parameters:
-
user
ObjectA user object
-
passwordReset
ObjectA password reset object containing the verification code
-
cb
Function(Error)
sendVerificationEmail
-
user
-
cb
Sends a verification email to an unverified user
Parameters:
-
user
ObjectA user object
-
cb
FunctionCallback function
validate
-
context
-
cb
Parameters:
-
context
Object-
data
ObjectThe DTO that was provided for persistence
-
service
UserServiceAn instance of the service that triggered the event that called this handler
-
-
cb
Function(Error) A callback that takes a single parameter: an error if occurred
validate
-
context
-
cb
Parameters:
-
context
Object-
data
ObjectThe DTO that was provided for persistence
-
service
UserServiceAn instance of the service that triggered the event that called this handler
-
-
cb
FunctionA callback that takes a single parameter: an error if occurred