- - IsGroup
  - IsRoleGroup
  - IsUser
  - Object
  - DisplayName
  - GrantRight { Right => RIGHTNAME, Object => undef }
  - RevokeRight { Right => "RightName", Object => "object" }
  - HasRight (Right => 'right' Object => undef)
  - HasRights
  - _HasRight
  - RolesWithRight
  - InvalidateACLCache
  - _GetPrincipalTypeForACL
  - _ReferenceId
  - id
  - PrincipalType
  - SetPrincipalType VALUE
  - Disabled
  - SetDisabled VALUE

## IsGroup

Returns true if this principal is a group. Returns undef, otherwise

## IsRoleGroup

Returns true if this principal is a role group. Returns undef, otherwise.

## IsUser

Returns true if this principal is a User. Returns undef, otherwise

## Object

Returns the user or group associated with this principal

## DisplayName

Returns the relevant display name for this principal

## GrantRight { Right => RIGHTNAME, Object => undef }

A helper function which calls RT::ACE->Create

       Returns a tuple of (STATUS, MESSAGE);  If the call succeeded, STATUS is true. Otherwise it's
       false.

## RevokeRight { Right => "RightName", Object => "object" }

Delete a right that a user has

       Returns a tuple of (STATUS, MESSAGE);  If the call succeeded, STATUS is true. Otherwise it's
          false.

## HasRight (Right => 'right' Object => undef)

Checks to see whether this principal has the right "Right" for the Object specified. This takes the params:

Right

  name of a right

Object

  an RT style object (->id will get its id)

Returns 1 if a matching ACE was found. Returns undef if no ACE was found.

Use "HasRights" to fill a fast cache, especially if you're going to check many different rights with the same principal and object.

## HasRights

Returns a hash reference with all rights this principal has on an object. Takes Object as a named argument.

Main use case of this method is the following:

        $ticket->CurrentUser->PrincipalObj->HasRights( Object => $ticket );
        ...
        $ticket->CurrentUserHasRight('A');
        ...
        $ticket->CurrentUserHasRight('Z');

Results are cached and the cache is used in this and, as well, in "HasRight" method speeding it up. Don't use hash reference returned by this method directly for rights checks as it's more complicated then it seems, especially considering config options like 'DisallowExecuteCode'.

## _HasRight

Low level HasRight implementation, use HasRight method instead.

## RolesWithRight

Returns list with names of roles that have right on set of objects. Takes Right, EquiveObjects, IncludeSystemRights and IncludeSuperusers arguments.

IncludeSystemRights is true by default, rights granted system wide are ignored when IncludeSystemRights is set to a false value.

IncludeSuperusers is true by default, SuperUser right is not checked if it's set to a false value.

## InvalidateACLCache

Cleans out and reinitializes the user rights cache

## _GetPrincipalTypeForACL

Gets the principal type. if it's a user, it's a user. if it's a role group and it has a Type, return that. if it has no type, return group.

## _ReferenceId

Returns a list uniquely representing an object or normal scalar.

For a scalar, its string value is returned. For an object that has an id() method which returns a value, its class name and id are returned as a string separated by a "-". For an object that has an id() method which returns false, its class name is returned.

## id

Returns the current value of id. (In the database, id is stored as int(11).)

## PrincipalType

Returns the current value of PrincipalType. (In the database, PrincipalType is stored as varchar(16).)

## SetPrincipalType VALUE

Set PrincipalType to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, PrincipalType will be stored as a varchar(16).)

## Disabled

Returns the current value of Disabled. (In the database, Disabled is stored as smallint(6).)

## SetDisabled VALUE

Set Disabled to VALUE. Returns (1, 'Status message') on success and (0, 'Error Message') on failure. (In the database, Disabled will be stored as a smallint(6).)

← Back to index