Add a permission grant to an organization. Binds `subject_id` (a user or team UUID) with the given `relation` on the organization identified by `org_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 org owner.
(
client: &StorageClient,
org_slug: &str,
subject_type: GrantSubjectType,
subject_id: Uuid,
relation: GrantRelation,
)
| 61 | /// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) |
| 62 | /// if the caller is not an org owner. |
| 63 | pub async fn add_org_grant( |
| 64 | client: &StorageClient, |
| 65 | org_slug: &str, |
| 66 | subject_type: GrantSubjectType, |
| 67 | subject_id: Uuid, |
| 68 | relation: GrantRelation, |
| 69 | ) -> TeamsResult<GrantInfo> { |
| 70 | let path = format!("/orgs/{org_slug}/grants"); |
| 71 | let body = AddGrantRequest { |
| 72 | subject_type, |
| 73 | subject_id, |
| 74 | relation, |
| 75 | }; |
| 76 | client |
| 77 | .post(&path, &body) |
| 78 | .await |
| 79 | .map_err(|e| map_remote_error(e, format!("org {org_slug}"))) |
| 80 | } |
| 81 | |
| 82 | /// Revoke all grants for a subject on an organization. |
| 83 | /// |
nothing calls this directly
no test coverage detected