RT 3.8.17 Documentation

RT::User Overlay

Go to latest version →

NAME

  RT::User - RT User object

SYNOPSIS

  use RT::User;

DESCRIPTION

METHODS

Create { PARAMHASH }

SetPrivileged BOOL

If passed a true value, makes this user a member of the "Privileged" PseudoGroup. Otherwise, makes this user a member of the "Unprivileged" pseudogroup.

Returns a standard RT tuple of (val, msg);

Privileged

Returns true if this user is privileged. Returns undef otherwise.

Load

Load a user object from the database. Takes a single argument. If the argument is numerical, load by the column 'id'. If a user object or its subclass passed then loads the same user by id. Otherwise, load by the "Name" column which is the user's textual username.

LoadByEmail

Tries to load this user object from the database by the user's email address.

LoadOrCreateByEmail ADDRESS

Attempts to find a user who has the provided email address. If that fails, creates an unprivileged user with the provided email address and loads them. Address can be provided either as Email::Address object or string which is parsed using the module.

Returns a tuple of the user's id and a status message. 0 will be returned in place of the user's id in case of failure.

ValidateEmailAddress ADDRESS

Returns true if the email address entered is not in use by another user or is undef or ''. Returns false if it's in use.

SetEmailAddress

Check to make sure someone else isn't using this email address already so that a better email address can be returned

EmailFrequency

Takes optional Ticket argument in paramhash. Returns 'no email', 'squelched', 'daily', 'weekly' or empty string depending on user preferences.

'no email' - user has no email, so can not recieve notifications.
'squelched' - returned only when Ticket argument is provided and notifications to the user has been supressed for this ticket.
'daily' - retruned when user recieve daily messages digest instead of immediate delivery.
'weekly' - previous, but weekly.
empty string returned otherwise.

CanonicalizeEmailAddress ADDRESS

CanonicalizeEmailAddress converts email addresses into canonical form. it takes one email address in and returns the proper canonical form. You can dump whatever your proper local config is in here. Note that it may be called as a static method; in this case the first argument is class name not an object.

CanonicalizeUserInfo HASH of ARGS

CanonicalizeUserInfo can convert all User->Create options. it takes a hashref of all the params sent to User->Create and returns that same hash, by default nothing is done.

This function is intended to allow users to have their info looked up via an outside source and modified upon creation.

SetRandomPassword

Takes no arguments. Returns a status code and a new password or an error message. If the status is 1, the second value returned is the new password. If the status is anything else, the new value returned is the error code.

ResetPassword

Returns status, [ERROR or new password]. Resets this user\'s password to a randomly generated pronouncable password and emails them, using a global template called "RT_PasswordChange", which can be overridden with global templates "RT_PasswordChange_Privileged" or "RT_PasswordChange_NonPrivileged" for privileged and Non-privileged users respectively.

GenerateRandomPassword MIN_LEN and MAX_LEN

Returns a random password between MIN_LEN and MAX_LEN characters long.

SetPassword

Takes a string. Checks the string's length and sets this user's password to that string.

_GeneratePassword PASSWORD [, SALT]

Returns a salted SHA-256 hash of the password passed in, in base64 encoding.

_GeneratePasswordBase64 PASSWORD

returns an MD5 hash of the password passed in, in base64 encoding (obsoleted now).

HasPassword

Returns true if the user has a valid password, otherwise returns false.

IsPassword

Returns true if the passed in value is this user's password. Returns undef otherwise.

AuthToken

Returns an authentication string associated with the user. This string can be used to generate passwordless URLs to integrate RT with services and programms like callendar managers, rss readers and other.

GenerateAuthToken

Generate a random authentication string for the user.

GenerateAuthString

Takes a string and returns back a hex hash string. Later you can use this pair to make sure it's generated by this user using "ValidateAuthString"

ValidateAuthString

Takes auth string and protected string. Returns true is protected string has been protected by user's "AuthToken". See also "GenerateAuthString".

SetDisabled

Toggles the user's disabled flag. If this flag is set, all password checks for this user will fail. All ACL checks for this user will fail. The user will appear in no user listings.

Disabled

Returns true if user is disabled or false otherwise

PrincipalObj

Returns the principal object for this user. returns an empty RT::Principal if there's no principal object matching this user. The response is cached. PrincipalObj should never ever change.

PrincipalId

Returns this user's PrincipalId

HasGroupRight

Takes a paramhash which can contain these items: GroupObj => RT::Group or Group => integer Right => 'Right'

Returns 1 if this user has the right specified in the paramhash for the Group passed in.

Returns undef if they don't.

OwnGroups

Returns a group collection object containing the groups of which this user is a member.

HasRight

Shim around PrincipalObj->HasRight. See RT::Principal.

CurrentUserCanSee [FIELD]

Returns true if the current user can see the user, based on if it is public, ourself, or we have AdminUsers

CurrentUserCanModify RIGHT

If the user has rights for this object, either because he has 'AdminUsers' or (if he\'s trying to edit himself and the right isn\'t an admin right) 'ModifySelf', return 1. otherwise, return undef.

CurrentUserHasRight

Takes a single argument. returns 1 if $Self->CurrentUser has the requested right. returns undef otherwise

Preferences NAME/OBJ DEFAULT

Obtain user preferences associated with given object or name. Returns DEFAULT if no preferences found. If DEFAULT is a hashref, override the entries with user preferences.

SetPreferences NAME/OBJ VALUE

Set user preferences associated with given object or name.

WatchedQueues ROLE_LIST

Returns a RT::Queues object containing every queue watched by the user.

Takes a list of roles which is some subset of ('Cc', 'AdminCc'). Defaults to:

$user->WatchedQueues('Cc', 'AdminCc');

CleanupInvalidDelegations { InsideTransaction => undef }

Revokes all ACE entries delegated by this user which are inconsistent with their current delegation rights. Does not perform permission checks. Should only ever be called from inside the RT library.

If called from inside a transaction, specify a true value for the InsideTransaction parameter.

Returns a true value if the deletion succeeded; returns a false value and logs an internal error if the deletion fails (should not happen).

_Value

Takes the name of a table column. Returns its value as a string, if the user passes an ACL check

FriendlyName

Return the friendly name

PreferredKey

Returns the preferred key of the user. If none is set, then this will query GPG and set the preferred key to the maximally trusted key found (and then return it). Returns undef if no preferred key can be found.

← Back to index