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:
-
valueString -
fieldString -
[options]Object optional-
[exclusionId]String optional
-
-
cbFunction
determineUserSiteScope
-
accessLevel -
siteId
Parameters:
-
accessLevelInteger -
siteIdString
Returns:
findByAccessLevel
-
level -
[options] -
cb
Retrieves users by their access level (role)
Parameters:
-
levelIntegerThe 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.
-
-
cbFunction(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:
-
sessionObjectThe current session object
-
lsLocalizationThe localization object
Returns:
getAuthors
-
objArry -
cb
Gets the full names for the supplied authors
Parameters:
-
objArryArrayAn array of user object
-
cbFunction(Error, Array)
getByUsernameOrEmail
-
usernameOrEmail -
[options] -
cb
Parameters:
-
usernameOrEmailString -
[options]Object optionalSee UserService#getSingle
-
cbFunction(Error, object) The user object
getEditorSelectList
-
currId -
cb
Retrieves a select list (id/name) of available system editors
Parameters:
-
currIdStringThe Id to be excluded from the list.
-
cbFunction(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:
-
usernameString -
emailString -
[id]String optionalUser object Id to exclude from the search
-
cbFunction(Error, object)
getFormattedName
-
user
Takes the specified user object and formats the first and last name.
Parameters:
-
userObjectThe user object to extract a name for.
Returns:
The user's full name
getFullName
-
userId -
cb
Gets the full name of a user
Parameters:
-
userIdStringThe object Id of the user
-
cbFunction(Error, string)
getWriterOrEditorSelectList
-
currId -
[getWriters=false] -
cb
Retrieves a select list (id/name) of available system writers or editors
Parameters:
-
currIdStringThe Id to be excluded from the list.
-
[getWriters=false]Boolean optionalWhether to retrieve all writers or just editors.
-
cbFunctionA 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:
-
uidStringThe user's object Id
-
accessLevelNumberThe access level to test against
-
cbFunctionCallback 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:
-
usernameString -
[options]Object optional-
[exclusionId]String optional
-
-
cbFunction
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:
-
emailString -
[options]Object optional-
[exclusionId]String optional
-
-
cbFunction
-
context -
cb
Parameters:
-
contextObject-
serviceUserServiceAn instance of the service that triggered the event that called this handler
-
dataObjectThe DTO
-
objectObjectThe entity object to be persisted
-
-
cbFunction(Error) A callback that takes a single parameter: an error if occurred
-
context -
cb
Parameters:
-
contextObject-
serviceUserServiceAn instance of the service that triggered the event that called this handler
-
dataObject
-
-
cbFunction(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:
-
usernameString -
emailString -
idStringUser object Id to exclude from the search
-
cbFunctionCallback function
removePassword
-
context -
cb
Strips the password from one or more user objects when passed a valid base object service event context
Parameters:
-
contextObject-
dataObjectThe DTO that was provided for persistence
-
serviceUserServiceAn instance of the service that triggered the event that called this handler
-
-
cbFunctionA callback that takes a single parameter: an error if occurred
sendPasswordResetEmail
-
user -
passwordReset -
cb
Sends a password reset email to a user
Parameters:
-
userObjectA user object
-
passwordResetObjectA password reset object containing the verification code
-
cbFunction(Error)
sendVerificationEmail
-
user -
cb
Sends a verification email to an unverified user
Parameters:
-
userObjectA user object
-
cbFunctionCallback function
validate
-
context -
cb
Parameters:
-
contextObject-
dataObjectThe DTO that was provided for persistence
-
serviceUserServiceAn instance of the service that triggered the event that called this handler
-
-
cbFunction(Error) A callback that takes a single parameter: an error if occurred
validate
-
context -
cb
Parameters:
-
contextObject-
dataObjectThe DTO that was provided for persistence
-
serviceUserServiceAn instance of the service that triggered the event that called this handler
-
-
cbFunctionA callback that takes a single parameter: an error if occurred
