function perform()
 {
     // if all data is correct, then we can proceed and use it
     $tf = new Textfilter();
     $this->userName = $tf->filterAllHTML($this->_request->getValue("userName"));
     $this->userPassword = $tf->filterAllHTML($this->_request->getValue("userPassword"));
     $this->confirmPassword = $tf->filterAllHTML($this->_request->getValue("userPasswordCheck"));
     $this->userEmail = $tf->filterAllHTML($this->_request->getValue("userEmail"));
     $this->userFullName = $tf->filterAllHTML($this->_request->getValue("userFullName"));
     $this->captcha = $this->_request->getValue("userAuth");
     // check if there is already a user with the same username and quit if so
     $users = new Users();
     if ($users->userExists($this->userName)) {
         $this->_view = new SummaryUserCreationView();
         //$this->_form->hasRun( true );
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // check if this email account has registered and quit if so, but only if the configuration
     // says that we should only allow one blog per email account
     if ($this->_config->getValue("force_one_blog_per_email_account")) {
         if ($users->emailExists($this->userEmail)) {
             $this->_view = new SummaryUserCreationView();
             //$this->_form->hasRun( true );
             $this->_form->setFieldValidationStatus("userEmail", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // check if the passwords match, and stop processing if so too
     if ($this->userPassword != $this->confirmPassword) {
         $this->_view = new SummaryUserCreationView();
         $this->_view->setErrorMessage($this->_locale->tr("error_passwords_dont_match"));
         $this->_form->setFieldValidationStatus("userPasswordCheck", false);
         $this->setCommonData(true);
         return false;
     }
     // check if the captcha matches
     if ($this->_config->getValue("use_captcha_auth")) {
         include_once PLOG_CLASS_PATH . "class/data/captcha/captcha.class.php";
         $captcha = new Captcha();
         if (!$captcha->validate($this->captcha)) {
             $this->_view = new SummaryUserCreationView();
             $this->_view->setErrorMessage($this->_locale->tr("error_invalid_auth_code"));
             $this->_form->setFieldValidationStatus("userAuth", false);
             $this->setCommonData(true);
             return false;
         }
     }
     // if everything went fine, then proceed
     $this->_view = new doBlogRegistrationView();
     $this->setValues();
     $this->setCommonData();
     return true;
 }
Example #2
0
 /**
  * Constructs the class and sets class properties
  * @param mixed  $field_id Value of the identification column
  * @param string $id_field Identification column
  */
 public function __construct($field_id, $id_field = 'id')
 {
     $this->id_field = $id_field;
     $this->user_id = $field_id;
     Users::$id_field = $id_field;
     if (!Users::userExists($field_id)) {
         //Kernel::Log('User with '.$id_field.' '.$field_id.' does not exist');
         return false;
     }
     $this->boot = true;
     $this->refreshCache($id_field, $field_id);
 }
Example #3
0
 /**
  * Validate usr_uid
  *
  * @param string $usr_uid, Uid for user
  * @param string $nameField . Name of field for message
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public static function usrUid($usr_uid, $nameField = 'usr_uid')
 {
     $usr_uid = trim($usr_uid);
     if ($usr_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, '')));
     }
     $oUsers = new \Users();
     if (!$oUsers->userExists($usr_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array($nameField, $usr_uid)));
     }
     return $usr_uid;
 }
 function perform()
 {
     // fetch the validated data
     $this->_userName = Textfilter::filterAllHTML($this->_request->getValue("userName"));
     $this->_userPassword = $this->_request->getValue("newUserPassword");
     $this->_userEmail = Textfilter::filterAllHTML($this->_request->getValue("userEmail"));
     $this->_userFullName = Textfilter::filterAllHTML($this->_request->getValue("userFullName"));
     $this->_userStatus = $this->_request->getValue("userStatus");
     $this->_userBlog = $this->_request->getValue("userBlog");
     // now that we have validated the data, we can proceed to create the user, making
     // sure that it doesn't already exists
     $users = new Users();
     $userInfo = $users->userExists($this->_userName);
     if ($userInfo) {
         $this->_form->setFieldValidationStatus("userName", false);
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->setCommonData(true);
         return false;
     }
     // otherwise, we can create a new one
     $user = new UserInfo($this->_userName, $this->_userPassword, $this->_userEmail, "", $this->_userFullName, 0, $this->_properties);
     $user->setStatus($this->_userStatus);
     $this->notifyEvent(EVENT_PRE_USER_ADD, array("user" => &$user));
     $newUserId = $users->addUser($user);
     if (!$newUserId) {
         $this->_view = new AdminAddUserView($this->_blogInfo);
         $this->_form->setFieldValidationStatus("userName", false);
         $this->setCommonData(true);
         return false;
     }
     // if the userBlog parameter is different than 0, we have to add a relationship
     // between that user and the blog
     if ($this->_userBlog > 0) {
         $permissions = new UserPermissions();
         $result = $permissions->grantPermission($newUserId, $this->_userBlog, PERMISSION_BLOG_USER);
     }
     $this->notifyEvent(EVENT_POST_USER_ADD, array("user" => &$user));
     $this->_view = new AdminSiteUsersListView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->pr("user_added_ok", $user->getUsername()));
     $this->setCommonData();
     return true;
 }
Example #5
0
    /**

     * creates a new case impersonating a user who has the proper privileges to create new cases

     *

     * @param string $processId

     * @param string $userId

     * @param string $variables

     * @param string $taskId, must be in the starting group.

     * @return $result will return an object

     */

    public function newCaseImpersonate ($processId, $userId, $variables, $taskId = '')

    {

        try {

            if (is_array( $variables )) {

                if (count( $variables ) > 0) {

                    $c = count( $variables );

                    $Fields = $variables;

                } else {

                    if ($c == 0) {

                        $result = new wsResponse( 10, G::loadTranslation( 'ID_ARRAY_VARIABLES_EMPTY' ) );



                        return $result;

                    }

                }

            } else {

                $result = new wsResponse( 10, G::loadTranslation( 'ID_VARIABLES_PARAM_NOT_ARRAY' ) );



                return $result;

            }



            $processes = new Processes();



            if (! $processes->processExists( $processId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_INVALID_PROCESS' ) . " " . $processId . "!!" );



                return $result;

            }



            $user = new Users();



            if (! $user->userExists( $userId )) {

                $result = new wsResponse( 11, G::loadTranslation( 'ID_USER_NOT_REGISTERED' ) . " " . $userId . "!!" );



                return $result;

            }



            $oCase = new Cases();



            $numTasks = 0;

            if ($taskId != '') {

                $aTasks = $processes->getStartingTaskForUser( $processId, null );

                foreach ($aTasks as $task) {

                    if ($task['TAS_UID'] == $taskId) {

                        $arrayTask[0]['TAS_UID'] = $taskId;

                        $numTasks = 1;

                    }

                }

            } else {

                $arrayTask = $processes->getStartingTaskForUser( $processId, null );

                $numTasks = count( $arrayTask );

            }



            if ($numTasks == 1) {

                $case = $oCase->startCase( $arrayTask[0]['TAS_UID'], $userId );

                $caseId = $case['APPLICATION'];

                $caseNumber = $case['CASE_NUMBER'];



                $oldFields = $oCase->loadCase( $caseId );



                $oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields );



                $up_case = $oCase->updateCase( $caseId, $oldFields );



                $result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULLY' ) );



                $result->caseId = $caseId;

                $result->caseNumber = $caseNumber;



                return $result;

            } else {

                if ($numTasks == 0) {

                    $result = new wsResponse( 12, G::loadTranslation( 'ID_NO_STARTING_TASK' ) );



                    return $result;

                }



                if ($numTasks > 1) {

                    $result = new wsResponse( 13, G::loadTranslation( 'ID_MULTIPLE_STARTING_TASKS' ) );



                    return $result;

                }

            }

        } catch (Exception $e) {

            $result = new wsResponse( 100, $e->getMessage() );



            return $result;

        }

    }
Example #6
0
    public function getCompleteDocumentInfo ($appUid, $appDocUid, $docVersion, $docUid, $usrId)
    {
        //require_once ("classes/model/AppDocument.php");
        //require_once ("classes/model/InputDocument.php");
        //require_once ("classes/model/OutputDocument.php");
        //require_once ("classes/model/Users.php");

        //**** start get Doc Info
        $oApp = new Application();
        $oAppDocument = new AppDocument();
        G::LoadClass( 'case' );
        $oCase = new Cases();
        G::LoadClass( 'process' );
        $oProcess = new Process();
        if (($oApp->exists( $appUid )) || ($appUid == "00000000000000000000000000000000")) {
            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = array ('PRO_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
                $row3 = array ('APP_TITLE' => G::LoadTranslation( 'ID_NOT_PROCESS_RELATED' ));
            } else {
                $row1 = $oAppDocument->load( $appDocUid, $docVersion );
                $row2 = $oCase->loadCase( $appUid );
                $row3 = $oProcess->Load( $row2['PRO_UID'] );
            }
            $lastVersion = $oAppDocument->getLastAppDocVersion( $appDocUid, $appUid );

            switch ($row1['APP_DOC_TYPE']) {
                case "OUTPUT":
                    $oOutputDocument = new OutputDocument();

                    $row4 = array();
                    $swOutDocExists = 0;

                    if ($oOutputDocument->OutputExists($docUid)) {
                        $row4 = $oOutputDocument->load($docUid);
                        $swOutDocExists = 1;
                    }

                    if ($swOutDocExists == 0) {
                        $swpdf = 0;
                        $swdoc = 0;

                        $info = pathinfo($oAppDocument->getAppDocFilename());

                        $version = (!empty($docVersion))? "_" . $docVersion : "_1";
                        $outDocPath = PATH_DOCUMENT . G::getPathFromUID($row1["APP_UID"]) . PATH_SEP . "outdocs" . PATH_SEP;

                        if (file_exists($outDocPath . $appDocUid . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".pdf") ||
                            file_exists($outDocPath . $info["basename"] . ".pdf")
                        ) {
                            $swpdf = 1;
                        }

                        if (file_exists($outDocPath . $appDocUid . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . $version . ".doc") ||
                            file_exists($outDocPath . $info["basename"] . ".doc")
                        ) {
                            $swdoc = 1;
                        }

                        if ($swpdf == 1 && $swdoc == 1) {
                            $row4["OUT_DOC_GENERATE"] = "BOTH";
                        } else {
                            if ($swpdf == 1) {
                                $row4["OUT_DOC_GENERATE"] = "PDF";
                            } else {
                                if ($swdoc == 1) {
                                    $row4["OUT_DOC_GENERATE"] = "DOC";
                                } else {
                                    $row4["OUT_DOC_GENERATE"] = "NOFILE";
                                }
                            }
                        }
                    }

                    $versioningEnabled = false; //$row4['OUT_DOC_VERSIONING']; //Only enabled for Input or Attached documents. Need to study the best way for Output docs.

                    switch ($row4['OUT_DOC_GENERATE']) {
                        case "PDF":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = "";
                            break;
                        case "DOC":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLink1 = "";
                            $downloadLabel = ".doc";
                            $downloadLabel1 = "";
                            break;
                        case "BOTH":
                            $downloadLink = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=pdf" . "&random=" . rand();
                            $downloadLink1 = "../cases/cases_ShowOutputDocument?a=" . $appDocUid . "&v=" . $docVersion . "&ext=doc" . "&random=" . rand();
                            $downloadLabel = ".pdf";
                            $downloadLabel1 = ".doc";
                            break;
                        case "NOFILE":
                            $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                            $downloadLink1 = "";
                            $downloadLabel = G::LoadTranslation("ID_DOWNLOAD");
                            $downloadLabel1 = "";
                            break;
                    }

                    if ($swOutDocExists == 0) {
                        $row4 = array();
                    }
                    break;
                case "INPUT":
                    $oInputDocument = new InputDocument();
                    if ($docUid != - 1) {
                        if ($oInputDocument->InputExists( $docUid )) {
                            $row4 = $oInputDocument->load( $docUid );
                            $versioningEnabled = $row4['INP_DOC_VERSIONING'];
                        } else {
                            $row4 = array ();
                            $versioningEnabled = false;
                        }
                        $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                        $downloadLink1 = "";
                        $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                        $downloadLabel1 = "";
                    } else {
                        $row4 = array ();
                        $versioningEnabled = false;
                        $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                        $downloadLink1 = "";
                        $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                        $downloadLabel1 = "";
                    }

                    if (! empty( $row1["APP_DOC_PLUGIN"] )) {
                        $pluginRegistry = &PMPluginRegistry::getSingleton();
                        $pluginName = $row1["APP_DOC_PLUGIN"];
                        $fieldValue = "";

                        if (file_exists( PATH_PLUGINS . $pluginName . ".php" )) {
                            $pluginDetail = $pluginRegistry->getPluginDetails( $pluginName . ".php" );

                            if ($pluginDetail) {
                                if ($pluginDetail->enabled) {
                                    require_once (PATH_PLUGINS . $pluginName . ".php");
                                    $pluginNameClass = $pluginName . "Plugin";
                                    $objPluginClass = new $pluginNameClass( $pluginName );

                                    if (isset( $objPluginClass->sMethodGetUrlDownload ) && ! empty( $objPluginClass->sMethodGetUrlDownload )) {
                                        if (file_exists( PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php" )) {
                                            require_once (PATH_PLUGINS . $pluginName . PATH_SEP . "class." . $pluginName . ".php");
                                            $pluginNameClass = $pluginName . "Class";
                                            $objClass = new $pluginNameClass();

                                            if (method_exists( $objClass, $objPluginClass->sMethodGetUrlDownload )) {
                                                eval( "\$url = \$objClass->" . $objPluginClass->sMethodGetUrlDownload . "(\"" . $row1["APP_DOC_UID"] . "\");" );
                                                $downloadLink = $url;
                                                $fieldValue = $row1["APP_DOC_PLUGIN"];
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        $row1["APP_DOC_PLUGIN"] = $fieldValue;
                    }
                    break;
                default:
                    $row4 = array ();
                    $versioningEnabled = false;
                    $downloadLink = "../cases/cases_ShowDocument?a=" . $appDocUid . "&v=" . $docVersion;
                    $downloadLink1 = "";
                    $downloadLabel = G::LoadTranslation( 'ID_DOWNLOAD' );
                    $downloadLabel1 = "";
                    break;
            }
            $oUser = new Users();
            if (($usrId != "-1") && ($oUser->userExists( $usrId ))) {
                $row5 = $oUser->load( $usrId );
            } else {
                $row5['USR_USERNAME'] = "******";
            }

            //Labels/Links
            $row6 = array ();
            $row6['DELETE_LABEL'] = G::LoadTranslation( 'ID_DELETE' );
            $row6['DOWNLOAD_LABEL'] = $downloadLabel;
            $row6['DOWNLOAD_LINK'] = $downloadLink;
            $row6['DOWNLOAD_LABEL1'] = $downloadLabel1;
            $row6['DOWNLOAD_LINK1'] = $downloadLink1;
            //if(($docVersion>1)&&($row1['APP_DOC_TYPE']!="OUTPUT")){
            if (($docVersion > 1)) {
                $row6['VERSIONHISTORY_LABEL'] = G::LoadTranslation( 'ID_VERSION_HISTORY' );
            }
            if ($versioningEnabled) {
                $row6['NEWVERSION_LABEL'] = G::LoadTranslation( 'ID_NEW_VERSION' );
            }
            $row6['APP_DOC_UID_VERSION'] = $appDocUid . "_" . $docVersion;

            if ($appUid == "00000000000000000000000000000000") {
                //External Files
                $row1['APP_DOC_TYPE'] = G::LoadTranslation( 'ID_EXTERNAL_FILE' );
            }
            //**** End get docinfo
            $infoMerged = array_merge( $row1, $row2, $row3, $row4, $row5, $row6 );

            $sUserUID = $_SESSION['USER_LOGGED'];
            $aObjectPermissions = array ();
            if (isset( $infoMerged['PRO_UID'] )) {
                $aObjectPermissions = $oCase->getAllObjects( $infoMerged['PRO_UID'], $infoMerged['APP_UID'], '', $sUserUID );
            }

            if (! is_array( $aObjectPermissions )) {
                $aObjectPermissions = array ('DYNAFORMS' => array (- 1),
                'INPUT_DOCUMENTS' => array (- 1),
                'OUTPUT_DOCUMENTS' => array (- 1)
                );
            }
            if (! isset( $aObjectPermissions['DYNAFORMS'] )) {
                $aObjectPermissions['DYNAFORMS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['DYNAFORMS'] )) {
                    $aObjectPermissions['DYNAFORMS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['INPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['INPUT_DOCUMENTS'] = array (- 1);
                }
            }
            if (! isset( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
            } else {
                if (! is_array( $aObjectPermissions['OUTPUT_DOCUMENTS'] )) {
                    $aObjectPermissions['OUTPUT_DOCUMENTS'] = array (- 1);
                }
            }
            return array_merge( $infoMerged, $aObjectPermissions );
        }
    }
Example #7
0
File: Users.php Project: VSG24/ccms
 static function submitNewUser($username, $password, $email, $password2 = null)
 {
     if (!registerUsers()) {
         return 5;
     }
     // admin has disabled registering new users
     $email = filter_var($email, FILTER_SANITIZE_EMAIL);
     $username = validateUserName($username) ? $username : false;
     $password = validatePassword($password) ? $password : false;
     if (!$username || !$password) {
         return 1;
         // username or password does not meet the requirements
     }
     if (isset($password2)) {
         $password2 = validatePassword($password2) ? $password2 : false;
         if ($password2 != false) {
             //$password2 = passwordHash($password2);
             if ($password2 != $password) {
                 return 4;
                 // passwords do not match
             }
         } else {
             return 4;
         }
     }
     $password = passwordHash($password);
     $current_datetime = jDateTime::gdate('Y-m-d H:i:s');
     if (Users::userExists($username)) {
         return 2;
         // username already exist
     }
     $activate = md5($email . time());
     $conn = MySQL::open_conn();
     $query = "INSERT INTO c_users (user_login, user_pass, user_email, user_registered, activate) ";
     $query .= "VALUES ('{$username}', '{$password}', '{$email}', '{$current_datetime}', '{$activate}')";
     $res = $conn->query($query);
     if (!$res) {
         return 3;
     }
     // unknown error while creating new user
     $row = $conn->query("SELECT MAX(ID) AS max FROM c_users")->fetch_array();
     if ($row) {
         $id = $row['max'];
     }
     if (shouldConfMail()) {
         $mail_content = replace_template(getDefaultEmailTemplateContent(), getConfEmailTemplateVars($id));
         Email::sendMail($email, $username, getConfMailSubject(), $mail_content);
     }
     return 0;
 }
     throw new Exception(G::LoadTranslation("ID_ERROR_UPLOAD_FILE_CONTACT_ADMINISTRATOR"));
 }
 //load the variables
 if ($processFileType == "pm") {
     G::LoadClass('processes');
     $oProcess = new Processes();
 }
 $path = PATH_DOCUMENT . 'input' . PATH_SEP;
 if ($processFileType == "pm") {
     $oData = $oProcess->getProcessData($path . $filename);
 }
 $importer->throwExceptionIfExistsReservedWordsSql($oData);
 //**cheking if the PRO_CREATE_USER exist**//
 $usrCrtr = $oData->process['PRO_CREATE_USER'];
 $exist = new Users();
 if ($exist->userExists($usrCrtr)) {
     $usrInfo = $exist->getAllInformation($usrCrtr);
     if ($usrInfo['status'] == 'CLOSED') {
         $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
     }
 } else {
     $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
 }
 $Fields['PRO_FILENAME'] = $filename;
 $sProUid = $oData->process['PRO_UID'];
 $oData->process['PRO_UID_OLD'] = $sProUid;
 $result->ExistGroupsInDatabase = 1;
 if (!is_null($optionGroupExistInDatabase)) {
     if ($optionGroupExistInDatabase == 1) {
         $oData->groupwfs = $oProcess->renameExistingGroups($oData->groupwfs);
     } elseif ($optionGroupExistInDatabase == 2) {
Example #9
0
 if ($bp_vip == 0) {
     $vip = 0;
     $vip_start = null;
     $vip_expire = null;
 } elseif ($bp_vip == -1) {
     $vip = -1;
     $vip_start = $current_datetime;
     $vip_expire = null;
 } else {
     $vip = $bp_vip;
     $vip_start = strtotime($current_datetime);
     $vip_expire = strtotime('+' . $vip . ' day', $vip_start);
     $vip_start = $current_datetime;
     $vip_expire = date('Y-m-d H:i:s', $vip_expire);
 }
 if (Users::userExists($username)) {
     goToError('?switch=users#new_user', _e('username_already_exists', '', '', true));
 }
 if (!$username || !$password) {
     goToError('?switch=users#new_user', _e('username_password_wrong', '', '', true));
 }
 if ($bp_role == 'Admin') {
     $role = 4;
 } elseif ($bp_role == 'Super User') {
     $role = 3;
 } elseif ($bp_role == 'Subscriber') {
     $role = 2;
 }
 $query = "INSERT INTO c_users (user_login, user_pass, user_email, user_role, vip_status, vip_start_date, vip_expire_date, user_registered) ";
 $query .= "VALUES ('{$username}', '{$password}', '{$email}', {$role}, {$vip}, '{$vip_start}', '{$vip_expire}', '{$current_datetime}')";
 $res = $conn->query($query);
Example #10
0
 /**
  * Add New Case Impersonate
  *
  * @param string $processUid Unique id of Project
  * @param string $userUid Unique id of User
  * @param string $taskUid Unique id of Case
  * @param array $variables
  *
  * return array Return an array with Task Case
  */
 public function addCaseImpersonate($processUid, $userUid, $taskUid, $variables)
 {
     try {
         \G::LoadClass('wsBase');
         $ws = new \wsBase();
         if ($variables) {
             $variables = array_shift($variables);
         } elseif ($variables == null) {
             $variables = array(array());
         }
         Validator::proUid($processUid, '$pro_uid');
         $user = new \Users();
         if (! $user->userExists( $userUid )) {
             throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('usr_uid')));
         }
         $fields = $ws->newCaseImpersonate($processUid, $userUid, $variables, $taskUid);
         $array = json_decode(json_encode($fields), true);
         if ($array ["status_code"] != 0) {
             if ($array ["status_code"] == 12) {
                 throw (new \Exception(\G::loadTranslation('ID_NO_STARTING_TASK') . '. tas_uid.'));
             } elseif ($array ["status_code"] == 13) {
                 throw (new \Exception(\G::loadTranslation('ID_MULTIPLE_STARTING_TASKS') . '. tas_uid.'));
             }
             throw (new \Exception($array ["message"]));
         } else {
             $array['app_uid'] = $array['caseId'];
             $array['app_number'] = $array['caseNumber'];
             unset($array['status_code']);
             unset($array['message']);
             unset($array['timestamp']);
             unset($array['caseId']);
             unset($array['caseNumber']);
         }
         $oResponse = json_decode(json_encode($array), false);
         //Return
         return $oResponse;
     } catch (\Exception $e) {
         throw $e;
     }
 }
 /**
  * Validate User Uid
  * @var string $usr_uid. Uid for user
  *
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public function validateUsrUid($usr_uid)
 {
     $usr_uid = trim($usr_uid);
     if ($usr_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid', '')));
     }
     $oUsers = new \Users();
     if (!$oUsers->userExists($usr_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('usr_uid', $usr_uid)));
     }
     return $usr_uid;
 }
                 $oData->groupwfs = $oNewGroup;
                 $oData->taskusers = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->taskusers);
                 $oData->objectPermissions = $oProcess->mergeExistingUsers($oBaseGroup, $oNewGroup, $oData->objectPermissions);
             }
         }
         $result->ExistGroupsInDatabase = 0;
     } else {
         if (!($oProcess->checkExistingGroups($oData->groupwfs) > 0)) {
             $result->ExistGroupsInDatabase = 0;
         }
     }
     //replacing a nonexistent user for the current user
     $UsrUid = $oData->process['PRO_CREATE_USER'];
     G::LoadClass('Users');
     $user = new Users();
     if (!$user->userExists($UsrUid)) {
         $oData->process['PRO_CREATE_USER'] = $_SESSION['USER_LOGGED'];
     }
     //!respect of the groups
     if ($result->ExistProcessInDatabase == 0 && $result->ExistGroupsInDatabase == 0) {
         if ($processFileType == "pm") {
             $oProcess->createProcessFromData($oData, $path . $filename);
         }
     }
     //!data ouput
     $result->sNewProUid = $sProUid;
     $result->proFileName = $Fields['PRO_FILENAME'];
 } catch (Exception $e) {
     $result->response = $e->getMessage();
     $result->catchMessage = $e->getMessage();
     $result->success = true;
Example #13
0
    /**
     * Verify if doesn't exists the User in table USERS
     *
     * @param string $userUid               Unique id of User
     * @param string $fieldNameForException Field name for the exception
     *
     * return void Throw exception if doesn't exists the User in table USERS
     */
    public function throwExceptionIfNotExistsUser($userUid, $fieldNameForException)
    {
        try {
            $user = new \Users();

            if (!$user->userExists($userUid)) {
                throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array($fieldNameForException, $userUid)));
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
 public function unique_username($usr)
 {
     $exists = Users::userExists($usr);
     if ($exists) {
         $this->form_validation->set_message('unique_username', 'The Username already exists. Enter another one.');
         return FALSE;
     } else {
         return TRUE;
     }
 }