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

Function parse_permission

atomic-cli/src/commands/workspace/grant.rs:327–339  ·  view source on GitHub ↗

Parse the user-facing `--permission` flag into a `GrantRelation`. Workspace grants only accept `read`, `write`, and `admin` — `owner` is an org-level relation and is rejected here.

(s: &str)

Source from the content-addressed store, hash-verified

325/// Workspace grants only accept `read`, `write`, and `admin` — `owner` is an
326/// org-level relation and is rejected here.
327fn parse_permission(s: &str) -> CliResult<atomic_teams::GrantRelation> {
328 match s.to_lowercase().as_str() {
329 "read" => Ok(atomic_teams::GrantRelation::Read),
330 "write" => Ok(atomic_teams::GrantRelation::Write),
331 "admin" => Ok(atomic_teams::GrantRelation::Admin),
332 other => Err(CliError::InvalidArgument {
333 message: format!(
334 "Invalid permission '{other}'.\n \
335 Valid values: read, write, admin."
336 ),
337 }),
338 }
339}
340
341/// Build a human-readable label for the subject, used in success messages.
342fn subject_label(

Callers 3

runMethod · 0.85

Calls 1

as_strMethod · 0.45

Tested by 2