Class File_Passwd_Common

Description

Baseclass for File_Passwd_* classes.

Provides basic operations:

  • opening & closing
  • locking & unlocking
  • loading & saving
  • check if user exist
  • delete a certain user
  • list users

Located in Program_Root/Passwd/Common.php (line 43)


	
			
Direct descendents
Class Description
File_Passwd_Authbasic Manipulate AuthUserFiles as used for HTTP Basic Authentication.
File_Passwd_Authdigest Manipulate AuthDigestFiles as used for HTTP Digest Authentication.
File_Passwd_Cvs Manipulate CVS pserver passwd files.
File_Passwd_Smb Manipulate SMB server passwd files.
File_Passwd_Unix Manipulate standard Unix passwd files.
Variable Summary
 aray $_contents
 string $_file
 array $_users
Method Summary
 mixed delUser (string $user)
 string getFile ()
 mixed listUser ([string $user = ''])
 mixed load ()
 object PEAR_Error parse ()
 object PEAR_Error save ()
 void setFile (mixed $file)
 bool userExists (string $user)
 mixed _close (resource &$file_handle)
 mixed &_open (string $mode)
 mixed _save (mixed $content)
 object copy __clone ()
 void __construct ([string $file = 'passwd'])
Variables
aray $_contents = array() (line 59)

File content

  • access: protected
string $_file = 'passwd' (line 51)

passwd file

  • access: protected
array $_users = array() (line 67)

Users

  • access: protected
Methods
delUser (line 269)

Delete a certain user

Returns a PEAR_Error if user doesn't exist.

  • return: true on success or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed delUser (string $user)
  • string $user
getFile (line 244)

Get path of passwd file

  • access: public
string getFile ()
listUser (line 287)

List user

Returns a PEAR_Error if $user doesn't exist.

  • return: array of a/all user(s) or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed listUser ([string $user = ''])
  • string $user: the user to list or all users if empty
load (line 185)

Loads the file

Returns a PEAR_Error if:

  • directory in which the file should reside couldn't be created
  • file couldn't be opened in read mode
  • file couldn't be locked exclusively
  • file couldn't be unlocked
  • file couldn't be closed

  • return: true on success or PEAR_Error
  • access: public
  • throws: PEAR_Error
mixed load ()
parse (line 99)

Parse the content of the file

You must overwrite this method in your File_Passwd_* class.

  • access: public
  • abstract:
object PEAR_Error parse ()

Redefined in descendants as:
save (line 113)

Apply changes and rewrite passwd file

You must overwrite this method in your File_Passwd_* class.

  • access: public
  • abstract:
object PEAR_Error save ()

Redefined in descendants as:
setFile (line 234)

Set path to passwd file

  • access: public
void setFile (mixed $file)
userExists (line 255)

Check if a certain user already exists

  • access: public
bool userExists (string $user)
  • string $user: the name of the user to check if already exists
_close (line 161)

Closes a prior opened and locked file handle

Returns a PEAR_Error if:

  • file couldn't be unlocked
  • file couldn't be closed

  • return: true on success or PEAR_Error
  • access: protected
  • throws: PEAR_Error
mixed _close (resource &$file_handle)
  • resource $file_handle: the file handle to operate on
_open (line 130)

Opens a file, locks it exclusively and returns the filehandle

Returns a PEAR_Error if:

  • directory in which the file should reside couldn't be created
  • file couldn't be opened in the desired mode
  • file couldn't be locked exclusively

  • return: resource of type file handle or PEAR_Error
  • access: protected
  • throws: PEAR_Error
mixed &_open (string $mode)
  • string $mode: the mode to open the file with
_save (line 219)

Save the modified content to the passwd file

Returns a PEAR_Error if:

  • directory in which the file should reside couldn't be created
  • file couldn't be opened in write mode
  • file couldn't be locked exclusively
  • file couldn't be unlocked
  • file couldn't be closed

  • return: true on success or PEAR_Error
  • access: protected
  • throws: PEAR_Error
mixed _save (mixed $content)
__clone (line 85)

Get Copy of this object (ZE2)

  • return: of this opject
  • access: public
object copy __clone ()
__construct (line 75)

Constructor (ZE2)

  • access: protected
void __construct ([string $file = 'passwd'])
  • string $file: path to passwd file

Redefined in descendants as:

Documention generated on Sat, 20 Sep 2003 16:14:42 +0200 by phpDocumentor 1.2.1