RT::Asset - Represents a single asset record
An Asset is a small record object upon which zero to many custom fields are applied. The core fields are:
Limited to 255 characters.
Limited to 255 characters.
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.
Loads the specified Asset into the current object.
Create takes a hash of values and creates a row in the database. Available keys are:
Name or numeric 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.
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.
Any of these link types accept either a single value or arrayref of values parseable by RT::URI.
A boolean to control if to create role groups immediately or just when necessary. It defaults to $RT::Record::Role::Roles::LAZY_ROLE_GROUPS
, which is false by default.
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.
Requires that Names contain at least one non-digit. Empty names are OK.
Takes a catalog name or ID. Returns true if the catalog exists and is not disabled, otherwise false.
Assets may not be deleted. Always returns failure.
You should disable the asset instead with $asset->SetStatus('deleted')
.
Returns true if the current user has the right for this asset, or globally if this is called on an unloaded object.
Returns true if the current user can see the asset, either because they just created it or they have the ShowAsset right.
Returns this asset's URI
Returns the RT::Catalog object for this asset's catalog.
Validates the supplied catalog and updates the column if valid. Transitions Status if necessary. Returns a (status, message) tuple.
Returns an RT::User object for this asset's Owner role group. On error, returns undef.
Returns an RT::Group object for this asset's HeldBy role group. The object may be unloaded if permissions aren't satisfied.
Returns an RT::Group object for this asset's Contact role group. The object may be unloaded if permissions aren't satisfied.
Checks ModifyAsset before calling "_AddRoleMember" in RT::Record::Role::Roles.
Checks ModifyAsset before calling "_DeleteRoleMember" in RT::Record::Role::Roles.
An ACL'd version of "_RoleGroup" in RT::Record::Role::Roles. Checks ShowAsset.
Public methods, but you shouldn't need to call these unless you're extending Assets.
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.
Documented for internal use only, do not call these from outside RT::Asset itself.
Checks if the current user can ModifyAsset before calling SUPER::_Set
and records a transaction against this object if SUPER::_Set
was successful.
Checks "CurrentUserCanSee" before calling SUPER::_Value
.