pub enum AccessControlStatement<X: Extension = NoExt> {
AlterRoleRename {
name: Ident,
new_name: Ident,
meta: Meta,
},
Grant {
privileges: Privileges,
object: GrantObject<X>,
grantees: ThinVec<Grantee>,
with_grant_option: bool,
granted_by: Option<RoleSpec>,
meta: Meta,
},
Revoke {
grant_option_for: bool,
privileges: Privileges,
object: GrantObject<X>,
grantees: ThinVec<Grantee>,
granted_by: Option<RoleSpec>,
behavior: Option<DropBehavior>,
meta: Meta,
},
GrantRole {
roles: ThinVec<Ident>,
grantees: ThinVec<Grantee>,
with_admin_option: bool,
granted_by: Option<RoleSpec>,
meta: Meta,
},
RevokeRole {
admin_option_for: bool,
roles: ThinVec<Ident>,
grantees: ThinVec<Grantee>,
granted_by: Option<RoleSpec>,
behavior: Option<DropBehavior>,
meta: Meta,
},
AccountGrantPrivilege {
privileges: Privileges,
object: PrivilegeLevelObject,
grantees: ThinVec<AccountName>,
with_grant_option: bool,
grant_as: Option<Box<GrantAs>>,
meta: Meta,
},
AccountGrantProxy {
proxy: AccountName,
grantees: ThinVec<AccountName>,
with_grant_option: bool,
meta: Meta,
},
AccountGrantRole {
roles: ThinVec<AccountName>,
grantees: ThinVec<AccountName>,
with_admin_option: bool,
meta: Meta,
},
AccountRevokePrivilege {
if_exists: bool,
privileges: Privileges,
object: PrivilegeLevelObject,
grantees: ThinVec<AccountName>,
ignore_unknown_user: bool,
meta: Meta,
},
AccountRevokeAll {
if_exists: bool,
privileges_keyword: bool,
grantees: ThinVec<AccountName>,
ignore_unknown_user: bool,
meta: Meta,
},
AccountRevokeProxy {
if_exists: bool,
proxy: AccountName,
grantees: ThinVec<AccountName>,
ignore_unknown_user: bool,
meta: Meta,
},
AccountRevokeRole {
if_exists: bool,
roles: ThinVec<AccountName>,
grantees: ThinVec<AccountName>,
ignore_unknown_user: bool,
meta: Meta,
},
}Expand description
An access-control (DCL) statement: GRANT or REVOKE.
Covers both branches of the SQL access-control grammar. A privilege grant
names privileges on a database object (Grant /
Revoke); a role-membership grant confers membership in one
role on another (GrantRole /
RevokeRole). The two share a leading comma list that only
ON (privilege grant) versus a bare TO/FROM (role grant) disambiguates —
exactly as PostgreSQL’s grammar reuses one privilege_list production for both,
which is why GRANT SELECT TO alice is a role grant whose granted “role” merely
happens to be spelled like a privilege keyword.
Variants§
AlterRoleRename
ALTER ROLE <name> RENAME TO <new_name>.
Fields
Grant
A GRANT <privileges> ON <object> TO <grantees> statement.
Fields
privileges: PrivilegesThe privileges granted/revoked; see Privileges.
object: GrantObject<X>The object the privileges apply to; see GrantObject.
Revoke
REVOKE [GRANT OPTION FOR] <privileges> ON <object> FROM <grantees> [GRANTED BY <grantor>] [CASCADE | RESTRICT].
behavior carries the trailing <drop behavior> that governs whether
dependent grants are revoked too; GRANT has no such clause, so it lives only
on the two REVOKE variants.
Fields
privileges: PrivilegesThe privileges granted/revoked; see Privileges.
object: GrantObject<X>The object the privileges apply to; see GrantObject.
behavior: Option<DropBehavior>Optional behavior for this syntax.
GrantRole
A GRANT <role> TO <grantees> role-membership statement.
Fields
RevokeRole
REVOKE [ADMIN OPTION FOR] <roles> FROM <grantees> [GRANTED BY <grantor>] [CASCADE | RESTRICT].
Fields
behavior: Option<DropBehavior>Optional behavior for this syntax.
AccountGrantPrivilege
GRANT <priv> ON [TABLE | FUNCTION | PROCEDURE] <priv_level> TO <user> [, …] [WITH GRANT OPTION] [AS <user> [WITH ROLE …]] — a MySQL object-privilege grant.
Fields
privileges: PrivilegesThe privileges granted; see Privileges.
object: PrivilegeLevelObjectThe priv_level object the privileges apply to; see PrivilegeLevelObject.
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountGrantProxy
GRANT PROXY ON <user> TO <user> [, …] [WITH GRANT OPTION] — a MySQL proxy grant.
Fields
proxy: AccountNameThe proxied account (ON <user>).
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountGrantRole
GRANT <role> [, …] TO <user> [, …] [WITH ADMIN OPTION] — a MySQL role-membership grant.
Fields
roles: ThinVec<AccountName>The granted roles, in source order (always non-empty).
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountRevokePrivilege
REVOKE [IF EXISTS] <priv> ON [TABLE | FUNCTION | PROCEDURE] <priv_level> FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL object-privilege revoke.
Fields
privileges: PrivilegesThe privileges revoked; see Privileges.
object: PrivilegeLevelObjectThe priv_level object; see PrivilegeLevelObject.
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountRevokeAll
REVOKE [IF EXISTS] ALL [PRIVILEGES], GRANT OPTION FROM <user> [, …] [IGNORE UNKNOWN USER]
— the MySQL “revoke everything” form, which takes no ON object.
Fields
privileges_keyword: boolWhether the optional PRIVILEGES noise word followed ALL (fidelity only; the
canonical render emits ALL PRIVILEGES, GRANT OPTION).
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountRevokeProxy
REVOKE [IF EXISTS] PROXY ON <user> FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL
proxy revoke.
Fields
proxy: AccountNameThe proxied account (ON <user>).
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
AccountRevokeRole
REVOKE [IF EXISTS] <role> [, …] FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL
role-membership revoke.
Fields
roles: ThinVec<AccountName>The revoked roles, in source order (always non-empty).
grantees: ThinVec<AccountName>The grantee accounts, in source order (always non-empty).
Trait Implementations§
Source§impl<X: Clone + Extension> Clone for AccessControlStatement<X>
impl<X: Clone + Extension> Clone for AccessControlStatement<X>
Source§fn clone(&self) -> AccessControlStatement<X>
fn clone(&self) -> AccessControlStatement<X>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, X> Deserialize<'de> for AccessControlStatement<X>where
X: Deserialize<'de> + Extension,
impl<'de, X> Deserialize<'de> for AccessControlStatement<X>where
X: Deserialize<'de> + Extension,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<X: Eq + Extension> Eq for AccessControlStatement<X>
Source§impl<X: Extension + Render> Render for AccessControlStatement<X>
impl<X: Extension + Render> Render for AccessControlStatement<X>
Source§fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result
Source§fn operand_binding_power(&self) -> Option<BindingPower>
fn operand_binding_power(&self) -> Option<BindingPower>
None (the default) for a self-delimiting node — an atom, call, or
constructor — that never needs parentheses. Read moreSource§impl<X> Serialize for AccessControlStatement<X>
impl<X> Serialize for AccessControlStatement<X>
Source§impl<X: Extension> Spanned for AccessControlStatement<X>
impl<X: Extension> Spanned for AccessControlStatement<X>
impl<X: PartialEq + Extension> StructuralPartialEq for AccessControlStatement<X>
Auto Trait Implementations§
impl<X> Freeze for AccessControlStatement<X>
impl<X> RefUnwindSafe for AccessControlStatement<X>where
X: RefUnwindSafe,
impl<X> Send for AccessControlStatement<X>where
X: Send,
impl<X> Sync for AccessControlStatement<X>where
X: Sync,
impl<X> Unpin for AccessControlStatement<X>where
X: Unpin,
impl<X> UnsafeUnpin for AccessControlStatement<X>
impl<X> UnwindSafe for AccessControlStatement<X>where
X: UnwindSafe,
Blanket Implementations§
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
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<T> DynAstExt for T
impl<T> DynAstExt for T
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&dyn Any for downcasting a node back to its concrete type.Source§fn dyn_clone(&self) -> Box<dyn DynAstExt>
fn dyn_clone(&self) -> Box<dyn DynAstExt>
Clone (whose
Self-returning signature cannot go through a vtable).Source§fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
fn dyn_eq(&self, other: &dyn DynAstExt) -> bool
PartialEq (whose &Self argument cannot go through a vtable). Equal
iff other holds the same concrete type and that type deems the values
equal; differently-typed nodes are never equal.