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: booldrive.readonly — list/read/export/download.
metadata: booldrive.metadata — files.update on name/parents only
(rename/move).
file: booldrive.file — create/upload, plus edit of app-created files.
full: booldrive (unrestricted) — edit of any pre-existing file’s content.
Implementations§
Source§impl DriveGrantedScopes
impl DriveGrantedScopes
Sourcepub const METADATA: Self
pub const METADATA: Self
The scope set requested by --write before issue #1574: readonly +
metadata.
Sourcepub fn as_str(self) -> String
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.
Sourcepub fn from_granted(granted: &str) -> Option<Self>
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.
Sourcepub fn allows_rename_move(self) -> bool
pub fn allows_rename_move(self) -> bool
Whether this scope set allows files.update on name/parents
(rename/move).
Sourcepub fn allows_create_or_upload(self) -> bool
pub fn allows_create_or_upload(self) -> bool
Whether this scope set allows creating a new file/folder or uploading new content.
Sourcepub fn allows_edit_arbitrary_content(self) -> bool
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.
Sourcepub fn allows_write(self) -> bool
pub fn allows_write(self) -> bool
Whether this scope set allows any mutating call at all.
Trait Implementations§
Source§impl Clone for DriveGrantedScopes
impl Clone for DriveGrantedScopes
Source§fn clone(&self) -> DriveGrantedScopes
fn clone(&self) -> DriveGrantedScopes
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DriveGrantedScopes
Source§impl Debug for DriveGrantedScopes
impl Debug for DriveGrantedScopes
Source§impl Default for DriveGrantedScopes
impl Default for DriveGrantedScopes
Source§fn default() -> DriveGrantedScopes
fn default() -> DriveGrantedScopes
impl Eq for DriveGrantedScopes
Source§impl PartialEq for DriveGrantedScopes
impl PartialEq for DriveGrantedScopes
impl StructuralPartialEq for DriveGrantedScopes
Auto Trait Implementations§
impl Freeze for DriveGrantedScopes
impl RefUnwindSafe for DriveGrantedScopes
impl Send for DriveGrantedScopes
impl Sync for DriveGrantedScopes
impl Unpin for DriveGrantedScopes
impl UnsafeUnpin for DriveGrantedScopes
impl UnwindSafe for DriveGrantedScopes
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,
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.