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

Method build_scope

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

Assemble the scope from the flags.

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

Source from the content-addressed store, hash-verified

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

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