Fix conditions in class AuthenticationSource

This commit is contained in:
Julio Cesar Laura
2014-11-14 09:50:04 -04:00
parent 05b318b6a1
commit aafbe8ff55

View File

@@ -8,7 +8,7 @@
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
* long as it does not already exist in the output directory. * long as it does not already exist in the output directory.
* *
*/ */
/** /**
@@ -27,7 +27,7 @@ class AuthenticationSource extends BaseAuthenticationSource {
$oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_UID, '', Criteria::NOT_EQUAL); $oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_UID, '', Criteria::NOT_EQUAL);
return $oCriteria; return $oCriteria;
} }
public function load($sUID) { public function load($sUID) {
try { try {
$oAuthenticationSource = AuthenticationSourcePeer::retrieveByPK($sUID); $oAuthenticationSource = AuthenticationSourcePeer::retrieveByPK($sUID);
@@ -69,13 +69,13 @@ class AuthenticationSource extends BaseAuthenticationSource {
$oConnection->begin(); $oConnection->begin();
$iResult = $oAuthenticationSource->save(); $iResult = $oAuthenticationSource->save();
$oConnection->commit(); $oConnection->commit();
$authSourceServerName = isset($aData['AUTH_SOURCE_SERVER_NAME']) ? ' - Server Name: '.$aData['AUTH_SOURCE_SERVER_NAME'] : ''; $authSourceServerName = isset($aData['AUTH_SOURCE_SERVER_NAME']) ? ' - Server Name: '.$aData['AUTH_SOURCE_SERVER_NAME'] : '';
$authSourcePort = isset($aData['AUTH_SOURCE_PORT']) ? ' - Port: '.$aData['AUTH_SOURCE_PORT'] : ''; $authSourcePort = isset($aData['AUTH_SOURCE_PORT']) ? ' - Port: '.$aData['AUTH_SOURCE_PORT'] : '';
$authSourceEnabledTLS = isset($aData['AUTH_SOURCE_ENABLED_TLS']) ? ' - TLS: '.$aData['AUTH_SOURCE_ENABLED_TLS'] : ''; $authSourceEnabledTLS = isset($aData['AUTH_SOURCE_ENABLED_TLS']) ? ' - TLS: '.$aData['AUTH_SOURCE_ENABLED_TLS'] : '';
$authSourceVersion = isset($aData['AUTH_SOURCE_VERSION']) ? ' - Version: '.$aData['AUTH_SOURCE_VERSION'] : ''; $authSourceVersion = isset($aData['AUTH_SOURCE_VERSION']) ? ' - Version: '.$aData['AUTH_SOURCE_VERSION'] : '';
$authSourceBaseDn = isset($aData['AUTH_SOURCE_BASE_DN']) ? ' - BaseDN: '.$aData['AUTH_SOURCE_BASE_DN'] : ''; $authSourceBaseDn = isset($aData['AUTH_SOURCE_BASE_DN']) ? ' - BaseDN: '.$aData['AUTH_SOURCE_BASE_DN'] : '';
$authAnonymous = $aData['AUTH_ANONYMOUS'] = 1? ' - Anonymous: YES' : ' - Anonymous: NO'; $authAnonymous = $aData['AUTH_ANONYMOUS'] == 1? ' - Anonymous: YES' : ' - Anonymous: NO';
$authSourceSearchUser = isset($aData['AUTH_SOURCE_SEARCH_USER']) ? ' - Search User: '. $aData['AUTH_SOURCE_SEARCH_USER'] : ''; $authSourceSearchUser = isset($aData['AUTH_SOURCE_SEARCH_USER']) ? ' - Search User: '. $aData['AUTH_SOURCE_SEARCH_USER'] : '';
$authSourceLdapType = isset($aData['AUTH_SOURCE_DATA']['LDAP_TYPE']) ? ' - LDAP type: '.$aData['AUTH_SOURCE_DATA']['LDAP_TYPE'] : ''; $authSourceLdapType = isset($aData['AUTH_SOURCE_DATA']['LDAP_TYPE']) ? ' - LDAP type: '.$aData['AUTH_SOURCE_DATA']['LDAP_TYPE'] : '';
$authSourceIdentifier = isset($aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']) ? ' - Identifier: '.$aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : ''; $authSourceIdentifier = isset($aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']) ? ' - Identifier: '.$aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : '';
@@ -106,7 +106,7 @@ class AuthenticationSource extends BaseAuthenticationSource {
$authSourceEnabledTLS = isset($aData['AUTH_SOURCE_ENABLED_TLS']) ? ' - TLS: '.$aData['AUTH_SOURCE_ENABLED_TLS'] : ''; $authSourceEnabledTLS = isset($aData['AUTH_SOURCE_ENABLED_TLS']) ? ' - TLS: '.$aData['AUTH_SOURCE_ENABLED_TLS'] : '';
$authSourceVersion = isset($aData['AUTH_SOURCE_VERSION']) ? ' - Version: '.$aData['AUTH_SOURCE_VERSION'] : ''; $authSourceVersion = isset($aData['AUTH_SOURCE_VERSION']) ? ' - Version: '.$aData['AUTH_SOURCE_VERSION'] : '';
$authSourceBaseDn = isset($aData['AUTH_SOURCE_BASE_DN']) ? ' - BaseDN: '.$aData['AUTH_SOURCE_BASE_DN'] : ''; $authSourceBaseDn = isset($aData['AUTH_SOURCE_BASE_DN']) ? ' - BaseDN: '.$aData['AUTH_SOURCE_BASE_DN'] : '';
$authAnonymous = $aData['AUTH_ANONYMOUS'] = 1? ' - Anonymous: YES' : ' - Anonymous: NO'; $authAnonymous = $aData['AUTH_ANONYMOUS'] == 1? ' - Anonymous: YES' : ' - Anonymous: NO';
$authSourceSearchUser = isset($aData['AUTH_SOURCE_SEARCH_USER']) ? ' - Search User: '. $aData['AUTH_SOURCE_SEARCH_USER'] : ''; $authSourceSearchUser = isset($aData['AUTH_SOURCE_SEARCH_USER']) ? ' - Search User: '. $aData['AUTH_SOURCE_SEARCH_USER'] : '';
$authSourceLdapType = isset($aData['AUTH_SOURCE_DATA']['LDAP_TYPE']) ? ' - LDAP type: '.$aData['AUTH_SOURCE_DATA']['LDAP_TYPE'] : ''; $authSourceLdapType = isset($aData['AUTH_SOURCE_DATA']['LDAP_TYPE']) ? ' - LDAP type: '.$aData['AUTH_SOURCE_DATA']['LDAP_TYPE'] : '';
$authSourceIdentifier = isset($aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']) ? ' - Identifier: '.$aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : ''; $authSourceIdentifier = isset($aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER']) ? ' - Identifier: '.$aData['AUTH_SOURCE_DATA']['AUTH_SOURCE_IDENTIFIER_FOR_USER'] : '';
@@ -158,7 +158,7 @@ class AuthenticationSource extends BaseAuthenticationSource {
$oConnection->begin(); $oConnection->begin();
$iResult = $oAuthenticationSource->delete(); $iResult = $oAuthenticationSource->delete();
$oConnection->commit(); $oConnection->commit();
G::auditLog("DeleteAuthSource", "Authentication Source Name: ".$authenticationSource['AUTH_SOURCE_NAME']." Authentication Source ID: (".$sUID.") "); G::auditLog("DeleteAuthSource", "Authentication Source Name: ".$authenticationSource['AUTH_SOURCE_NAME']." Authentication Source ID: (".$sUID.") ");
return $iResult; return $iResult;
} }
@@ -171,7 +171,7 @@ class AuthenticationSource extends BaseAuthenticationSource {
throw($oError); throw($oError);
} }
} }
//Added By Enrique Ponce de Leon <enrique@colosa.com> //Added By Enrique Ponce de Leon <enrique@colosa.com>
//Gets Criteria to fill grid of authentication source //Gets Criteria to fill grid of authentication source
function getAuthenticationSources($start,$limit,$filter=''){ function getAuthenticationSources($start,$limit,$filter=''){
@@ -181,7 +181,7 @@ class AuthenticationSource extends BaseAuthenticationSource {
if ($filter!=''){ if ($filter!=''){
$oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_NAME,'%'.$filter.'%',Criteria::LIKE); $oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_NAME,'%'.$filter.'%',Criteria::LIKE);
} }
$oCriteria2 = new Criteria('rbac'); $oCriteria2 = new Criteria('rbac');
$oCriteria2->addSelectColumn('*'); $oCriteria2->addSelectColumn('*');
$oCriteria2->add(AuthenticationSourcePeer::AUTH_SOURCE_UID,'',Criteria::NOT_EQUAL); $oCriteria2->add(AuthenticationSourcePeer::AUTH_SOURCE_UID,'',Criteria::NOT_EQUAL);
@@ -190,13 +190,13 @@ class AuthenticationSource extends BaseAuthenticationSource {
} }
$oCriteria2->setLimit($limit); $oCriteria2->setLimit($limit);
$oCriteria2->setOffset($start); $oCriteria2->setOffset($start);
$result = array(); $result = array();
$result['COUNTER'] = $oCriteria; $result['COUNTER'] = $oCriteria;
$result['LIST'] = $oCriteria2; $result['LIST'] = $oCriteria2;
return $result; return $result;
} }
function getAllAuthSourcesByUser(){ function getAllAuthSourcesByUser(){
$oCriteria = new Criteria('rbac'); $oCriteria = new Criteria('rbac');
$oCriteria->addSelectColumn(RbacUsersPeer::USR_UID); $oCriteria->addSelectColumn(RbacUsersPeer::USR_UID);
@@ -204,10 +204,10 @@ class AuthenticationSource extends BaseAuthenticationSource {
$oCriteria->addSelectColumn(AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER); $oCriteria->addSelectColumn(AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER);
$oCriteria->add(RbacUsersPeer::USR_STATUS,0,Criteria::NOT_EQUAL); $oCriteria->add(RbacUsersPeer::USR_STATUS,0,Criteria::NOT_EQUAL);
$oCriteria->addJoin(RbacUsersPeer::UID_AUTH_SOURCE, AuthenticationSourcePeer::AUTH_SOURCE_UID, Criteria::INNER_JOIN); $oCriteria->addJoin(RbacUsersPeer::UID_AUTH_SOURCE, AuthenticationSourcePeer::AUTH_SOURCE_UID, Criteria::INNER_JOIN);
$oDataset = RbacUsersPeer::doSelectRS($oCriteria); $oDataset = RbacUsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$aAuth = array(); $aAuth = array();
while($oDataset->next()){ while($oDataset->next()){
$row = $oDataset->getRow(); $row = $oDataset->getRow();
@@ -215,5 +215,5 @@ class AuthenticationSource extends BaseAuthenticationSource {
} }
return $aAuth; return $aAuth;
} }
} // AuthenticationSource } // AuthenticationSource