junobuild_satellite

Function get_admin_controllers

Source
pub fn get_admin_controllers() -> Controllers
Expand description

Retrieve the current admin controllers for a Satellite.

This function filters the list of controllers to include only those with the Admin scope.

§Returns

  • Controllers: A HashMap where:
    • The key is a ControllerId (type alias for Principal).
    • The value is a Controller struct that includes:
      • metadata: Additional metadata about the controller.
      • created_at: The timestamp when the controller was created.
      • updated_at: The timestamp when the controller was last updated.
      • expires_at: An optional timestamp indicating when the controller expires.
      • scope: Always ControllerScope::Admin for admin controllers.

§Example

let admin_controllers = get_admin_controllers();
for (controller_id, controller) in admin_controllers.iter() {
    println!("Admin Controller ID: {}", controller_id);
    println!("Created at: {}", controller.created_at);
}

This function is useful for auditing or managing permissions for admin-level access.