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

Method list

core/station/impl/src/services/asset.rs:153–178  ·  view source on GitHub ↗
(
        &self,
        input: ListAssetsInput,
        ctx: Option<&CallContext>,
    )

Source from the content-addressed store, hash-verified

151 }
152
153 pub fn list(
154 &self,
155 input: ListAssetsInput,
156 ctx: Option<&CallContext>,
157 ) -> ServiceResult<PaginatedData<Asset>> {
158 let mut assets = self.asset_repository.list();
159
160 if let Some(ctx) = ctx {
161 // filter out assets that the caller does not have access to read
162 retain_accessible_resources(ctx, &mut assets, |asset| {
163 Resource::Asset(crate::models::resource::ResourceAction::Read(
164 crate::models::resource::ResourceId::Id(asset.id),
165 ))
166 });
167 }
168
169 let result = paginated_items(PaginatedItemsArgs {
170 offset: input.paginate.to_owned().and_then(|p| p.offset),
171 limit: input.paginate.and_then(|p| p.limit),
172 default_limit: Some(Self::DEFAULT_LIST_ASSETS_LIMIT),
173 max_limit: Some(Self::MAX_LIST_ASSETS_LIMIT),
174 items: &assets,
175 })?;
176
177 Ok(result)
178 }
179}
180
181#[cfg(test)]

Callers 15

list_assetsMethod · 0.45
list_user_groupsMethod · 0.45
capabilitiesMethod · 0.45
list_named_rulesMethod · 0.45
is_external_canisterMethod · 0.45
recompute_metricsFunction · 0.45
evaluateMethod · 0.45
removeMethod · 0.45
test_asset_creationFunction · 0.45
test_asset_editFunction · 0.45
test_unused_asset_removeFunction · 0.45

Calls 3

AssetClass · 0.50
paginated_itemsFunction · 0.50

Tested by 6

test_asset_creationFunction · 0.36
test_asset_editFunction · 0.36
test_unused_asset_removeFunction · 0.36
test_asset_listFunction · 0.36