- NAME
- DESCRIPTION
- METHODS
  - Load ID or NAME
  - Create PARAMHASH
  - ValidateName NAME
  - Delete
  - CurrentUserCanSee
  - Owner
  - HeldBy
  - Contacts
  - AddRoleMember
  - DeleteRoleMember
  - RoleGroup
  - AssetCustomFields
- INTERNAL METHODS
  - CacheNeedsUpdate
- PRIVATE METHODS
  - _Set
  - Lifecycle [CONTEXT_OBJ]
  - _Value

# NAME

RT::Catalog - A logical set of assets

# DESCRIPTION

Catalogs are for assets what queues are for tickets or classes are for articles.

It announces the rights for assets, and rights are granted at the catalog or global level. Asset custom fields are either applied globally to all Catalogs or individually to specific Catalogs.

id
Name

  Limited to 255 characters.

Description

  Limited to 255 characters.

Lifecycle
Disabled
Creator
Created
LastUpdatedBy
LastUpdated

All of these are readable through methods of the same name and mutable through methods of the same name with `Set` prefixed. The last four are automatically managed.

# METHODS

## Load ID or NAME

Loads the specified Catalog into the current object.

## Create PARAMHASH

Create takes a hash of values and creates a row in the database. Available keys are:

Name
Description
Lifecycle
HeldBy, Contact

  A single principal ID or array ref of principal IDs to add as members of the respective role groups for the new catalog.

  User Names and EmailAddresses may also be used, but Groups must be referenced by ID.

Disabled

Returns a tuple of (status, msg) on failure and (id, msg, non-fatal errors) on success, where the third value is an array reference of errors that occurred but didn't prevent creation.

## ValidateName NAME

Requires that Names contain at least one non-digit and doesn't already exist.

## Delete

Catalogs may not be deleted. Always returns failure.

You should disable the catalog instead using `$catalog->SetDisabled(1)`.

## CurrentUserCanSee

Returns true if the current user can see the catalog via the ShowCatalog or AdminCatalog rights.

## Owner

Returns an RT::User object for this catalog's Owner role group. On error, returns undef.

## HeldBy

Returns an RT::Group object for this catalog's HeldBy role group. The object may be unloaded if permissions aren't satisfied.

## Contacts

Returns an RT::Group object for this catalog's Contact role group. The object may be unloaded if permissions aren't satisfied.

## AddRoleMember

Checks AdminCatalog before calling "_AddRoleMember" in RT::Record::Role::Roles.

## DeleteRoleMember

Checks AdminCatalog before calling "_DeleteRoleMember" in RT::Record::Role::Roles.

## RoleGroup

An ACL'd version of "_RoleGroup" in RT::Record::Role::Roles. Checks ShowCatalog.

## AssetCustomFields

Returns an RT::CustomFields object containing all global and catalog-specific asset custom fields.

# INTERNAL METHODS

## CacheNeedsUpdate

Takes zero or one arguments.

If a true argument is provided, marks any Catalog caches as needing an update. This happens when catalogs are created, disabled/enabled, or modified. Returns nothing.

If no arguments are provided, returns an epoch time that any catalog caches should be newer than.

May be called as a class or object method.

# PRIVATE METHODS

Documented for internal use only, do not call these from outside RT::Catalog itself.

## _Set

Checks if the current user can AdminCatalog before calling `SUPER::_Set` and records a transaction against this object if `SUPER::_Set` was successful.

## Lifecycle [CONTEXT_OBJ]

Returns the current value of Lifecycle.

Provide an optional asset object as context to check role-level rights in addition to catalog-level rights for ShowCatalog and AdminCatalog.

(In the database, Lifecycle is stored as varchar(32).)

## _Value

Checks "CurrentUserCanSee" before calling `SUPER::_Value`.

← Back to index