Class File_Passwd

Description

Class to manage passwd-style files

Located in Program_Root/Passwd.php (line 35)


	
			
Variable Summary
 array $cvs
 string $filename
 int $fplock
 boolean $locked
 string $lockfile
 array $users
Method Summary
 File_Passwd File_Passwd ($file $file, $lock $lock, [$lockfile $lockfile = ""])
 mixed addUser ($user $user, $pass $pass, [$cvs $cvsuser = ""])
 void close ()
 mixed delUser ($user $user)
 object File_Passwd_$class &factory (string $class)
 string getCvsUser (string $user)
 boolean isLocked ()
 array listUsers ()
 void lock ()
 mixed modUser ($user $user, $pass $pass, [$cvs $cvsuser = ""])
 void unlock ()
 boolean verifyPassword ($user $user, $pass $pass)
Variables
array $cvs (line 53)

hash list of csv-users

string $filename (line 41)

Passwd file

int $fplock (line 59)

filehandle for lockfile

boolean $locked (line 65)

locking state

string $lockfile = './passwd.lock' (line 71)

name of the lockfile

array $users (line 47)

Hash list of users

Methods
Constructor File_Passwd (line 91)

Constructor

Requires the name of the passwd file. This functions opens the file and read it. Changes to this file will written first in the lock file, so it is still possible to access the passwd file by another programs. The lock parameter controls the locking oft the lockfile, not of the passwd file! (Swapping $lock and $lockfile would break BC). Don't forget to call close() to save changes!

File_Passwd File_Passwd ($file $file, $lock $lock, [$lockfile $lockfile = ""])
  • $file $file: name of the passwd file
  • $lock $lock: if 'true' $lockfile will be locked
  • $lockfile $lockfile: name of the temp file, where changes are saved
addUser (line 131)

Adds a user

  • return: returns PEAR_Error, if the user already exists
  • access: public
mixed addUser ($user $user, $pass $pass, [$cvs $cvsuser = ""])
  • $user $user: new user id
  • $pass $pass: password for new user
  • $cvs $cvsuser: cvs user id (needed for pserver passwd files)
close (line 211)

Writes changes to passwd file and unlocks it

  • access: public
void close ()
delUser (line 171)

Deletes a user

  • return: returns PEAR_Error, if the user doesn't exists
  • access: public
mixed delUser ($user $user)
  • $user $user: user id
factory (line 288)

Factory for new extensions

  • Unix for standard Unix passwd files
  • CVS for CVS pserver passwd files
  • Authbasic for AuthUserFiles
  • Authdigest for AuthDigestFiles
Returns a PEAR_Error if the desired class/file couldn't be loaded

  • return: - desired Passwd object or PEAR_Error
  • author: Michael Wallner <mailto:mike@iworks.at>
  • access: public
  • throws: PEAR_Error
  • static: use &File_Passwd::factory() for instantiating you passwd object
object File_Passwd_$class &factory (string $class)
  • string $class: the desired subclass of File_Passwd
getCvsUser (line 267)

Get the CVS username

  • access: public
string getCvsUser (string $user)
  • string $user: username
isLocked (line 256)

Determine if lockfile is locked

  • access: public
boolean isLocked ()
listUsers (line 202)

Return all users from passwd file

  • access: public
array listUsers ()
lock (line 233)

Lock the lockfile

  • access: public
void lock ()
modUser (line 152)

Modifies a user

  • return: returns PEAR_Error, if the user doesn't exists
  • access: public
mixed modUser ($user $user, $pass $pass, [$cvs $cvsuser = ""])
  • $user $user: user id
  • $pass $pass: new password for user
  • $cvs $cvsuser: cvs user id (needed for pserver passwd files)
unlock (line 244)

Unlock the lockfile

  • access: public
void unlock ()
verifyPassword (line 189)

Verifies a user's password

  • return: true if password is ok
  • access: public
boolean verifyPassword ($user $user, $pass $pass)
  • $user $user: user id
  • $pass $pass: password for user

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