Add a permission grant to an organization. Binds `subject_id` (a user or team identity) 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 admin/owner.
(
client: &StorageClient,
org_slug: &str,
subject_type: GrantSubjectType,
subject_id: Option<Uuid>,
relation: GrantRelation,
)
| 48 | /// [`TeamsError::PermissionDenied`](crate::error::TeamsError::PermissionDenied) |
| 49 | /// if the caller is not an org admin/owner. |
| 50 | pub async fn add_org_grant( |
| 51 | client: &StorageClient, |
| 52 | org_slug: &str, |
| 53 | subject_type: GrantSubjectType, |
| 54 | subject_id: Option<Uuid>, |
| 55 | relation: GrantRelation, |
| 56 | ) -> TeamsResult<GrantInfo> { |
| 57 | let path = format!("/orgs/{org_slug}/grants"); |
| 58 | let body = AddGrantRequest { |
| 59 | subject_type, |
| 60 | subject_id, |
| 61 | relation, |
| 62 | }; |
| 63 | client |
| 64 | .post(&path, &body) |
| 65 | .await |
| 66 | .map_err(|e| map_remote_error(e, format!("org {org_slug}"))) |
| 67 | } |
| 68 | |
| 69 | /// Revoke a permission grant from an organization. |
| 70 | /// |
nothing calls this directly
no test coverage detected