MCPcopy Create free account
hub / github.com/dfinity/orbit / set_initial_user_groups

Function set_initial_user_groups

core/station/impl/src/services/system.rs:787–814  ·  view source on GitHub ↗
(
        user_groups: &[InitUserGroupInput],
    )

Source from the content-addressed store, hash-verified

785 }
786
787 pub async fn set_initial_user_groups(
788 user_groups: &[InitUserGroupInput],
789 ) -> Result<(), ApiError> {
790 let add_user_groups = user_groups
791 .iter()
792 .map(|user_group| {
793 let input = AddUserGroupOperationInput {
794 name: user_group.name.clone(),
795 };
796
797 let user_group_id = user_group
798 .id
799 .as_ref()
800 .map(|id| HelperMapper::to_uuid(id.clone()).map(|uuid| *uuid.as_bytes()))
801 .transpose();
802
803 user_group_id.map(|user_group_id| (input, user_group_id))
804 })
805 .collect::<Result<Vec<_>, _>>()?;
806
807 for (new_user_group, with_user_group_id) in add_user_groups {
808 USER_GROUP_SERVICE
809 .create_with_id(new_user_group, with_user_group_id)
810 .await?;
811 }
812
813 Ok(())
814 }
815
816 pub fn set_initial_named_rules(named_rules: &[InitNamedRuleInput]) -> Result<(), ApiError> {
817 let mut add_named_rules = named_rules

Callers 2

init_canisterMethod · 0.85
test_duplicate_uuidsFunction · 0.85

Calls 3

mapMethod · 0.80
iterMethod · 0.80
create_with_idMethod · 0.45

Tested by 1

test_duplicate_uuidsFunction · 0.68