Module posix1e
POSIX.1e ACLs manipulation
This module provides support for manipulating POSIX.1e ACLS
Depending on the operating system support for POSIX.1e, the ACL type
will have more or less capabilities:
-
level 1, only basic support, you can create ACLs from files and text
descriptions; once created, the type is immutable
-
level 2, complete support, you can alter the ACL once it is created
Also, in level 2, more types are available, corresponding to
acl_entry_t (the Entry type), acl_permset_t (the Permset type).
The existence of level 2 support and other extensions can be checked
by the constants:
-
HAS_ACL_ENTRY for level 2 and the Entry/Permset classes
-
HAS_ACL_FROM_MODE for ACL(mode=...) usage
-
HAS_ACL_CHECK for the ACL().check function
-
HAS_EXTENDED_CHECK for the module-level has_extended function
-
HAS_EQUIV_MODE for the ACL().equiv_mode method
Example:
>>> import posix1e
>>> acl1 = posix1e.ACL(file="file.txt")
>>> print acl1
user::rw-
group::rw-
other::r--
>>>
>>> b = posix1e.ACL(text="u::rx,g::-,o::-")
>>> print b
user::r-x
group::---
other::---
>>>
>>> b.applyto("file.txt")
>>> print posix1e.ACL(file="file.txt")
user::r-x
group::---
other::---
>>>
|
ACL
Type which represents a POSIX ACL
|
|
Entry
Type which represents an entry in an ACL.
|
|
Permset
Type which represents the permission set in an ACL entry
|
|
|
|
has_extended(...)
Check if a file or filehandle has an extended ACL. |
|
|
|
ACL_DUPLICATE_ERROR = 8192
|
|
ACL_ENTRY_ERROR = 16384
|
|
ACL_EXECUTE = 1
|
|
ACL_GROUP = 8
|
|
ACL_GROUP_OBJ = 4
|
|
ACL_MASK = 16
|
|
ACL_MISS_ERROR = 12288
|
|
ACL_MULTI_ERROR = 4096
|
|
ACL_OTHER = 32
|
|
ACL_READ = 4
|
|
ACL_TYPE_ACCESS = 32768
|
|
ACL_TYPE_DEFAULT = 16384
|
|
ACL_UNDEFINED_TAG = 0
|
|
ACL_USER = 2
|
|
ACL_USER_OBJ = 1
|
|
ACL_WRITE = 2
|
|
HAS_ACL_CHECK = 1
|
|
HAS_ACL_ENTRY = 1
|
|
HAS_ACL_FROM_MODE = 1
|
|
HAS_EQUIV_MODE = 1
|
|
HAS_EXTENDED_CHECK = 1
|
|
TEXT_ABBREVIATE = 16
|
|
TEXT_ALL_EFFECTIVE = 2
|
|
TEXT_NUMERIC_IDS = 8
|
|
TEXT_SMART_INDENT = 4
|
|
TEXT_SOME_EFFECTIVE = 1
|
|
__package__ = None
|
Delete the default ACL from a directory.
This function deletes the default ACL associated with a directory (the
ACL which will be ANDed with the mode parameter to the open, creat
functions). Parameters:
-
a string representing the directory whose default ACL should be
deleted
|
Check if a file or filehandle has an extended ACL.
Parameter:
-
either a filename or a file-like object or an integer; this
represents the filesystem object on which to act
|