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

Function add_workspace_grant

atomic-teams/src/grant.rs:131–148  ·  view source on GitHub ↗

Add a permission grant to a workspace. Binds `subject_id` (a user or team identity) with the given `relation` on the workspace identified by `workspace_slug`. # Errors Returns [`TeamsError::AlreadyExists`](crate::error::TeamsError::AlreadyExists) if the grant already exists, or [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) if the caller is not an admin/owner of th

(
    client: &StorageClient,
    workspace_slug: &str,
    subject_type: GrantSubjectType,
    subject_id: Option<Uuid>,
    relation: GrantRelation,
)

Source from the content-addressed store, hash-verified

129/// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied)
130/// if the caller is not an admin/owner of the workspace's parent organization.
131pub async fn add_workspace_grant(
132 client: &StorageClient,
133 workspace_slug: &str,
134 subject_type: GrantSubjectType,
135 subject_id: Option<Uuid>,
136 relation: GrantRelation,
137) -> TeamsResult<GrantInfo> {
138 let path = format!("/workspaces/{workspace_slug}/grants");
139 let body = AddGrantRequest {
140 subject_type,
141 subject_id,
142 relation,
143 };
144 client
145 .post(&path, &body)
146 .await
147 .map_err(|e| map_remote_error(e, format!("workspace {workspace_slug}")))
148}
149
150/// Revoke a permission grant from a workspace.
151///

Callers

nothing calls this directly

Calls 2

map_remote_errorFunction · 0.85
postMethod · 0.80

Tested by

no test coverage detected