Esempio n. 1
0
    /**

     * Create User Uid

     *

     * @param array $arrayUserData Data

     *

     * return id

     */

    public function createUser($userData)

    {

        require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");

        $this->userObj = new \RbacUsers();

        if (class_exists('PMPluginRegistry')) {

            $pluginRegistry = & \PMPluginRegistry::getSingleton();

            if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {

                try {

                    $pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);

                } catch (Exception $error) {

                    throw new Exception($error->getMessage());

                }

            }

        }

        $oConnection = \Propel::getConnection(\RbacUsersPeer::DATABASE_NAME);

        try {

            $oRBACUsers = new \RbacUsers();

            do {

                $userData['USR_UID'] = \G::generateUniqueID();

            } while ($oRBACUsers->load($userData['USR_UID']));

            $oRBACUsers->fromArray($userData, \BasePeer::TYPE_FIELDNAME);

            $iResult = $oRBACUsers->save();

            return $userData['USR_UID'];

        } catch (Exception $oError) {

            $oConnection->rollback();

            throw($oError);

        }

    }
Esempio n. 2
0
 function create($aData)
 {
     $oConnection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
     try {
         $oRBACUsers = new RbacUsers();
         do {
             $aData['USR_UID'] = G::generateUniqueID();
         } while ($oRBACUsers->load($aData['USR_UID']));
         $oRBACUsers->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         //if ($oRBACUsers->validate()) {
         //$oConnection->begin();
         $iResult = $oRBACUsers->save();
         //$oConnection->commit();
         return $aData['USR_UID'];
         /*}
           else {
             $sMessage = '';
             $aValidationFailures = $oRBACUsers->getValidationFailures();
             foreach($aValidationFailures as $oValidationFailure) {
               $sMessage .= $oValidationFailure->getMessage() . '<br />';
             }
             throw(new Exception('The registry cannot be created!<br />' . $sMessage));
           }*/
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
Esempio n. 3
0
 public function create($aData)
 {
     if (class_exists('PMPluginRegistry')) {
         $pluginRegistry =& PMPluginRegistry::getSingleton();
         if ($pluginRegistry->existsTrigger(PM_BEFORE_CREATE_USER)) {
             try {
                 $pluginRegistry->executeTriggers(PM_BEFORE_CREATE_USER, null);
             } catch (Exception $error) {
                 throw new Exception($error->getMessage());
             }
         }
     }
     $oConnection = Propel::getConnection(RbacUsersPeer::DATABASE_NAME);
     try {
         $oRBACUsers = new RbacUsers();
         do {
             $aData['USR_UID'] = G::generateUniqueID();
         } while ($oRBACUsers->load($aData['USR_UID']));
         $oRBACUsers->fromArray($aData, BasePeer::TYPE_FIELDNAME);
         //if ($oRBACUsers->validate()) {
         //$oConnection->begin();
         $iResult = $oRBACUsers->save();
         //$oConnection->commit();
         return $aData['USR_UID'];
         /* }
            else {
            $sMessage = '';
            $aValidationFailures = $oRBACUsers->getValidationFailures();
            foreach($aValidationFailures as $oValidationFailure) {
            $sMessage .= $oValidationFailure->getMessage() . '<br />';
            }
            throw(new Exception('The registry cannot be created!<br />' . $sMessage));
            } */
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }