pub enum Permission {
All,
Select {
table: String,
},
Insert {
table: String,
},
Update {
table: String,
},
Delete {
table: String,
},
SelectColumns {
table: String,
columns: Vec<String>,
},
InsertColumns {
table: String,
columns: Vec<String>,
},
UpdateColumns {
table: String,
columns: Vec<String>,
},
Ddl,
Admin,
}Expand description
A permission granted to a role. Mirrors SQL GRANT / REVOKE.
Variants§
All
All permissions on all tables (GRANT ALL).
Select
SELECT on a specific table.
Insert
INSERT on a specific table.
Update
UPDATE on a specific table.
Delete
DELETE on a specific table.
SelectColumns
SELECT limited to named columns.
InsertColumns
INSERT limited to named columns.
UpdateColumns
UPDATE limited to named columns.
Ddl
DDL: CREATE / DROP / ALTER TABLE.
Admin
Admin: CREATE USER / GRANT / REVOKE / CREATE ROLE.
Implementations§
Source§impl Permission
impl Permission
Sourcepub fn satisfies(&self, required: &Permission) -> bool
pub fn satisfies(&self, required: &Permission) -> bool
Check whether this permission satisfies a required permission.
All satisfies every non-admin permission (DDL + all table-level
operations) but does not satisfy Admin — user/role management
is gated behind is_admin = true on the principal, not grantable via
Permission::All (spec §9 decision 2). Select { table: "*" } is
not wildcarded (it matches a table literally named *).
Trait Implementations§
Source§impl Clone for Permission
impl Clone for Permission
Source§fn clone(&self) -> Permission
fn clone(&self) -> Permission
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Permission
impl Debug for Permission
Source§impl<'de> Deserialize<'de> for Permission
impl<'de> Deserialize<'de> for Permission
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Permission, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Permission, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for Permission
impl Display for Permission
impl Eq for Permission
Source§impl PartialEq for Permission
impl PartialEq for Permission
Source§impl Serialize for Permission
impl Serialize for Permission
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Permission
Auto Trait Implementations§
impl Freeze for Permission
impl RefUnwindSafe for Permission
impl Send for Permission
impl Sync for Permission
impl Unpin for Permission
impl UnsafeUnpin for Permission
impl UnwindSafe for Permission
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more