O.user()

Look up a user, and return an object implementing the SecurityPrincipal interface.

function O.user(userId)

If a number is passed to this function, look up the user with that user ID.

An exception will be thrown if the user does not exist.

function O.user(emailAddress)

If a string is passed to this function, look up a user with that email address.

null will be returned if no user has that email address.

function O.user(ref)

Look up the user with the ref property set to this Ref.

null will be returned if no such user exists.

If more than one user has this ref, your code should not rely on which one is returned.

function O.allUsersWithEmailAddress(emailAddress)

Return an Array of zero or more SecurityPrincipal objects which have the specified email address and are currently active.

In general, you should use O.user(emailAddress), which will return the oldest SecurityPrincipal object with that email address. However, if you’re writing a custom authentication system, you may need to create multiple users with the same email address and this function will be useful to find them all.

function O.serviceUser(code)

Return a service user with the given code.

If the service user does not exist, an exception is thrown.

Service users are created with schema requirements.