HWRF  trunk@4391
Public Member Functions | List of all members
produtil.acl.ACL Class Reference

ACL class wrapped around the libacl library: More...

Detailed Description

ACL class wrapped around the libacl library:

Inquire and manipulate access control lists (ACLs).

Represents a POSIX Access Control List (ACL). This is a wrapper around the libacl library, and implements only widely-supported ACL features. Data is stored internally in C structures, which are allocated and freed automatically as needed.

Definition at line 139 of file acl.py.

Inheritance diagram for produtil.acl.ACL:

Public Member Functions

def __init__ (self)
 Create a blank, invalid, ACL. More...
 
def __del__ (self)
 Free the memory used by the ACL in libacl. More...
 
def free (self)
 Frees resources used by the libacl library to store this ACL's underlying C structures. More...
 
def have_acl (self)
 Returns True if this ACL has data, and False otherwise. More...
 
def from_text (self, acl)
 Attempts to convert the given string to an ACL, storing the result in this object. More...
 
def from_file
 Copies the files's ACL into this object. More...
 
def from_fd (self, fd)
 Get an access control list from a file descriptor. More...
 
def to_fd (self, fd)
 Updates a file's file descriptor. More...
 
def to_file
 Updates a file's access control list. More...
 
def to_text (self)
 Converts an ACL to text. More...
 
def __str__ (self)
 => self.to_text()
 

Constructor & Destructor Documentation

def produtil.acl.ACL.__init__ (   self)

Create a blank, invalid, ACL.

You should use the various from_* routines to fill it with valid data.

Definition at line 146 of file acl.py.

def produtil.acl.ACL.__del__ (   self)

Free the memory used by the ACL in libacl.

Definition at line 152 of file acl.py.

Member Function Documentation

def produtil.acl.ACL.free (   self)

Frees resources used by the libacl library to store this ACL's underlying C structures.

Definition at line 155 of file acl.py.

Referenced by produtil.acl.ACL.__del__(), produtil.acl.ACL.from_file(), and produtil.acl.ACL.from_text().

def produtil.acl.ACL.from_fd (   self,
  fd 
)

Get an access control list from a file descriptor.

Obtains an Access Control List from the specified file object or file descriptor number. You can also pass any object that has a "fileno()" member function. Any prior ACL information in this object will be freed.

Parameters
fdan integer file descriptor or a file object.
Returns
self

Definition at line 205 of file acl.py.

def produtil.acl.ACL.from_file (   self,
  filename,
  which = ACL_TYPE_ACCESS 
)

Copies the files's ACL into this object.

Specify which type of access control list via the second argument: ACL_TYPE_ACCESS or ACL_TYPE_DEFAULT. Any prior ACL information in this object will be freed.

Parameters
filenamethe name of the file whose ACL is desired
whichwhich access control list is desired; ACL_TYPE_ACCESS or ACL_TYPE_DEFAULT.
Returns
self

Definition at line 185 of file acl.py.

def produtil.acl.ACL.from_text (   self,
  acl 
)

Attempts to convert the given string to an ACL, storing the result in this object.

Any prior ACL information in this object will be freed.

Parameters
aclthe access control list description

Definition at line 167 of file acl.py.

def produtil.acl.ACL.have_acl (   self)

Returns True if this ACL has data, and False otherwise.

Definition at line 164 of file acl.py.

def produtil.acl.ACL.to_fd (   self,
  fd 
)

Updates a file's file descriptor.

Sets the ACL for the specified file descriptor to the ACL stored in this object. Raises ACLMissingError if this object has no ACL information.

Parameters
fdan integer file descriptor or open file object

Definition at line 224 of file acl.py.

def produtil.acl.ACL.to_file (   self,
  filename,
  access = ACL_TYPE_ACCESS 
)

Updates a file's access control list.

Sets the ACL for the specified file to the ACL stored in this object. Specify access=ACL_TYPE_DEFAULT to obtain the default access control list (Default ACL) or ACL_TYPE_ACCESS for the access control list. Raises ACLMissingError if this object has no ACL information.

Parameters
filenamethe name of the file whose ACL is to be updated
accessACL_TYPE_ACCESS or ACL_TYPE_DEFAULT

Definition at line 245 of file acl.py.

def produtil.acl.ACL.to_text (   self)

Converts an ACL to text.

Returns a string representation of this ACL from acl_to_text. Returns the empty string ('') if this ACL has no data.

Definition at line 268 of file acl.py.

Referenced by produtil.acl.ACL.__str__().


The documentation for this class was generated from the following file: