MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / build_scope

Method build_scope

atomic-cli/src/commands/identity/agent/create.rs:234–271  ·  view source on GitHub ↗

Assemble the scope from the flags.

(&self, server_url: Option<&str>)

Source from the content-addressed store, hash-verified

232
233 /// Assemble the scope from the flags.
234 fn build_scope(&self, server_url: Option<&str>) -> CliResult<DelegationScope> {
235 let mut builder = DelegationScope::builder().permissions(parse_permissions(&self.can)?);
236
237 // Bind to the server unless this is a local-only certificate. A
238 // certificate with no server is valid everywhere, which is exactly what
239 // we do not want once one is in play.
240 if let Some(url) = server_url {
241 builder = builder.server(url);
242 }
243 for pattern in self
244 .projects
245 .as_deref()
246 .map(parse_patterns)
247 .unwrap_or_default()
248 {
249 builder = builder.project(pattern);
250 }
251 for pattern in self
252 .workspaces
253 .as_deref()
254 .map(parse_patterns)
255 .unwrap_or_default()
256 {
257 builder = builder.workspace(pattern);
258 }
259 for pattern in self
260 .views
261 .as_deref()
262 .map(parse_patterns)
263 .unwrap_or_default()
264 {
265 builder = builder.view(pattern);
266 }
267 if let Some(max) = self.max_changes {
268 builder = builder.max_changes(max);
269 }
270 Ok(builder.build())
271 }
272
273 /// Enroll the agent key and certificate with the server.
274 ///

Callers 1

executeMethod · 0.45

Calls 8

parse_permissionsFunction · 0.85
serverMethod · 0.80
projectMethod · 0.80
workspaceMethod · 0.80
max_changesMethod · 0.80
permissionsMethod · 0.45
viewMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected