pub struct PermissionsResource<'a> { /* private fields */ }Expand description
client.permissions()
Implementations§
Source§impl<'a> PermissionsResource<'a>
impl<'a> PermissionsResource<'a>
pub fn global(&self) -> PermissionsGlobalResource<'a>
pub fn internal(&self) -> PermissionsInternalResource<'a>
pub fn origins(&self) -> PermissionsOriginsResource<'a>
Sourcepub fn bulk(&self, body: &PostPermissionsBulkBody) -> Result<()>
pub fn bulk(&self, body: &PostPermissionsBulkBody) -> Result<()>
Apply multiple raw permission changes atomically
POST /permissions/bulk
Applies raw permission changes atomically, including changes for different source owners. All entries are validated and authorized against the state before any writes. The authorization and locked-permission rules of the corresponding single-assignment operations apply to each entry. Any failure leaves all assignments unchanged. Duplicate owner/authId/inheritance keys are rejected. Permission caches are invalidated after commit. save is additive and an empty dataId list writes a null-data row; replace replaces the complete selection and an empty list removes it; delete removes exact selections or the whole assignment when no selections are specified. Validation errors identify fields such as changes.2.authId.
§Example
let body = models::PostPermissionsBulkBody {
changes: vec![models::PermissionBulkChange {
domain_id: 7,
domain_type: "group_type_role".into(),
..Default::default()
}],
..Default::default()
};
client.permissions().bulk(&body)?;Sourcepub fn delete(
&self,
domain_type: impl Display,
domain_id: impl Display,
body: &PermissionDelete,
) -> Result<()>
pub fn delete( &self, domain_type: impl Display, domain_id: impl Display, body: &PermissionDelete, ) -> Result<()>
Delete a raw permission assignment
DELETE /permissions/{domainType}/{domainId}
Deletes stored assignment rows for the owner in the path, authId and inheritance mode. Requires administer persons in churchcore, or specifically a group_role assignment for authId 10130/10131 plus churchdb +admin posts in that role’s actual group. Locked selections may only be changed by an authorized person. Omitting dataId, null or [] removes all selection rows in the chosen inheritance mode; a nonempty list deletes exact selections. -1 does not expand to concrete rows. type/reason do not filter deletion, so both grants and revocations matching the key are removed. Other assignment sources remain effective. Missing rows are harmless. The generic admin path does not verify the owner or permission definition exists, except obsolete authId=10127 returns 410. status/person disallow authId>=10000 and inheritance. The current deletion path does not explicitly invalidate the permission cache.
§Example
let body = models::PermissionDelete {
auth_id: 10130,
..Default::default()
};
client.permissions().delete("group_role", 1, &body)?;Sourcepub fn get_definitions(&self) -> Result<GetPermissionsDefinitionsData>
pub fn get_definitions(&self) -> Result<GetPermissionsDefinitionsData>
List permission definitions
GET /permissions/definitions
Returns registered permission definitions grouped by module. Requires administer persons in churchcore. global selects keys without a leading +; internal selects group-internal keys beginning with +; all includes both. Definitions explain assignable keys, not the current user’s effective permissions. Modules follow application ordering and modules without matching definitions are omitted. For data-field permissions, selections starts with dataId=-1 for unrestricted access to current and future values. Other selections come from the configured catalog without per-object visibility filtering. name and description currently contain the same text, and assignmentDomains is a fixed generic list. The response is not paginated.
Use Self::get_definitions_with to pass query parameters.
§Example
let definition = client.permissions().get_definitions()?;
println!("{:?}", definition);Sourcepub fn get_definitions_with(
&self,
query: &GetPermissionsDefinitionsQuery,
) -> Result<GetPermissionsDefinitionsData>
pub fn get_definitions_with( &self, query: &GetPermissionsDefinitionsQuery, ) -> Result<GetPermissionsDefinitionsData>
List permission definitions
Like Self::get_definitions, with query parameters.
GET /permissions/definitions
Returns registered permission definitions grouped by module. Requires administer persons in churchcore. global selects keys without a leading +; internal selects group-internal keys beginning with +; all includes both. Definitions explain assignable keys, not the current user’s effective permissions. Modules follow application ordering and modules without matching definitions are omitted. For data-field permissions, selections starts with dataId=-1 for unrestricted access to current and future values. Other selections come from the configured catalog without per-object visibility filtering. name and description currently contain the same text, and assignmentDomains is a fixed generic list. The response is not paginated.
Sourcepub fn get_locked(&self) -> Result<LockedPermissionState>
pub fn get_locked(&self) -> Result<LockedPermissionState>
List locked permissions
GET /permissions/locked
Lists all stored permission locks, ordered by permission ID and selection ID. Requires administer persons in churchcore, but the caller need not be an authorized contact person. A lock restricts assigning or removing the selected permission across assignment domains; it does not revoke existing grants or disable their use. Only authorized persons may change locked assignments. Locks can refer to global or group-internal permission keys. The response includes whether the current person is on the installation’s authorized-person list. Stored locks are returned without filtering inactive/obsolete definitions, and the result is not paginated.
§Example
let locked = client.permissions().get_locked()?;
println!("{}", locked.is_current_user_authorized_person);Sourcepub fn list(
&self,
domain_type: impl Display,
domain_id: impl Display,
) -> Result<Vec<Permission>>
pub fn list( &self, domain_type: impl Display, domain_id: impl Display, ) -> Result<Vec<Permission>>
List permissions for a domain object
GET /permissions/{domainType}/{domainId}
Lists raw assignments for one source object. status/person address a person-status or person ID; group_type_role/group_role address their role IDs. group_type collects role-template assignments of that group type; group combines concrete group-role and associated group-type-role assignments, preserving each row’s actual owner domain and ID. Only permission IDs in the currently loaded active definition table are returned. No pagination, explicit ordering, or object-existence check is applied; an unknown owner normally returns an empty list. Intended access is administer persons in churchcore, with a restricted post-administration fallback. The current fallback passes an incomplete key to a boolean permission check and ignores its result; enabled assertions may fail the request. Otherwise direct-domain views restrict authIds to 10130/10131, but combined group/group_type views omit that restriction. This defect must not be treated as an authorization guarantee.
§Example
for permission in client.permissions().list("person", 1)? {
println!("{}", permission.auth_id);
}Sourcepub fn list_assignment_targets(&self) -> Result<Vec<PermissionAssignmentTarget>>
pub fn list_assignment_targets(&self) -> Result<Vec<PermissionAssignmentTarget>>
Search selectable permission assignment targets
GET /permissions/assignment-targets
Requires “administer persons” in churchcore. Lists statuses, group-type role templates, concrete group roles, and persons, independently of existing assignments. Archived and inactive targets are included. Without query, lists all targets. Every whitespace-separated search word must match part of the name or its group/group-type context, irrespective of word order. SQL wildcard characters are treated literally. Results use one global pagination, ordered by category (status, group_type_role, group_role, person), name, context name, and domainId. Later categories can therefore start on later pages. Selection does not authorize assigning a specific permission; write endpoints check that separately. Group and role context is returned only for role targets.
Use Self::list_assignment_targets_with to pass query parameters.
§Example
for assignment_target in client.permissions().list_assignment_targets()? {
println!("{}", assignment_target.domain_id);
}Sourcepub fn list_assignment_targets_with(
&self,
query: &GetPermissionsAssignmentTargetsQuery,
) -> Result<Vec<PermissionAssignmentTarget>>
pub fn list_assignment_targets_with( &self, query: &GetPermissionsAssignmentTargetsQuery, ) -> Result<Vec<PermissionAssignmentTarget>>
Search selectable permission assignment targets
Like Self::list_assignment_targets, with query parameters.
GET /permissions/assignment-targets
Requires “administer persons” in churchcore. Lists statuses, group-type role templates, concrete group roles, and persons, independently of existing assignments. Archived and inactive targets are included. Without query, lists all targets. Every whitespace-separated search word must match part of the name or its group/group-type context, irrespective of word order. SQL wildcard characters are treated literally. Results use one global pagination, ordered by category (status, group_type_role, group_role, person), name, context name, and domainId. Later categories can therefore start on later pages. Selection does not authorize assigning a specific permission; write endpoints check that separately. Group and role context is returned only for role targets.
Sourcepub fn list_assignment_targets_iter(
&self,
query: &GetPermissionsAssignmentTargetsQuery,
) -> Items<PermissionAssignmentTarget> ⓘ
pub fn list_assignment_targets_iter( &self, query: &GetPermissionsAssignmentTargetsQuery, ) -> Items<PermissionAssignmentTarget> ⓘ
Search selectable permission assignment targets
Like Self::list_assignment_targets_with, but lazy: each page is fetched only when the iteration reaches it.
Breaking off early saves the remaining requests.
Sourcepub fn list_for_type(
&self,
domain_type: impl Display,
) -> Result<Vec<Permission>>
pub fn list_for_type( &self, domain_type: impl Display, ) -> Result<Vec<Permission>>
List permissions for a domain type
GET /permissions/{domainType}
Lists stored permission assignments in one source domain; these are raw grants/revocations, not effective permissions. Optional domainId filters a specific assignment owner. group_type and group are combined read views and require domainId even on this short route; omitting it returns a validation error. group_type lists its role-template assignments, while group combines concrete group-role and corresponding group-type-role assignments. Returned rows retain their actual role domain/ID. Only authIds present in the currently loaded active definition table are included. No pagination, object-existence check or explicit ordering is applied. Intended access is administer persons in churchcore, with a limited post-administration fallback. That fallback currently uses an incomplete permission key and ignores its boolean result; with assertions enabled it may fail, and otherwise combined views are not restricted to the two post-creation authIds. Do not rely on this behavior as an authorization guarantee.
Use Self::list_for_type_with to pass query parameters.
§Example
for for_type in client.permissions().list_for_type("person")? {
println!("{}", for_type.auth_id);
}Sourcepub fn list_for_type_with(
&self,
domain_type: impl Display,
query: &GetPermissionsPermissionDomainTypeQuery,
) -> Result<Vec<Permission>>
pub fn list_for_type_with( &self, domain_type: impl Display, query: &GetPermissionsPermissionDomainTypeQuery, ) -> Result<Vec<Permission>>
List permissions for a domain type
Like Self::list_for_type, with query parameters.
GET /permissions/{domainType}
Lists stored permission assignments in one source domain; these are raw grants/revocations, not effective permissions. Optional domainId filters a specific assignment owner. group_type and group are combined read views and require domainId even on this short route; omitting it returns a validation error. group_type lists its role-template assignments, while group combines concrete group-role and corresponding group-type-role assignments. Returned rows retain their actual role domain/ID. Only authIds present in the currently loaded active definition table are included. No pagination, object-existence check or explicit ordering is applied. Intended access is administer persons in churchcore, with a limited post-administration fallback. That fallback currently uses an incomplete permission key and ignores its boolean result; with assertions enabled it may fail, and otherwise combined views are not restricted to the two post-creation authIds. Do not rely on this behavior as an authorization guarantee.
Sourcepub fn update(
&self,
domain_type: impl Display,
domain_id: impl Display,
body: &PermissionUpdate,
) -> Result<()>
pub fn update( &self, domain_type: impl Display, domain_id: impl Display, body: &PermissionUpdate, ) -> Result<()>
Save a raw permission assignment
PUT /permissions/{domainType}/{domainId}
Adds or updates raw permission assignments for the source owner in the path. Requires administer persons in churchcore, or a group_role assignment for authId 10130/10131 and churchdb +admin posts in that role’s actual group. Locked selections additionally require an authorized person. type defaults to grant; revoke is only supported for group_role. Only role domains allow inheritance and internal authIds; status/person require authId<10000. Obsolete authId=10127 returns 410. dataId is an additive list: other existing selections remain. Omission, null or [] writes a null-data row, not an unrestricted grant; use [-1] for unrestricted selections. Currently any existing -1 row for the key/inheritance mode causes a nonempty-list update to be silently ignored, including reason/type changes. The general admin path does not validate owner, permission-definition or selection existence. Success returns 204 without a representation; it does not necessarily mean a row changed.
§Example
let body = models::PermissionUpdate {
auth_id: 10130,
..Default::default()
};
client.permissions().update("group_role", 1, &body)?;Sourcepub fn update_locked(
&self,
body: &LockedPermissionUpdate,
) -> Result<PutPermissionsLockedData>
pub fn update_locked( &self, body: &LockedPermissionUpdate, ) -> Result<PutPermissionsLockedData>
Update locked permissions
PUT /permissions/locked
Adds and removes permission locks in one transaction. Requires both administer persons in churchcore and membership in the installation’s authorized-person list. Both add and remove are required; empty lists are allowed. Duplicates are collapsed, existing additions and missing removals are harmless, but the same normalized pair in both lists returns 400. This is a delta update, not full replacement. Each authId must exist in the definition table loaded for the request. Boolean permissions require omitted/null dataId; selectable permissions require a non-null dataId. Concrete selection existence and range are currently not checked. Locks may concern internal or global permissions; -1 locks all values. Existing grants are not revoked. Returns the complete resulting list under data.permissions, without the authorization flag returned by GET.
§Example
let body = models::LockedPermissionUpdate {
add: vec![models::LockedPermissionChange {
auth_id: 1,
..Default::default()
}],
remove: vec![models::LockedPermissionChange {
auth_id: 1,
..Default::default()
}],
..Default::default()
};
let result = client.permissions().update_locked(&body)?;
println!("{:?}", result);Sourcepub fn update_replace(
&self,
domain_type: impl Display,
domain_id: impl Display,
body: &PermissionReplace,
) -> Result<()>
pub fn update_replace( &self, domain_type: impl Display, domain_id: impl Display, body: &PermissionReplace, ) -> Result<()>
Replace a raw permission assignment
PUT /permissions/{domainType}/{domainId}/replace
Atomically replaces all raw assignment rows for the source owner, authId and inheritance mode. A nonempty dataId list becomes the complete selection; an empty list removes the assignment. The authorization, domain and locked-permission restrictions are the same as for updating and deleting the corresponding raw assignment.
§Example
let body = models::PermissionReplace {
auth_id: 10130,
data_id: vec![1, 2],
..Default::default()
};
client.permissions().update_replace("group_role", 1, &body)?;