示例#1
0
 /**
  * verification the register automatic
  *
  *
  * @access public
  * @param string $strUser the system
  * @param string $strPass the password
  * @return $res
  */
 public function checkAutomaticRegister($strUser, $strPass)
 {
     $result = -1;
     //default return value,
     foreach ($this->aRbacPlugins as $sClassName) {
         $plugin = new $sClassName();
         if (method_exists($plugin, 'automaticRegister')) {
             $oCriteria = new Criteria('rbac');
             $oCriteria->add(AuthenticationSourcePeer::AUTH_SOURCE_PROVIDER, $sClassName);
             $oCriteria->addAscendingOrderByColumn(AuthenticationSourcePeer::AUTH_SOURCE_NAME);
             $oDataset = AuthenticationSourcePeer::doSelectRS($oCriteria);
             $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             $oDataset->next();
             $aRow = $oDataset->getRow();
             while (is_array($aRow)) {
                 $aRow = array_merge($aRow, unserialize($aRow['AUTH_SOURCE_DATA']));
                 //Check if this authsource is enabled for AutoRegister, if not skip this
                 if ($aRow['AUTH_SOURCE_AUTO_REGISTER'] == 1) {
                     $plugin->sAuthSource = $aRow['AUTH_SOURCE_UID'];
                     $plugin->sSystem = $this->sSystem;
                     //search the usersRolesObj
                     //create the users in ProcessMaker
                     $res = $plugin->automaticRegister($aRow, $strUser, $strPass);
                     if ($res == 1) {
                         return $res;
                     }
                 }
                 $oDataset->next();
                 $aRow = $oDataset->getRow();
             }
         }
     }
 }
示例#2
0
     require_once PATH_RBAC . 'model/AuthenticationSource.php';
     global $RBAC;
     G::LoadClass('configuration');
     $co = new Configurations();
     $config = $co->getConfiguration('authSourcesList', 'pageSize', '', $_SESSION['USER_LOGGED']);
     $limit_size = isset($config['pageSize']) ? $config['pageSize'] : 20;
     $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
     $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : $limit_size;
     $filter = isset($_REQUEST['textFilter']) ? $_REQUEST['textFilter'] : '';
     $Criterias = $RBAC->getAuthenticationSources($start, $limit, $filter);
     $Dat = AuthenticationSourcePeer::doSelectRS($Criterias['COUNTER']);
     $Dat->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $Dat->next();
     $row = $Dat->getRow();
     $total_sources = $row['CNT'];
     $oDataset = AuthenticationSourcePeer::doSelectRS($Criterias['LIST']);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     global $RBAC;
     $auth = $RBAC->getAllUsersByAuthSource();
     $aSources = array();
     while ($oDataset->next()) {
         $aSources[] = $oDataset->getRow();
         $index = sizeof($aSources) - 1;
         $aSources[$index]['CURRENT_USERS'] = isset($auth[$aSources[$index]['AUTH_SOURCE_UID']]) ? $auth[$aSources[$index]['AUTH_SOURCE_UID']] : 0;
     }
     echo '{sources: ' . G::json_encode($aSources) . ', total_sources: ' . $total_sources . '}';
     break;
 case 'canDeleteAuthSource':
     //echo 'llego';
     //require_once PATH_RBAC.'model/RbacUsers.php';
     try {
示例#3
0
     foreach ($gUIDs as $GRP_UID) {
         $oGroup->addUserToGroup($GRP_UID, $USR_UID);
     }
     break;
 case 'deleteGroupsToUserMultiple':
     $USR_UID = $_POST['USR_UID'];
     $gUIDs = explode(',', $_POST['GRP_UID']);
     G::LoadClass('groups');
     $oGroup = new Groups();
     foreach ($gUIDs as $GRP_UID) {
         $oGroup->removeUserOfGroup($GRP_UID, $USR_UID);
     }
     break;
 case 'authSources':
     $criteria = $RBAC->getAllAuthSources();
     $objects = AuthenticationSourcePeer::doSelectRS($criteria);
     $objects->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $arr = array();
     if (isset($_REQUEST['cmb'])) {
         if ($_REQUEST['cmb'] == 'yes') {
             $started = array();
             $started['AUTH_SOURCE_UID'] = '';
             $started['AUTH_SOURCE_SHOW'] = G::LoadTranslation('ID_ALL');
             $arr[] = $started;
         }
     }
     $started = array();
     $started['AUTH_SOURCE_UID'] = '00000000000000000000000000000000';
     //$started['AUTH_SOURCE_NAME'] = 'ProcessMaker';
     //$started['AUTH_SOURCE_TYPE'] = 'MYSQL';
     $started['AUTH_SOURCE_SHOW'] = 'ProcessMaker (MYSQL)';
 /**
  * Function remove
  * access public
  */
 function remove($sUID)
 {
     $oConnection = Propel::getConnection(AuthenticationSourcePeer::DATABASE_NAME);
     try {
         $oAuthenticationSource = AuthenticationSourcePeer::retrieveByPK($sUID);
         if (!is_null($oAuthenticationSource)) {
             $oConnection->begin();
             $iResult = $oAuthenticationSource->delete();
             $oConnection->commit();
             return $iResult;
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      Connection $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(AuthenticationSourcePeer::AUTH_SOURCE_UID, $pks, Criteria::IN);
         $objs = AuthenticationSourcePeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Function remove
  * access public
  */
 function remove($sUID)
 {
     $oConnection = Propel::getConnection(AuthenticationSourcePeer::DATABASE_NAME);
     try {
         $oAuthenticationSource = AuthenticationSourcePeer::retrieveByPK($sUID);
         $authenticationSource = $this->load($sUID);
         if (!is_null($oAuthenticationSource)) {
             $oConnection->begin();
             $iResult = $oAuthenticationSource->delete();
             $oConnection->commit();
             G::auditLog("DeleteAuthSource", "Authentication Source Name: " . $authenticationSource['AUTH_SOURCE_NAME'] . " Authentication Source ID: (" . $sUID . ") ");
             return $iResult;
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = AuthenticationSourcePeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setAuthSourceUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setAuthSourceName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAuthSourceProvider($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setAuthSourceServerName($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAuthSourcePort($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAuthSourceEnabledTls($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setAuthSourceVersion($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setAuthSourceBaseDn($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setAuthAnonymous($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setAuthSourceSearchUser($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setAuthSourcePassword($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setAuthSourceAttributes($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setAuthSourceObjectClasses($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setAuthSourceData($arr[$keys[13]]);
     }
 }