Skip to main content

AccessControlStatement

Enum AccessControlStatement 

Source
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

§name: Ident

Existing role name.

§new_name: Ident

New role name.

§meta: Meta

Source location and node identity.

§

Grant

A GRANT <privileges> ON <object> TO <grantees> statement.

Fields

§privileges: Privileges

The privileges granted/revoked; see Privileges.

§object: GrantObject<X>

The object the privileges apply to; see GrantObject.

§grantees: ThinVec<Grantee>

grantees in source order.

§with_grant_option: bool

Whether the with grant option form was present in the source.

§granted_by: Option<RoleSpec>

Optional granted by for this syntax.

§meta: Meta

Source location and node identity.

§

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

§grant_option_for: bool

Whether the grant option for form was present in the source.

§privileges: Privileges

The privileges granted/revoked; see Privileges.

§object: GrantObject<X>

The object the privileges apply to; see GrantObject.

§grantees: ThinVec<Grantee>

grantees in source order.

§granted_by: Option<RoleSpec>

Optional granted by for this syntax.

§behavior: Option<DropBehavior>

Optional behavior for this syntax.

§meta: Meta

Source location and node identity.

§

GrantRole

A GRANT <role> TO <grantees> role-membership statement.

Fields

§roles: ThinVec<Ident>

roles in source order.

§grantees: ThinVec<Grantee>

grantees in source order.

§with_admin_option: bool

Whether the with admin option form was present in the source.

§granted_by: Option<RoleSpec>

Optional granted by for this syntax.

§meta: Meta

Source location and node identity.

§

RevokeRole

REVOKE [ADMIN OPTION FOR] <roles> FROM <grantees> [GRANTED BY <grantor>] [CASCADE | RESTRICT].

Fields

§admin_option_for: bool

Whether the admin option for form was present in the source.

§roles: ThinVec<Ident>

roles in source order.

§grantees: ThinVec<Grantee>

grantees in source order.

§granted_by: Option<RoleSpec>

Optional granted by for this syntax.

§behavior: Option<DropBehavior>

Optional behavior for this syntax.

§meta: Meta

Source location and node identity.

§

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: Privileges

The privileges granted; see Privileges.

§object: PrivilegeLevelObject

The priv_level object the privileges apply to; see PrivilegeLevelObject.

§grantees: ThinVec<AccountName>

The grantee accounts, in source order (always non-empty).

§with_grant_option: bool

Whether the WITH GRANT OPTION trailer was written.

§grant_as: Option<Box<GrantAs>>

The AS <user> [WITH ROLE …] grantor context; None when omitted. Boxed — it is a rare, wide clause (ADR-0007), kept off the common privilege-grant path.

§meta: Meta

Source location and node identity.

§

AccountGrantProxy

GRANT PROXY ON <user> TO <user> [, …] [WITH GRANT OPTION] — a MySQL proxy grant.

Fields

§proxy: AccountName

The proxied account (ON <user>).

§grantees: ThinVec<AccountName>

The grantee accounts, in source order (always non-empty).

§with_grant_option: bool

Whether the WITH GRANT OPTION trailer was written.

§meta: Meta

Source location and node identity.

§

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).

§with_admin_option: bool

Whether the WITH ADMIN OPTION trailer was written.

§meta: Meta

Source location and node identity.

§

AccountRevokePrivilege

REVOKE [IF EXISTS] <priv> ON [TABLE | FUNCTION | PROCEDURE] <priv_level> FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL object-privilege revoke.

Fields

§if_exists: bool

Whether the IF EXISTS guard was written.

§privileges: Privileges

The privileges revoked; see Privileges.

§object: PrivilegeLevelObject

The priv_level object; see PrivilegeLevelObject.

§grantees: ThinVec<AccountName>

The grantee accounts, in source order (always non-empty).

§ignore_unknown_user: bool

Whether the IGNORE UNKNOWN USER trailer was written.

§meta: Meta

Source location and node identity.

§

AccountRevokeAll

