ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
SMBPasswd.php
Go to the documentation of this file.
1<?php
2/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 foldmethod=marker: */
3
29require_once "File/SMBPasswd.php";
33require_once "Auth/Container.php";
37require_once "PEAR.php";
38
64{
65
66 // {{{ properties
67
73
74 // }}}
75
76 // {{{ Auth_Container_SMBPasswd() [constructor]
77
85 {
86 $this->pwfile = new File_SMBPasswd($filename,0);
87
88 if (!$this->pwfile->load()) {
89 PEAR::raiseError("Error while reading file contents.", 41, PEAR_ERROR_DIE);
90 return;
91 }
92
93 }
94
95 // }}}
96 // {{{ fetchData()
97
105 function fetchData($username, $password)
106 {
107 $this->log('Auth_Container_SMBPasswd::fetchData() called.', AUTH_LOG_DEBUG);
108 return $this->pwfile->verifyAccount($username, $password);
109 }
110
111 // }}}
112 // {{{ listUsers()
113
114 function listUsers()
115 {
116 $this->log('Auth_Container_SMBPasswd::fetchData() called.', AUTH_LOG_DEBUG);
117 return $this->pwfile->getAccounts();
118 }
119
120 // }}}
121 // {{{ addUser()
122
132 function addUser($username, $password, $additional = '')
133 {
134 $this->log('Auth_Container_SMBPasswd::addUser() called.', AUTH_LOG_DEBUG);
135 $res = $this->pwfile->addUser($user, $additional['userid'], $pass);
136 if ($res === true) {
137 return $this->pwfile->save();
138 }
139 return $res;
140 }
141
142 // }}}
143 // {{{ removeUser()
144
150 function removeUser($username)
151 {
152 $this->log('Auth_Container_SMBPasswd::removeUser() called.', AUTH_LOG_DEBUG);
153 $res = $this->pwfile->delUser($username);
154 if ($res === true) {
155 return $this->pwfile->save();
156 }
157 return $res;
158 }
159
160 // }}}
161 // {{{ changePassword()
162
169 function changePassword($username, $password)
170 {
171 $this->log('Auth_Container_SMBPasswd::changePassword() called.', AUTH_LOG_DEBUG);
172 $res = $this->pwfile->modUser($username, '', $password);
173 if ($res === true) {
174 return $this->pwfile->save();
175 }
176 return $res;
177 }
178
179 // }}}
180
181}
182?>
const AUTH_LOG_DEBUG
Auth Log level - DEBUG.
Definition: Auth.php:59
const PEAR_ERROR_DIE
Definition: PEAR.php:34
$filename
Definition: buildRTE.php:89
changePassword($username, $password)
Change password for user in the storage container.
Definition: SMBPasswd.php:169
fetchData($username, $password)
Get user information from pwfile.
Definition: SMBPasswd.php:105
listUsers()
List all users that are available from the storage container.
Definition: SMBPasswd.php:114
removeUser($username)
Remove user from the storage container.
Definition: SMBPasswd.php:150
addUser($username, $password, $additional='')
Add a new user to the storage container.
Definition: SMBPasswd.php:132
Auth_Container_SMBPasswd($filename)
Constructor of the container class.
Definition: SMBPasswd.php:84
log($message, $level=AUTH_LOG_DEBUG)
Log a message to the Auth log.
Definition: Container.php:246
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:524
$additional
Definition: goto.php:89