RT 4.4.3 Documentation

RT::Asset

Go to latest version →

NAME

RT::Asset - Represents a single asset record

DESCRIPTION

An Asset is a small record object upon which zero to many custom fields are applied. The core fields are:

id
Name

Limited to 255 characters.

Description

Limited to 255 characters.

Catalog
Status
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 Asset into the current object.

Create PARAMHASH

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

Name
Description
Catalog

Name or numeric ID

CustomField-<ID>

Sets the value for this asset of the custom field specified by <ID>.

<ID> should be a numeric ID, but may also be a Name if and only if your custom fields have unique names. Without unique names, the behaviour is undefined.

Status
Owner, HeldBy, Contact

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

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

RefersTo, ReferredToBy, DependsOn, DependedOnBy, Parents, Children, and aliases

Any of these link types accept either a single value or arrayref of values parseable by RT::URI.

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. Empty names are OK.

ValidateCatalog

Takes a catalog name or ID. Returns true if the catalog exists and is not disabled, otherwise false.

Delete

Assets may not be deleted. Always returns failure.

You should disable the asset instead with $asset->SetStatus('deleted').

CurrentUserHasRight RIGHTNAME

Returns true if the current user has the right for this asset, or globally if this is called on an unloaded object.

CurrentUserCanSee

Returns true if the current user can see the asset, either because they just created it or they have the ShowAsset right.

URI

Returns this asset's URI

CatalogObj

Returns the RT::Catalog object for this asset's catalog.

SetCatalog

Validates the supplied catalog and updates the column if valid. Transitions Status if necessary. Returns a (status, message) tuple.

Owner

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

HeldBy

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

Contacts

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

AddRoleMember

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

DeleteRoleMember

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

RoleGroup

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

INTERNAL METHODS

Public methods, but you shouldn't need to call these unless you're extending Assets.

CustomFieldLookupType

ACLEquivalenceObjects

ModifyLinkRight

LoadCustomFieldByIdentifier

Finds and returns the custom field of the given name for the asset, overriding "LoadCustomFieldByIdentifier" in RT::Record to look for catalog-specific CFs before global ones.

PRIVATE METHODS

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

_Set

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

_Value

Checks "CurrentUserCanSee" before calling SUPER::_Value.

← Back to index