[−][src]Struct posix_acl::PosixACL
The ACL of a file.
Methods
impl PosixACL
[src]
pub fn new(file_mode: u32) -> PosixACL
[src]
Convert a file mode ("chmod" number) into an ACL. This is the primary constructor.
Note that modes are usually expressed in Octal, e.g. PosixACL::new(0o644)
This creates the minimal required entries. By the POSIX ACL spec, every valid ACL must contain at least four entries: UserObj, GroupObj, Mask and Other.
Bits higher than 9 (e.g. SUID flag, etc) are ignored.
pub fn empty() -> PosixACL
[src]
Create an empty ACL. NB! Empty ACLs are NOT considered valid.
pub fn with_capacity(capacity: usize) -> PosixACL
[src]
Create an empty ACL with capacity. NB! Empty ACLs are NOT considered valid.
pub fn read_acl(path: &Path) -> Result<PosixACL, SimpleError>
[src]
Read a file's ACL and return as PosixACL
object.
pub fn write_acl(&mut self, path: &Path) -> Result<(), SimpleError>
[src]
Write the current ACL to a file. Overwrites any existing ACL on the file.
Automatically re-calculates the Mask
entry and calls validation.
pub fn entries(&self) -> Vec<ACLEntry>
[src]
Get all ACLEntry items. The POSIX ACL API does not allow multiple parallel iterators so we return a materialized vector just to be safe.
pub fn set(&mut self, qual: Qualifier, perm: u32)
[src]
Set the permission of qual
to perm
. If this qual
already exists, it is updated,
otherwise a new one is added.
perm
must be a combination of the ACL_
constants, combined by binary OR.
pub fn get(&self, qual: Qualifier) -> Option<u32>
[src]
Get the current perm
value of qual
, if any.
pub fn remove(&self, qual: Qualifier) -> Option<u32>
[src]
Remove entry with matching qual
. If found, returns the matching perm
, otherwise None
pub fn fix_mask(&mut self)
[src]
Re-calculate the Qualifier::Mask
entry. This is automatically done during write_acl()
.
pub fn as_text(&self) -> String
[src]
Return the textual representation of the ACL. Individual entries are separated by newline
('\n'
).
pub fn validate(&self) -> Result<(), SimpleError>
[src]
Call the platform's validation function. Unfortunately it is not possible to provide detailed error messages.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PosixACL
impl !Send for PosixACL
impl !Sync for PosixACL
impl Unpin for PosixACL
impl UnwindSafe for PosixACL
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,