1.2.1 Assign role

Assign role Step-by-Step test guide

Assigns a role to a user. The caller must be a signed account that is already registered in AdminAccounts. The function checks the role is not already assigned, inserts the (user, role) entry into AccountRoles storage, emits RoleAssigned { user, role }, and returns Ok(()).

  1. Developer → Extrinsics.

  1. Account: select an admin account.

  2. Extrinsic: choose xcavateWhitelist.

  3. Call: assign_role.

  1. Parameters:

  • user: account to assign role to (e.g., Charlie)

  • role: select role enum (e.g., RegionalOperator).

  1. Submit transaction.

  1. Sign and submit.

  1. Transaction approved with green tick on the top right hand corner.

✅ Check result:

  • Developer → (1) Chain State → (2) xcavateWhitelist → accountRoles → (3) accountId32 (Charlie) → (4) Click + Query

  • Should return (5) RegionalOperator - Compliant.

Last updated