- added new attributes $_pwdExpiration, $_loginFailures, $_isDisabled

This commit is contained in:
steinm 2012-08-28 07:31:31 +00:00
parent 43e7cb9d47
commit fa5bdbd753

View File

@ -44,6 +44,13 @@ class LetoDMS_Core_User {
*/ */
var $_pwd; var $_pwd;
/**
* @var string date when password expires
*
* @access protected
*/
var $_pwdExpiration;
/** /**
* @var string full human readable name of user * @var string full human readable name of user
* *
@ -91,12 +98,26 @@ class LetoDMS_Core_User {
var $_role; var $_role;
/** /**
* @var string true if user shall be hidden * @var boolean true if user shall be hidden
* *
* @access protected * @access protected
*/ */
var $_isHidden; var $_isHidden;
/**
* @var boolean true if user is disabled
*
* @access protected
*/
var $_isDisabled;
/**
* @var int number of login failures
*
* @access protected
*/
var $_loginFailures;
/** /**
* @var object reference to the dms instance this user belongs to * @var object reference to the dms instance this user belongs to
* *
@ -108,7 +129,7 @@ class LetoDMS_Core_User {
const role_admin = '1'; const role_admin = '1';
const role_guest = '2'; const role_guest = '2';
function LetoDMS_Core_User($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0) { function LetoDMS_Core_User($id, $login, $pwd, $fullName, $email, $language, $theme, $comment, $role, $isHidden=0, $isDisabled=0, $pwdExpiration='', $loginFailures=0) {
$this->_id = $id; $this->_id = $id;
$this->_login = $login; $this->_login = $login;
$this->_pwd = $pwd; $this->_pwd = $pwd;
@ -119,6 +140,9 @@ class LetoDMS_Core_User {
$this->_comment = $comment; $this->_comment = $comment;
$this->_role = $role; $this->_role = $role;
$this->_isHidden = $isHidden; $this->_isHidden = $isHidden;
$this->_isDisabled = $isDisabled;
$this->_pwdExpiration = $pwdExpiration;
$this->_loginFailures = $loginFailures;
$this->_dms = null; $this->_dms = null;
} }
@ -170,6 +194,20 @@ class LetoDMS_Core_User {
return true; return true;
} /* }}} */ } /* }}} */
function getPwdExpiration() { return $this->_pwdExpiration; }
function setPwdExpiration($newPwdExpiration) { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "UPDATE tblUsers SET pwdExpiration =".$db->qstr($newPwdExpiration)." WHERE id = " . $this->_id;
$res = $db->getResult($queryStr);
if (!$res)
return false;
$this->_pwdExpiration = $newPwdExpiration;
return true;
} /* }}} */
function getEmail() { return $this->_email; } function getEmail() { return $this->_email; }
function setEmail($newEmail) { /* {{{ */ function setEmail($newEmail) { /* {{{ */
@ -279,6 +317,42 @@ class LetoDMS_Core_User {
return true; return true;
} /* }}} */ } /* }}} */
function isDisabled() { return $this->_isDisabled; }
function setDisabled($isDisabled) { /* {{{ */
$db = $this->_dms->getDB();
$isDisabled = ($isDisabled) ? "1" : "0";
$queryStr = "UPDATE tblUsers SET disabled = " . $isDisabled . " WHERE id = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
$this->_isDisabled = $isDisabled;
return true;
} /* }}} */
function addLoginFailure() { /* {{{ */
$db = $this->_dms->getDB();
$this->_loginFailures++;
$queryStr = "UPDATE tblUsers SET loginfailures = " . $this->_loginFailures . " WHERE id = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
return $this->_loginFailures;
} /* }}} */
function clearLoginFailures() { /* {{{ */
$db = $this->_dms->getDB();
$this->_loginFailures = 0;
$queryStr = "UPDATE tblUsers SET loginfailures = " . $this->_loginFailures . " WHERE id = " . $this->_id;
if (!$db->getResult($queryStr))
return false;
return true;
} /* }}} */
/** /**
* Remove the user and also remove all its keywords, notifies, etc. * Remove the user and also remove all its keywords, notifies, etc.
* Do not remove folders and documents of the user, but assign them * Do not remove folders and documents of the user, but assign them
@ -548,7 +622,7 @@ class LetoDMS_Core_User {
* further. * further.
* *
* For a detaile description of the result array see * For a detaile description of the result array see
* {link LetoDMS_User::getApprovalStatus} * {link LetoDMS_Core_User::getApprovalStatus}
* *
* @param int $documentID optional document id for which to retrieve the * @param int $documentID optional document id for which to retrieve the
* reviews * reviews
@ -738,7 +812,7 @@ class LetoDMS_Core_User {
/** /**
* Get a list of mandatory approvers * Get a list of mandatory approvers
* See {link LetoDMS_User::getMandatoryReviewers} * See {link LetoDMS_Core_User::getMandatoryReviewers}
* *
* @return array list of arrays with two elements containing the user id * @return array list of arrays with two elements containing the user id
* (approverUserID) and group id (approverGroupID) of the approver. * (approverUserID) and group id (approverGroupID) of the approver.