This command is potentially dangerous. For example, if you send a "rm" command, then Corrade will delete the current working directory. Please ensure that you test scripts on non system folders or expendable inventory items before running the scripts in production.
3 August 2024
follow
parameter.8 January 2024
verify
parameter.6 October 2016
11 September 2016
mv
action.28 March 2015
cp
(copy an item), mv
(move an item), ln
(create an item link).25 March 2015
inventory (Commands) | |
---|---|
Type | Corrade progressive command |
Command | inventory |
Description | The inventory commands allows an user to manipulate Corrade's inventory by using a set of commands comparable to UNIX commands for manipulating directory paths. |
Permissions | inventory |
Parameters | group , password , action |
Last Changes | Release 9.133 - The command now can take a path instead of a name. |
The inventory
commands allows an user to manipulate Corrade's inventory by using a set of commands comparable to UNIX commands for manipulating directory paths. When Corrade is started, each group has its own unique current directory set to My Inventory
, which can then be manipulated and altered separately by each group in part.
Command | Required Parameters | Required Corrade Permissions | Example |
---|---|---|---|
inventory | group , password , action | inventory | llInstantMessage(CORRADE, wasKeyValueEncode( [ // show current directory. "command", "inventory", "group", wasURLEscape(GROUP), "password", wasURLEscape(PASSWORD), "action", "cwd" ] ) ); |
Action | Required Parameter | Optional Parameter | Description |
---|---|---|---|
ls | path | Lists the contents of the current folder with an optional path and follow links if follow is set to True . |
|
follow |
|||
cwd | follow | List the current directory and optionally follow links if follow is set to True . |
|
cd | path | Changes directory to the folder specified by the path. | |
mkdir | name | path | Creates a directory specified by name at a given optional path - or, inside the current directory, if the path is not specified. |
chmod | permissions | path | Sets the permissions on the items in the current directory, or in a directory specified by path or an item in the path . |
rm | path | Removes the folder or inventory item referred to by path to the trash folder. |
|
verify | The verify parameter must be set to True in case the command should act upon system folders. |
||
cp | source | Copies an item specified by the source path to the target with an optional new name . The target can be either a folder or a path ending in a name. |
|
target | |||
name | |||
mv | source | Moves an item specified by the source path to the target . The target has to be an inventory folder. If the name parameter is also specified, then the item will be renamed. |
|
target | |||
name | |||
verify | The verify parameter must be set to True in case the command should allow the source folder to be a system folder. |
||
ln | source | Creates a link from the source path to the target folder with an optional new name . Note that the source must be the path to an item and that folders are not supported. The target can be either a folder or a path ending in a name. |
|
target | |||
name |
action
set to cwd
. The pointer describes where in the inventory folder tree the user finds itself and issuing commands will take the current working directory cwd
as parameter when the path
parameter is not provided. For instance, issuing cd /My Inventory/Objects
will make the pointer reference the folder /My Inventory/Objects
and any commands such as ls
will list the contents of the /My Inventory/Objects
folder. The pointer will be reset upon each Corrade restart.ls
sub-parameter will make the command return a CVS list of the following fields:name
- the name of the inventory item,item
- the inventory UUID of the inventory item,type
- the inventory item type,permissions
- a permission string representing the permissions of the inventory item,time
- a string representing the last modification date of the inventory item.
This command uses the Corrade permissions notation. As an example, let us enumerate a notecard called test
and placed in the Notecards
sub-folder of My Inventory
:
llInstantMessage(CORRADE, wasKeyValueEncode( [ // show current directory. "command", "inventory", "group", wasURLEscape(GROUP), "password", wasURLEscape(PASSWORD), "action", "ls", "path", wasURLEscape("/My Inventory/Notecards/test"), "callback", wasURLEscape(URL) ] ) );
the callback will receive a data
key with the following CSV:
name, test, item, b815f8e4-0367-b361-9227-f1ab7e036eef, type, notecard, permissions, c--mvt------------c--mvtc--mvt
we can thus observe that the permissions for the test
notecard are:
c--mvt------------c--mvtc--mvt
these permissions are similar to UNIX commands and are compatible with Corrade's chmod
action of the inventory
command. They describe all the permissions governing our test
notecard.
To dissect these permissions, you can use the following guide:
cdemvt
, ——
, ——
, cdemvt
, cdemvt
.c
(copy), d
(damage), e
(export), m
(modify), v
(move), t
(transfer).-
) instead, that means that the permissions is missing.Suppose that we wanted to change the permissions for the next owner and remove the modify permissions. We would then issue the following command:
llInstantMessage(CORRADE, wasKeyValueEncode( [ // show current directory. "command", "inventory", "group", wasURLEscape(GROUP), "password", wasURLEscape(PASSWORD), "action", "chmod", "path", wasURLEscape("/My Inventory/Notecards/test"), "permissions", wasURLEscape("c--mvt------------c---vtc--mvt"), "callback", wasURLEscape(URL) ] ) );
The original permissions for the test
notecard were:
c--mvt------------c--mvtc--mvt
and the new permissions are now:
c--mvt------------c---vtc--mvt
As you can see, the 4th segment which refers to the next owner permissions is missing the m
component, meaning that it cannot be modified.