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`] if the grant already exists, or [`TeamsError::PermissionDenied`] if the caller is not an org owner. Returns [`TeamsError::InvalidInput`] when `subject_type` is [`GrantSubjectType::Everyone`].
(
client: &StorageClient,
org_slug: &str,
subject_type: GrantSubjectType,
subject_id: Uuid,
relation: GrantRelation,
)
| 76 | /// [`TeamsError::InvalidInput`] when |
| 77 | /// `subject_type` is [`GrantSubjectType::Everyone`]. |
| 78 | pub async fn add_org_grant( |
| 79 | client: &StorageClient, |
| 80 | org_slug: &str, |
| 81 | subject_type: GrantSubjectType, |
| 82 | subject_id: Uuid, |
| 83 | relation: GrantRelation, |
| 84 | ) -> TeamsResult<GrantInfo> { |
| 85 | validate_mutation_subject(subject_type)?; |
| 86 | let path = format!("/orgs/{org_slug}/grants"); |
| 87 | let body = AddGrantRequest { |
| 88 | subject_type, |
| 89 | subject_id, |
| 90 | relation, |
| 91 | }; |
| 92 | client |
| 93 | .post(&path, &body) |
| 94 | .await |
| 95 | .map_err(|e| map_remote_error(e, format!("org {org_slug}"))) |
| 96 | } |
| 97 | |
| 98 | /// Revoke all grants for a subject on an organization. |
| 99 | /// |
nothing calls this directly
no test coverage detected