Class: UserMethods
| Defined in: | src/methods/user-methods.coffee |
Overview
Provides methods to interact with scotties.
Constant Summary
-
UPDATE_FIELDS_FULL
=
CREATE_FIELDS = ['username']
-
['username', 'description', 'displayName', 'identities', 'primaryEmail', 'profileLinks', 'userImages', 'selectedUserImage', 'emails', 'roles', 'data', 'resourceLimits', 'onboardingState', 'title', 'location', 'needsInit']
Instance Method Summary
- - (void) constructor(models) Constructor Initializes a new instance of the UserMethods class.
- - (void) all(offset = 0, count = 25, cb) Bound
- - (void) getByIds(idList = [], cb) Bound Retrieves users by passing a list of id's, which can be string or objectIds
- - (void) getByUsernames(usernames = [], options = {}, cb = function() {}) Bound Retrieves users by passing a list of usernames.
- - (void) get(id, cb = function() {}) Bound Looks up a user by id.
- - (void) lookup(q, options = {}, cb = function() {}) Bound Returns a list of users who match q.
- - (void) getByName(name, cb = function() {}) Bound
- - (void) getByPrimaryEmail(email, cb = function() {}) Bound
- - (void) getByNameOrId(nameOrId, cb = function() {}) Bound
- - (void) patch(usernameOrId, obj = {}, actor, cb = function() {}) Bound
- - (void) delete(usernameOrId, actor, cb = function() {}) Bound
- - (void) destroy(usernameOrId, actor, cb = function() {}) Bound
- - (void) setPassword(usernameOrId, password, actor, cb = function() {}) Bound
- - (void) findUserByUsernameOrEmail(usernameOrEmail, cb) Bound Looks up a user by username or email.
- - (void) validateUserByUsernameOrEmail(usernameOrEmail, password, cb) Bound Looks up the user, if found validates against password.
- - (void) hashPassword(password, cb) Bound
- - (void) create(objs = {}, cb) Bound Creates a new user.
- - (void) getOrCreateUserFromProvider(provider, v1, v2, profile, cb) Bound Gets or creates a user for a given provider/profile combination.
- - (void) _usernameFromProfile(profile) Bound
- - (void) _displayNameFromProfile(profile) Bound
- - (void) _profileImageFromProfile(profile) Bound
- - (void) addIdentityToUser(userId, provider, v1, v2, profile, cb = function() {}) Bound Adds an identity to an existing user.
- - (void) removeIdentityFromUser(userId, identityId, cb = function() {}) Bound
- - (void) addRoles(userId, roles, cb = function() {}) Bound
- - (void) removeRoles(userId, roles, cb = function() {}) Bound
- - (void) resetPassword(email, cb = function() {}) Bound
- - (void) resetPasswordToken(token, password, cb = function() {}) Bound p0qEeKBoh25031326eefa65c0000000006TWlhZKbLjn
- - (void) addEmail(userId, email, isValidated, cb = function() {}) Bound
- - (void) removeEmail(userId, email, cb = function() {}) Bound
Constructor Details
- (void) constructor(models)
Initializes a new instance of the UserMethods class.
Instance Method Details
- (void) all(offset = 0, count = 25, cb) (bound)
- (void) getByIds(idList = [], cb) (bound)
Retrieves users by passing a list of id's, which can be string or objectIds
- (void) getByUsernames(usernames = [], options = {}, cb = function() {}) (bound)
Retrieves users by passing a list of usernames.
- (void) get(id, cb = function() {}) (bound)
Looks up a user by id.
- (void) lookup(q, options = {}, cb = function() {}) (bound)
Returns a list of users who match q. In this version we do a straight user name match.
- (void) getByName(name, cb = function() {}) (bound)
- (void) getByPrimaryEmail(email, cb = function() {}) (bound)
- (void) getByNameOrId(nameOrId, cb = function() {}) (bound)
- (void) patch(usernameOrId, obj = {}, actor, cb = function() {}) (bound)
- (void) delete(usernameOrId, actor, cb = function() {}) (bound)
- (void) destroy(usernameOrId, actor, cb = function() {}) (bound)
- (void) setPassword(usernameOrId, password, actor, cb = function() {}) (bound)
- (void) findUserByUsernameOrEmail(usernameOrEmail, cb) (bound)
Looks up a user by username or email.
- (void) validateUserByUsernameOrEmail(usernameOrEmail, password, cb) (bound)
Looks up the user, if found validates against password. cb(err) in case of non password error. cb(null, user) in case of user not found, password not valid, or valid user
- (void) hashPassword(password, cb) (bound)
- (void) create(objs = {}, cb) (bound)
Creates a new user.
- (void) getOrCreateUserFromProvider(provider, v1, v2, profile, cb) (bound)
Gets or creates a user for a given provider/profile combination.
- (void) _usernameFromProfile(profile) (bound)
- (void) _displayNameFromProfile(profile) (bound)
- (void) _profileImageFromProfile(profile) (bound)
- (void) addIdentityToUser(userId, provider, v1, v2, profile, cb = function() {}) (bound)
Adds an identity to an existing user. In this version, it replaces an existing provider of the same type.
- (void) removeIdentityFromUser(userId, identityId, cb = function() {}) (bound)
- (void) addRoles(userId, roles, cb = function() {}) (bound)
- (void) removeRoles(userId, roles, cb = function() {}) (bound)
- (void) resetPassword(email, cb = function() {}) (bound)
- (void) resetPasswordToken(token, password, cb = function() {}) (bound)
p0qEeKBoh25031326eefa65c0000000006TWlhZKbLjn
- (void) addEmail(userId, email, isValidated, cb = function() {}) (bound)
- (void) removeEmail(userId, email, cb = function() {}) (bound)