pub async fn remove_permission_from_role(
pool: &Pool<MySql>,
permission_id: i64,
role_id: i64,
) -> Result<()>
Expand description
Removes a permission from a role.
This function deletes the association between a permission and a role, revoking the capability represented by the permission from users who have the specified role. This is used to adjust role capabilities in the RBAC system.
§Arguments
pool
- Database connection pool for executing the querypermission_id
- Unique identifier of the permission to removerole_id
- Unique identifier of the role from which to remove the permission
§Returns
Ok(())
- Successfully removed the permission from the roleErr(anyhow::Error)
- Failed to remove the permission
§Transaction Handling
This function uses a database transaction to ensure atomicity of the operation. If any part of the operation fails, the entire operation is rolled back.
§Note
After this operation, users who have the specified role will no longer have the capability granted by this permission, unless they have another role that includes it.