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

Function revoke_workspace_grant

atomic-teams/src/grant.rs:195–208  ·  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`] if the caller is not a workspace admin, or a not-found error if the workspace doesn't exis

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

Source from the content-addressed store, hash-verified

193/// [`TeamsError::InvalidInput`] when
194/// `subject_type` is [`GrantSubjectType::Everyone`].
195pub async fn revoke_workspace_grant(
196 client: &StorageClient,
197 workspace_slug: &str,
198 subject_type: GrantSubjectType,
199 subject_id: Uuid,
200) -> TeamsResult<()> {
201 validate_mutation_subject(subject_type)?;
202 let st = subject_type.to_string();
203 let path = format!("/workspaces/{workspace_slug}/grants/{st}/{subject_id}");
204 client
205 .delete(&path)
206 .await
207 .map_err(|e| map_remote_error(e, format!("workspace {workspace_slug}")))
208}
209
210// ---------------------------------------------------------------------------
211// Tests

Callers 1

runMethod · 0.85

Calls 3

map_remote_errorFunction · 0.85
deleteMethod · 0.45

Tested by

no test coverage detected