[][src]Enum pathfix::config::IncludeAdministrative

pub enum IncludeAdministrative {
    Always,
    RootOnly,
    Users(Vec<String>),
    Groups(Vec<String>),
    Never,
}

Variants

Always
RootOnly
Users(Vec<String>)
Groups(Vec<String>)
Never

Implementations

impl IncludeAdministrative[src]

pub fn check_current_user(&self) -> Result<bool>[src]

check_current_user will check if the running users qualifies as an administrator.

The result will be used to includes path's which are marked as admin only.

Examples

use pathfix::config::IncludeAdministrative;

assert_eq!(IncludeAdministrative::Always.check_current_user().unwrap(), true);
assert_eq!(IncludeAdministrative::Never.check_current_user().unwrap(), false);
assert_eq!(
    IncludeAdministrative::Users(vec!["thisuserdoesnotexist".to_string()]).check_current_user().unwrap(),
    false
);
assert_eq!(IncludeAdministrative::RootOnly.check_current_user().unwrap(), users::get_current_uid() == 0);

Trait Implementations

impl Clone for IncludeAdministrative[src]

impl Debug for IncludeAdministrative[src]

impl Default for IncludeAdministrative[src]

impl<'de> Deserialize<'de> for IncludeAdministrative[src]

impl Eq for IncludeAdministrative[src]

impl PartialEq<IncludeAdministrative> for IncludeAdministrative[src]

impl Serialize for IncludeAdministrative[src]

impl StructuralEq for IncludeAdministrative[src]

impl StructuralPartialEq for IncludeAdministrative[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.