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

Function revoke_workspace_grant

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

Revoke all grants for a subject on a workspace. Calls `DELETE /workspaces/{slug}/grants/{subject_type}/{subject_id}`. The server removes **all** relations (read, write, admin) for that subject in a single call — no need to specify which relation to revoke. # Errors Returns [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) if the caller is not a workspace admin, or a n

(
    client: &StorageClient,
    workspace_slug: &str,
    subject_type: GrantSubjectType,
    subject_id: Uuid,
)

Source from the content-addressed store, hash-verified

169/// if the caller is not a workspace admin, or a not-found error if the
170/// workspace doesn't exist.
171pub async fn revoke_workspace_grant(
172 client: &StorageClient,
173 workspace_slug: &str,
174 subject_type: GrantSubjectType,
175 subject_id: Uuid,
176) -> TeamsResult<()> {
177 let st = subject_type.to_string();
178 let path = format!("/workspaces/{workspace_slug}/grants/{st}/{subject_id}");
179 client
180 .delete(&path)
181 .await
182 .map_err(|e| map_remote_error(e, format!("workspace {workspace_slug}")))
183}
184
185// ---------------------------------------------------------------------------
186// Tests

Callers 1

runMethod · 0.85

Calls 2

map_remote_errorFunction · 0.85
deleteMethod · 0.45

Tested by

no test coverage detected