Skip to content
Peter Shinners edited this page Apr 13, 2021 · 5 revisions
bool checkPermissions(const std::string &assetId, const StringMap &context)
  • @param assetId Asset id to check permissions for.
  • @param context Additional strings used to specify more details about permissions to be checked. Examples include current user or current show environment.

True if permissions for the given asset id are valid in the given context.

Returns whether permissions for the given asset id are valid in the given context.

The context contains additional strings to specify more details about permissions to be checked. Examples include current user or current show environment.

This is used for live groups to determine if the group can be edited.

A studio may decide to use permissions for working with certain assets on a project. These permissions may depend on the name of the current user, the name of the user's workstation, or certain environment variables for a project, such as show, shot, or sequence. Katana's AssetAPI supports such access permissions through a dedicated function, checkPermissions(), which is called for certain LiveGroup operations. When a function to check permissions in a specific context is called, the asset API plug-in queries the Asset Management System (AMS) to check general permissions or permissions for working with the asset with the given ID in the given context. Checking permissions for a given ID can be used to check whether the current user has sufficient permissions to edit the asset or whether the asset has already been checked out for editing.

The context dictionary contains information about the context from which to check permissions, with names of information fields as keys and values of information fields as values. For example, the following might be produced:

{"action": "edit", "shot": "ts520", "show": "srow",
    "username": "name", "workstation": "seat",}

See more, https://learn.foundry.com/katana/3.1/Content/tg/asset_management_system_plugin_api/livegroup_asset_functions.html

Args: assetId (str) : String to evaluate context (dict) : The context to be checked

Returns: (bool) Are permissions valid

No way to confirm or interact with the user, BOOLEAN No way to offer a reason to an artist why they cannot edit, BOOLEAN

When the function to run a custom asset plug-in command is called the asset API plug-in uses the AMS to check if the command succeeds or fails. The function signature to run the plug-in command is:

runAssetPluginCommand(assetID: string, command: string, commandArgs: map of string): bool

The command parameter receives the command to execute, for example:

• acquireLock

• releaseLock

The commandArgs dictionary contains information about the arguments with which to customize the execution of the given command, with names of command arguments as keys and values of command arguments as values. The commandArgs dictionary may be empty.