Skip to main content

DriveGrantedScopes

Struct DriveGrantedScopes 

Source
pub struct DriveGrantedScopes {
    pub readonly: bool,
    pub metadata: bool,
    pub file: bool,
    pub full: bool,
}
Expand description

The Drive OAuth2 scope(s) granted at login.

A capability set, not a tier: --write/--write-file/--write-full are independent, combinable opt-ins (Google just grants the union), so a caller can hold any subset of the four scope strings, not one of two mutually exclusive levels (issue #1574, generalizing ADR-0070 §1’s additive-scope principle from two variants to four independent flags). readonly is always requested alongside every other flag — none of metadata/ file/full alone grants read access the way Gmail’s readonly/modify split would imply.

Fields§

§readonly: bool

drive.readonly — list/read/export/download.

§metadata: bool

drive.metadata — files.update on name/parents only (rename/move).

§file: bool

drive.file — create/upload, plus edit of app-created files.

§full: bool

drive (unrestricted) — edit of any pre-existing file’s content.

Implementations§

Source§

impl DriveGrantedScopes

Source

pub const READONLY: Self

The scope set requested before issue #1574: readonly only.

Source

pub const METADATA: Self

The scope set requested by --write before issue #1574: readonly + metadata.

Source

pub fn as_str(self) -> String

Returns the canonical, order-stable, space-separated wire string — used both for DRIVE_SCOPE/drive.accounts.<name>.scope storage and directly as [build_authorization_url]’s requested scope= value, since readonly is now just one of four independent bits rather than a request shape [build_authorization_url] has to derive separately.

Source

pub fn summary(self) -> String

Returns the human-readable scope list drive auth status prints — the same set as Self::as_str, in the same order, with the https://www.googleapis.com/auth/ prefix dropped and comma-separated.

Deliberately derived from the flags rather than branched on a predicate. This type used to be a two-state enum, where if allows_write() { … } else { … } was faithful; ADR-0071 §1 replaced it with four independent bits, at which point any such branch necessarily misreports three of the fifteen non-empty combinations and names a scope the account may not hold. Rendering the bits is the only shape that cannot drift as bits are added.

Returns "(none)" for the empty set rather than an empty string, so the status line never reads Granted scope: with nothing after it.

Source

pub fn from_granted(granted: &str) -> Option<Self>

Parses Google’s space-separated granted-scope response. Every recognized token independently sets its own flag (order-independent, unlike a first-match branch).

Returns None when none of the four Drive scope strings are present — e.g. the user left the Drive permission unticked on Google’s consent screen — so callers can reject the grant instead of silently defaulting to an all-false set.

Source

pub fn allows_rename_move(self) -> bool

Whether this scope set allows files.update on name/parents (rename/move).

Source

pub fn allows_create_or_upload(self) -> bool

Whether this scope set allows creating a new file/folder or uploading new content.

Source

pub fn allows_edit_arbitrary_content(self) -> bool

Whether this scope set allows editing a file omni-dev did not itself create — only the unrestricted drive scope can; drive.file alone cannot.

Source

pub fn allows_write(self) -> bool

Whether this scope set allows any mutating call at all.

Trait Implementations§

Source§

impl Clone for DriveGrantedScopes

Source§

fn clone(&self) -> Self

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 Copy for DriveGrantedScopes

Source§

impl Debug for DriveGrantedScopes

Source§

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

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

impl Default for DriveGrantedScopes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DriveGrantedScopes

Source§

impl PartialEq for DriveGrantedScopes

Source§

fn eq(&self, other: &Self) -> bool

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DriveGrantedScopes

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ResetDiscriminant<T> for T
where T: Copy,

Source§

fn discriminant(&self) -> T

Value based on which equality for the reset will be determined.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more