Commit 04dfd656d660e351270e79e6a0c86a8ca45853a6

Authored by Neil Blakey-Milner
1 parent 71c7876a

Follow user table name changes.

Add getByAuthenticationSourceAndDetails, to find users by virtue of
their LDAP DN (for example).


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4826 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 14 additions and 6 deletions
lib/users/User.inc
@@ -46,8 +46,6 @@ class User extends KTEntity { @@ -46,8 +46,6 @@ class User extends KTEntity {
46 var $bEmailNotification = false; 46 var $bEmailNotification = false;
47 /** notify user via sms (mobile phone) status */ 47 /** notify user via sms (mobile phone) status */
48 var $bSmsNotification = false; 48 var $bSmsNotification = false;
49 - /** user's ldap identification */  
50 - var $sLdapDn = "";  
51 /** maxiumum concurrent sessions user may have */ 49 /** maxiumum concurrent sessions user may have */
52 var $iMaxSessions = 5; 50 var $iMaxSessions = 5;
53 /** primary key of language preferred by user */ 51 /** primary key of language preferred by user */
@@ -58,6 +56,7 @@ class User extends KTEntity { @@ -58,6 +56,7 @@ class User extends KTEntity {
58 var $iAuthenticationSourceId = null; 56 var $iAuthenticationSourceId = null;
59 /** authentication details so that the source knows who this user is */ 57 /** authentication details so that the source knows who this user is */
60 var $sAuthenticationDetails = null; 58 var $sAuthenticationDetails = null;
  59 + var $sAuthenticationDetails2 = null;
61 60
62 var $_aFieldToSelect = array( 61 var $_aFieldToSelect = array(
63 'iId' => 'id', 62 'iId' => 'id',
@@ -70,11 +69,11 @@ class User extends KTEntity { @@ -70,11 +69,11 @@ class User extends KTEntity {
70 'sMobile' => 'mobile', 69 'sMobile' => 'mobile',
71 'bEmailNotification' => 'email_notification', 70 'bEmailNotification' => 'email_notification',
72 'bSmsNotification' => 'sms_notification', 71 'bSmsNotification' => 'sms_notification',
73 - 'sLdapDn' => 'ldap_dn',  
74 'iMaxSessions' => 'max_sessions', 72 'iMaxSessions' => 'max_sessions',
75 'iLanguageID' => 'language_id', 73 'iLanguageID' => 'language_id',
76 'iAuthenticationSourceId' => 'authentication_source_id', 74 'iAuthenticationSourceId' => 'authentication_source_id',
77 - 'sAuthenticationDetails' => 'authentication_details', 75 + 'sAuthenticationDetails' => 'authentication_details_s1',
  76 + 'sAuthenticationDetails2' => 'authentication_details_s2',
78 ); 77 );
79 78
80 var $_bUsePearError = true; 79 var $_bUsePearError = true;
@@ -100,8 +99,6 @@ class User extends KTEntity { @@ -100,8 +99,6 @@ class User extends KTEntity {
100 function setEmailNotification($bNewValue) { $this->bEmailNotification = KTUtil::anyToBool($bNewValue); } 99 function setEmailNotification($bNewValue) { $this->bEmailNotification = KTUtil::anyToBool($bNewValue); }
101 function getSmsNotification() { return $this->bSmsNotification; } 100 function getSmsNotification() { return $this->bSmsNotification; }
102 function setSmsNotification($bNewValue) { $this->bSmsNotification = $bNewValue; } 101 function setSmsNotification($bNewValue) { $this->bSmsNotification = $bNewValue; }
103 - function getLdapDn() { return $this->sLdapDn; }  
104 - function setLdapDn($sNewValue) { $this->sLdapDn = $sNewValue; }  
105 function getMaxSessions() { return $this->iMaxSessions; } 102 function getMaxSessions() { return $this->iMaxSessions; }
106 function setMaxSessions($iNewValue) { $this->iMaxSessions = $iNewValue; } 103 function setMaxSessions($iNewValue) { $this->iMaxSessions = $iNewValue; }
107 function getLanguageID() { return $this->iLanguageIDID; } 104 function getLanguageID() { return $this->iLanguageIDID; }
@@ -110,6 +107,8 @@ class User extends KTEntity { @@ -110,6 +107,8 @@ class User extends KTEntity {
110 function setAuthenticationSourceId($iNewValue) { $this->iAuthenticationSourceId = $iNewValue; } 107 function setAuthenticationSourceId($iNewValue) { $this->iAuthenticationSourceId = $iNewValue; }
111 function getAuthenticationDetails() { return $this->sAuthenticationDetails; } 108 function getAuthenticationDetails() { return $this->sAuthenticationDetails; }
112 function setAuthenticationDetails($sNewValue) { $this->sAuthenticationDetails = $sNewValue; } 109 function setAuthenticationDetails($sNewValue) { $this->sAuthenticationDetails = $sNewValue; }
  110 + function getAuthenticationDetails2() { return $this->sAuthenticationDetails2; }
  111 + function setAuthenticationDetails2($sNewValue) { $this->sAuthenticationDetails2 = $sNewValue; }
113 112
114 /** 113 /**
115 * Delete the current object from the database 114 * Delete the current object from the database
@@ -326,4 +325,13 @@ class User extends KTEntity { @@ -326,4 +325,13 @@ class User extends KTEntity {
326 function &getByUserName($sUserName, $aOptions = null) { 325 function &getByUserName($sUserName, $aOptions = null) {
327 return KTEntityUtil::getBy('User', 'username', $sUserName, $aOptions); 326 return KTEntityUtil::getBy('User', 'username', $sUserName, $aOptions);
328 } 327 }
  328 +
  329 + function &getByAuthenticationSourceAndDetails($oSource, $sDetails, $aOptions = null) {
  330 + $iSourceId = KTUtil::getId($oSource);
  331 +
  332 + return KTEntityUtil::getByDict('User', array(
  333 + 'authentication_source_id' => $iSourceId,
  334 + 'authentication_details_s1' => $sDetails,
  335 + ), $aOptions);
  336 + }
329 } 337 }