REVOKE [IF EXISTS] ALL [PRIVILEGES], GRANT OPTION FROM <user> [, …] [IGNORE UNKNOWN USER] — the MySQL “revoke everything” form, which takes no ON object.

Fields

§if_exists: bool

Whether the IF EXISTS guard was written.

§privileges_keyword: bool

Whether 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).

§ignore_unknown_user: bool

Whether the IGNORE UNKNOWN USER trailer was written.

§meta: Meta

Source location and node identity.

§

AccountRevokeProxy

REVOKE [IF EXISTS] PROXY ON <user> FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL proxy revoke.

Fields

§if_exists: bool

Whether the IF EXISTS guard was written.

§proxy: AccountName

The proxied account (ON <user>).

§grantees: ThinVec<AccountName>

The grantee accounts, in source order (always non-empty).

§ignore_unknown_user: bool

Whether the IGNORE UNKNOWN USER trailer was written.

§meta: Meta

Source location and node identity.

§

AccountRevokeRole

REVOKE [IF EXISTS] <role> [, …] FROM <user> [, …] [IGNORE UNKNOWN USER] — a MySQL role-membership revoke.

Fields

§if_exists: bool

Whether the IF EXISTS guard was written.

§roles: ThinVec<AccountName>

The revoked roles, in source order (always non-empty).

§grantees: ThinVec<AccountName>

The grantee accounts, in source order (always non-empty).

§ignore_unknown_user: bool

Whether the IGNORE UNKNOWN USER trailer was written.

§meta: Meta

Source location and node identity.

Trait Implementations§

Source§

impl<X: Clone + Extension> Clone for AccessControlStatement<X>

Source§

fn clone(&self) -> AccessControlStatement<X>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<X: Debug + Extension> Debug for AccessControlStatement<X>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<X: Eq + Extension> Eq for AccessControlStatement<X>

Source§

impl<X: Hash + Extension> Hash for AccessControlStatement<X>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<X: PartialEq + Extension> PartialEq for AccessControlStatement<X>

Source§

fn eq(&self, other: &AccessControlStatement<X>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<X: Extension + Render> Render for AccessControlStatement<X>

Source§

fn render(&self, ctx: &RenderCtx<'_>, f: &mut Formatter<'_>) -> Result

Return the render for this value.
Source§

fn operand_binding_power(&self) -> Option<BindingPower>

The binding power this node contributes when it appears as an operand, or None (the default) for a self-delimiting node — an atom, call, or constructor — that never needs parentheses. Read more
Source§

impl<X> Serialize for AccessControlStatement<X>
where X: Serialize + Extension,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<X: Extension> Spanned for AccessControlStatement<X>

Source§

fn span(&self) -> Span

Return the span for this value.
Source§

impl<X: PartialEq + Extension> StructuralPartialEq for AccessControlStatement<X>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynAstExt for T
where T: Extension + Render + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Erase to &dyn Any for downcasting a node back to its concrete type.
Source§

fn dyn_clone(&self) -> Box<dyn DynAstExt>

Clone into a fresh box — the object-safe stand-in for Clone (whose Self-returning signature cannot go through a vtable).
Source§

fn dyn_eq(&self, other: &dyn DynAstExt) -> bool

Structural equality against another erased node — the object-safe stand-in for 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.
Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Feed this node’s hash into an erased hasher — the object-safe stand-in for Hash::hash (whose generic H: Hasher cannot go through a vtable).
Source§

impl<T> Extension for T
where T: Clone + Debug + Eq + Hash + Spanned,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> RenderExt for T
where T: Render,

Source§

fn displayed<'a>(&'a self, ctx: &'a RenderCtx<'a>) -> Displayed<'a, T>

Pair this node with an explicit canonical RenderCtx so format!, to_string, and {} render it. This is the canonical path: the ctx’s resolver and source must match the node’s parse.
Source§

fn debug_sql<'a>(&'a self, resolver: &'a dyn Resolver) -> DebugSql<'a, Self>
where Self: Sized,

Render this node for debugging against an explicitly-supplied resolver (the debug-SQL mitigation), returning a Display adapter. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.