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

Method list

core/station/impl/src/services/user_group.rs:67–92  ·  view source on GitHub ↗
(
        &self,
        input: ListUserGroupsInput,
        ctx: Option<&CallContext>,
    )

Source from the content-addressed store, hash-verified

65 }
66
67 pub async fn list(
68 &self,
69 input: ListUserGroupsInput,
70 ctx: Option<&CallContext>,
71 ) -> ServiceResult<PaginatedData<UserGroup>> {
72 let mut user_groups = self.user_group_repository.find_where(UseGroupWhereClause {
73 search_term: input.search_term.to_owned(),
74 });
75
76 // filter out user groups that the caller does not have access to read
77 if let Some(ctx) = ctx {
78 retain_accessible_resources(ctx, &mut user_groups, |user_group| {
79 Resource::UserGroup(ResourceAction::Read(ResourceId::Id(user_group.id)))
80 });
81 }
82
83 let result = paginated_items(PaginatedItemsArgs {
84 offset: input.paginate.to_owned().and_then(|p| p.offset),
85 limit: input.paginate.and_then(|p| p.limit),
86 default_limit: Some(Self::DEFAULT_USER_GROUP_LIST_LIMIT),
87 max_limit: Some(Self::MAX_USER_GROUP_LIST_LIMIT),
88 items: &user_groups,
89 })?;
90
91 Ok(result)
92 }
93
94 pub async fn create(&self, input: AddUserGroupOperationInput) -> ServiceResult<UserGroup> {
95 self.create_with_id(input, None).await

Callers

nothing calls this directly

Calls 4

UserGroupClass · 0.50
paginated_itemsFunction · 0.50
find_whereMethod · 0.45

Tested by

no test coverage detected