brane_reg::data

Function assert_asset_permission

Source
pub async fn assert_asset_permission(
    worker_cfg: &WorkerConfig,
    use_case: &str,
    workflow: &Workflow,
    client_name: &str,
    data_name: DataName,
    call: Option<ProgramCounter>,
) -> Result<Option<Vec<String>>, AuthorizeError>
Expand description

Runs the do-be-done data transfer by the checker to assess if we’re allowed to do it.

§Arguments

  • worker_cfg: The configuration for this node’s environment. For us, contains if and where we should proxy the request through and where we may find the checker.
  • use_case: A string denoting which use-case (registry) we’re using.
  • workflow: The workflow to check.
  • client_name: The name as which the client is authenticated. Will be matched with the indicated task.
  • data_name: The name of the dataset they are trying to access.
  • call: A program counter that identifies for which call in the workflow we’re doing this request (if any).

§Returns

Whether permission is given or not. It is given as an Option that, when None, means permission is given; else, it carries a list of reasons why not (if shared by the checker).

§Errors

This function errors if we failed to ask the checker. Clearly, that should be treated as permission denied.