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,
)
| 129 | /// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) |
| 130 | /// if the caller is not an admin/owner of the workspace's parent organization. |
| 131 | pub 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 | /// |
nothing calls this directly
no test coverage detected