Merged in feature/PMCORE-2887 (pull request #7863)
PMCORE-2887 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
cac3e46327
@@ -1,12 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\GroupUser;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
use ProcessMaker\Model\RbacRoles;
|
||||
use ProcessMaker\Model\RbacUsers;
|
||||
use ProcessMaker\Model\User;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Util\ElementTranslation;
|
||||
use ProcessMaker\Validation\SqlBlacklist;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* ProcessMaker has made a number of its PHP functions available be used in triggers and conditions.
|
||||
@@ -4013,6 +4018,202 @@ function PMFSendMessageToGroup(
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method
|
||||
*
|
||||
* Create a new user
|
||||
*
|
||||
* @name PMFNewUser
|
||||
* @label PMF New User
|
||||
*
|
||||
* @param string | $username
|
||||
* @param string | $password
|
||||
* @param string | $firstname
|
||||
* @param string | $lastname
|
||||
* @param string | $email
|
||||
* @param string | $role
|
||||
* @param string | $dueDate = null
|
||||
* @param string | $status = null
|
||||
* @param string | $group =null
|
||||
*
|
||||
* @return array | $response | Response
|
||||
*/
|
||||
function PMFNewUser(
|
||||
$username,
|
||||
$password,
|
||||
$firstname,
|
||||
$lastname,
|
||||
$email,
|
||||
$role,
|
||||
$dueDate = null,
|
||||
$status = null,
|
||||
$group = null)
|
||||
{
|
||||
if (empty($username)) {
|
||||
throw new Exception(G::LoadTranslation('ID_USERNAME_REQUIRED'));
|
||||
}
|
||||
|
||||
if (empty($firstname)) {
|
||||
throw new Exception(G::LoadTranslation('ID_MSG_ERROR_USR_FIRSTNAME'));
|
||||
}
|
||||
|
||||
if (empty($lastname)) {
|
||||
throw new Exception(G::LoadTranslation('ID_MSG_ERROR_USR_LASTNAME'));
|
||||
}
|
||||
|
||||
if (empty($password)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PASSWD_REQUIRED'));
|
||||
}
|
||||
|
||||
if (empty($email)) {
|
||||
throw new Exception(G::LoadTranslation('ID_EMAIL_IS_REQUIRED'));
|
||||
}
|
||||
|
||||
if (!empty($dueDate) && $dueDate != 'null' && $dueDate != '' && $dueDate) {
|
||||
if (!preg_match("/^(\d{4})-(\d{2})-(\d{2})$/", $dueDate, $match)) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_DATA'));
|
||||
} else {
|
||||
$dueDate = mktime(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
intval($match[2]),
|
||||
intval($match[3]),
|
||||
intval($match[1])
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$expirationDate = 1;
|
||||
$envFile = PATH_CONFIG . 'env.ini';
|
||||
if (file_exists($envFile)) {
|
||||
$sysConf = System::getSystemConfiguration($envFile);
|
||||
if (isset($sysConf['expiration_year']) && $sysConf['expiration_year'] > 0) {
|
||||
$expirationDate = abs($sysConf['expiration_year']);
|
||||
}
|
||||
}
|
||||
$dueDate = mktime(0, 0, 0, 12, 31, date("Y") + $expirationDate);
|
||||
}
|
||||
|
||||
if (!empty($status) && $status != null && $status != "" && $status) {
|
||||
if ($status != "ACTIVE" && $status != "INACTIVE" && $status != "VACATION") {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_DATA'));
|
||||
}
|
||||
} else {
|
||||
$status = "ACTIVE";
|
||||
}
|
||||
|
||||
$rolUid = RbacRoles::getRolUidByCode($role);
|
||||
if (empty($rolUid)) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_ROLE'));
|
||||
}
|
||||
|
||||
$userProperties = new UsersProperties();
|
||||
$validation = $userProperties->validatePassword($password, '', 0);
|
||||
|
||||
if (in_array('ID_PPP_MAXIMUM_LENGTH', $validation)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PASSWORD_SURPRASES'));
|
||||
}
|
||||
|
||||
if (in_array('ID_PPP_MINIMUM_LENGTH', $validation)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PASSWORD_BELOW'));
|
||||
}
|
||||
|
||||
if (in_array('ID_PPP_NUMERICAL_CHARACTER_REQUIRED', $validation)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PPP_NUMERICAL_CHARACTER_REQUIRED'));
|
||||
}
|
||||
|
||||
if (in_array('ID_PPP_UPPERCASE_CHARACTER_REQUIRED', $validation)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PPP_UPPERCASE_CHARACTER_REQUIRED'));
|
||||
}
|
||||
|
||||
if (in_array('ID_PPP_SPECIAL_CHARACTER_REQUIRED', $validation)) {
|
||||
throw new Exception(G::LoadTranslation('ID_PPP_SPECIAL_CHARACTER_REQUIRED'));
|
||||
}
|
||||
|
||||
if (RbacUsers::verifyUsernameExists($username)) {
|
||||
throw new Exception(G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS'));
|
||||
}
|
||||
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
throw new Exception(G::LoadTranslation('ID_EMAIL_INVALID'));
|
||||
}
|
||||
|
||||
if (!is_null($group) && $group != '' && !Groupwf::verifyGroupExists($group)) {
|
||||
throw new Exception(G::LoadTranslation('ID_GROUP_DOESNT_EXIST'));
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case 'ACTIVE':
|
||||
$statusId = 1;
|
||||
break;
|
||||
case 'INACTIVE':
|
||||
$statusId = 0;
|
||||
break;
|
||||
case 'VACATION':
|
||||
$statusId = 0;
|
||||
break;
|
||||
}
|
||||
$usrUid = G::generateUniqueID();
|
||||
|
||||
$data = [
|
||||
'USR_UID' => $usrUid,
|
||||
'USR_USERNAME' => $username,
|
||||
'USR_PASSWORD' => Bootstrap::hashPassword($password),
|
||||
'USR_FIRSTNAME' => $firstname,
|
||||
'USR_LASTNAME' => $lastname,
|
||||
'USR_EMAIL' => $email,
|
||||
'USR_DUE_DATE' => date('Y-m-d', $dueDate),
|
||||
'USR_CREATE_DATE' => date("Y-m-d H:i:s"),
|
||||
'USR_UPDATE_DATE' => date("Y-m-d H:i:s"),
|
||||
'USR_STATUS' => $status,
|
||||
'USR_AUTH_TYPE' => '',
|
||||
'UID_AUTH_SOURCE' => '',
|
||||
'USR_AUTH_USER_DN' => "",
|
||||
'USR_AUTH_SUPERVISOR_DN' => "",
|
||||
'USR_STATUS_ID' => $statusId,
|
||||
'USR_COUNTRY' => '',
|
||||
'USR_CITY' => '',
|
||||
'USR_LOCATION' => '',
|
||||
'USR_ADDRESS' => '',
|
||||
'USR_PHONE' => '',
|
||||
'USR_FAX' => '',
|
||||
'USR_CELLULAR' => '',
|
||||
'USR_ZIP_CODE' => '',
|
||||
'DEP_UID' => '',
|
||||
'USR_POSITION' => '',
|
||||
'USR_RESUME' => '',
|
||||
'ROL_CODE' => $role,
|
||||
'ROL_UID' => $rolUid['ROL_UID']
|
||||
];
|
||||
|
||||
RbacUsers::createUser($data);
|
||||
$usrId = User::createUser($data);
|
||||
|
||||
$data['USR_ID'] = $usrId;
|
||||
|
||||
if (!is_null($group) && $group != '') {
|
||||
$grpId = Groupwf::getGroupId($group);
|
||||
$data['GRP_ID'] = $grpId['GRP_ID'];
|
||||
GroupUser::assignUserToGroup($usrUid, $usrUid, $group, $grpId['GRP_ID']);
|
||||
}
|
||||
|
||||
$response = [
|
||||
'userUid' => $data['USR_UID'],
|
||||
'userId' => $data['USR_ID'],
|
||||
'username' => $data['USR_USERNAME'],
|
||||
'password' => $data['USR_PASSWORD'],
|
||||
'firstname' => $data['USR_FIRSTNAME'],
|
||||
'lastname' => $data['USR_LASTNAME'],
|
||||
'email' => $data['USR_EMAIL'],
|
||||
'role' => $data['ROL_CODE'],
|
||||
'dueDate' => $data['USR_DUE_DATE'],
|
||||
'status' => $data['USR_STATUS'],
|
||||
'groupUid' => $group
|
||||
];
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
//Start - Private functions
|
||||
|
||||
|
||||
|
||||
@@ -457,6 +457,12 @@ msgstr "The mail is invalid"
|
||||
msgid "Mail To is required, or uncheck the Send a Test Mail option"
|
||||
msgstr "Mail To is required, or uncheck the Send a Test Mail option"
|
||||
|
||||
# TRANSLATION
|
||||
# JAVASCRIPT/ID_EMAIL_IS_REQUIRED
|
||||
#: JAVASCRIPT/ID_EMAIL_IS_REQUIRED
|
||||
msgid "Email is required"
|
||||
msgstr "Email is required"
|
||||
|
||||
# TRANSLATION
|
||||
# JAVASCRIPT/ID_EMPTY_NODENAME
|
||||
#: JAVASCRIPT/ID_EMPTY_NODENAME
|
||||
@@ -21197,6 +21203,12 @@ msgstr "The current password is incorrect"
|
||||
msgid "Password is longer than the maximum allowed length"
|
||||
msgstr "Password is longer than the maximum allowed length"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PASSWORD_BELOW
|
||||
#: LABEL/ID_PASSWORD_BELOW
|
||||
msgid "Password is below than the maximum allowed length"
|
||||
msgstr "Password is below than the maximum allowed length"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_PASSWORD_TESTING
|
||||
#: LABEL/ID_PASSWORD_TESTING
|
||||
@@ -27881,6 +27893,12 @@ msgstr "Reassign to:"
|
||||
msgid "The row '{USR_UID}' in table USER doesn't exist!"
|
||||
msgstr "The row '{USR_UID}' in table USER doesn't exist!"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_GROUP_DOESNT_EXIST
|
||||
#: LABEL/ID_GROUP_DOESNT_EXIST
|
||||
msgid "The group '{GRP_UID}' doesn't exist!"
|
||||
msgstr "The group '{GRP_UID}' doesn't exist!"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_USER_WITH_ROLE
|
||||
#: LABEL/ID_USER_WITH_ROLE
|
||||
|
||||
@@ -56870,6 +56870,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'JAVASCRIPT','ID_EDIT_STAGES_MAP','en','Edit Stages Map','2014-01-15') ,
|
||||
( 'JAVASCRIPT','ID_EMAIL_INVALID','en','The mail is invalid','2014-01-15') ,
|
||||
( 'JAVASCRIPT','ID_EMAIL_REQUIRED','en','Mail To is required, or uncheck the Send a Test Mail option','2014-01-15') ,
|
||||
( 'JAVASCRIPT','ID_EMAIL_IS_REQUIRED','en','Email is required','2021-04-08') ,
|
||||
( 'JAVASCRIPT','ID_EMPTY_NODENAME','en','The field name contains spaces or it''s empty!','2014-01-15') ,
|
||||
( 'JAVASCRIPT','ID_ENABLE_WORKSPACE_CONFIRM','en','Do you want enable the selected workspace?','2014-01-15') ,
|
||||
( 'JAVASCRIPT','ID_END_OF_PROCESS','en','End of process','2014-01-15') ,
|
||||
@@ -60429,6 +60430,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_PASSWORD_CURRENT_ENTER','en','Enter the current password','2014-01-15') ,
|
||||
( 'LABEL','ID_PASSWORD_CURRENT_INCORRECT','en','The current password is incorrect','2014-01-15') ,
|
||||
( 'LABEL','ID_PASSWORD_SURPRASES','en','Password is longer than the maximum allowed length','2015-01-16') ,
|
||||
( 'LABEL','ID_PASSWORD_BELOW','en','Password is below than the maximum allowed length','2021-04-08') ,
|
||||
( 'LABEL','ID_PASSWORD_TESTING','en','Testing password','2014-01-15') ,
|
||||
( 'LABEL','ID_PATH','en','Path','2014-01-15') ,
|
||||
( 'LABEL','ID_PAUSE','en','Pause','2014-01-15') ,
|
||||
@@ -61608,6 +61610,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_USER_SAVE_FAIL','en','Failed saving User Assigned to Task','2014-01-15') ,
|
||||
( 'LABEL','ID_USER_TO_REASSIGN','en','Reassign to:','2014-01-15') ,
|
||||
( 'LABEL','ID_USER_UID_DOESNT_EXIST','en','The row ''{USR_UID}'' in table USER doesn''t exist!','2014-01-15') ,
|
||||
( 'LABEL','ID_GROUP_DOESNT_EXIST','en','The group ''{GRP_UID}'' doesn''t exist!','2021-04-08') ,
|
||||
( 'LABEL','ID_USER_WITH_ROLE','en','Users with role','2014-01-15') ,
|
||||
( 'LABEL','ID_USE_ALPHANUMERIC_CHARACTERS_INCLUDING','en','Please just use alphanumeric characters including: {0}','2020-12-22') ,
|
||||
( 'LABEL','ID_USE_LANGUAGE_URL','en','Use the language of URL','2014-08-08') ,
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Exception;
|
||||
use G;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ProcessMaker\Model\Groupwf;
|
||||
use ProcessMaker\Model\RbacUsers;
|
||||
|
||||
class GroupUser extends Model
|
||||
{
|
||||
@@ -57,5 +61,57 @@ class GroupUser extends Model
|
||||
|
||||
return $groups;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a user is already assigned to a group
|
||||
*
|
||||
* @param int $usrId
|
||||
* @param int $grpId
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function verifyUserIsInGroup($usrId, $grpId)
|
||||
{
|
||||
$query = GroupUser::select()->where('GRP_ID', $grpId)->where('USR_ID', $usrId);
|
||||
if (empty($query->get()->values()->toArray())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign user to group
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @param int $usrId
|
||||
* @param string $grpUid
|
||||
* @param int $grpId
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function assignUserToGroup($usrUid, $usrId, $grpUid, $grpId)
|
||||
{
|
||||
if (!RbacUsers::verifyUserExists($usrUid)) {
|
||||
return ['message' => G::loadTranslation('ID_USER_NOT_REGISTERED_SYSTEM')];
|
||||
}
|
||||
if (!Groupwf::verifyGroupExists($grpUid)) {
|
||||
return ['message' => G::loadTranslation('ID_GROUP_NOT_REGISTERED_SYSTEM')];
|
||||
}
|
||||
if (GroupUser::verifyUserIsInGroup($usrId, $grpId)) {
|
||||
return ['message' => G::loadTranslation('ID_USER_ALREADY_EXISTS_GROUP')];
|
||||
}
|
||||
|
||||
try {
|
||||
$data = [
|
||||
'GRP_UID' => $grpUid,
|
||||
'GRP_ID' => $grpId,
|
||||
'USR_UID' => $usrUid,
|
||||
'USR_ID' => $usrId,
|
||||
];
|
||||
GroupUser::insert($data);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception("Error: {$e->getMessage()}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,5 +42,31 @@ class Groupwf extends Model
|
||||
{
|
||||
return $query->where('GRP_UID', $uid);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if group exists
|
||||
*
|
||||
* @param string $grpUid
|
||||
* @return boolean
|
||||
*/
|
||||
public static function verifyGroupExists($grpUid)
|
||||
{
|
||||
$query = Groupwf::select()->group($grpUid);
|
||||
if (empty($query->get()->values()->toArray())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get group Id
|
||||
*
|
||||
* @param string $grpUid
|
||||
* @return array
|
||||
*/
|
||||
public static function getGroupId($grpUid)
|
||||
{
|
||||
$query = Groupwf::select('GRP_ID')->where('GRP_UID', $grpUid);
|
||||
return $query->get()->first()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,22 @@ class RbacRoles extends Model
|
||||
protected $table = 'RBAC_ROLES';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Get rol Uid by code
|
||||
*
|
||||
* @param string $rolCode
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getRolUidByCode($rolCode)
|
||||
{
|
||||
$query = RbacRoles::select('ROL_UID')->where('ROL_CODE', $rolCode);
|
||||
$query = $query->get()->first();
|
||||
|
||||
if (is_null($query)) {
|
||||
return [];
|
||||
} else {
|
||||
return $query->toArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,77 @@
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ProcessMaker\Model\RbacUsersRoles;
|
||||
|
||||
class RbacUsers extends Model
|
||||
{
|
||||
protected $table = 'RBAC_USERS';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Create a new user
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function createUser($data)
|
||||
{
|
||||
try {
|
||||
$dataInsert = [
|
||||
'USR_UID' => $data['USR_UID'],
|
||||
'USR_USERNAME' => $data['USR_USERNAME'],
|
||||
'USR_PASSWORD' => $data['USR_PASSWORD'],
|
||||
'USR_FIRSTNAME' => $data['USR_FIRSTNAME'],
|
||||
'USR_LASTNAME' => $data['USR_LASTNAME'],
|
||||
'USR_EMAIL' => $data['USR_EMAIL'],
|
||||
'USR_DUE_DATE' => $data['USR_DUE_DATE'],
|
||||
'USR_CREATE_DATE' => $data['USR_CREATE_DATE'],
|
||||
'USR_UPDATE_DATE' => $data['USR_UPDATE_DATE'],
|
||||
'USR_STATUS' => $data['USR_STATUS_ID'],
|
||||
'USR_AUTH_TYPE' => $data['USR_AUTH_TYPE'],
|
||||
'UID_AUTH_SOURCE' => $data['UID_AUTH_SOURCE'],
|
||||
'USR_AUTH_USER_DN' => $data['USR_AUTH_USER_DN'],
|
||||
'USR_AUTH_SUPERVISOR_DN' => $data['USR_AUTH_SUPERVISOR_DN'],
|
||||
];
|
||||
RbacUsers::insert($dataInsert);
|
||||
RbacUsersRoles::assignRolToUser($data['USR_UID'], $data['ROL_UID']);
|
||||
} catch (Exception $e) {
|
||||
throw new Exception("Error: {$e->getMessage()}.");
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if username exists
|
||||
*
|
||||
* @param string $username
|
||||
* @return boolean
|
||||
*/
|
||||
public static function verifyUsernameExists($username)
|
||||
{
|
||||
$query = RbacUsers::select()->where('USR_USERNAME', $username);
|
||||
$result = $query->get()->values()->toArray();
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if user exists
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @return boolean
|
||||
*/
|
||||
public static function verifyUserExists($usrUid)
|
||||
{
|
||||
$query = RbacUsers::select()->where('USR_UID', $usrUid);
|
||||
if (empty($query->get()->values()->toArray())) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,4 +9,19 @@ class RbacUsersRoles extends Model
|
||||
protected $table = 'RBAC_USERS_ROLES';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Assign rol to user
|
||||
*
|
||||
* @param string $userUid
|
||||
* @param string $rolUid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function assignRolToUser($userUid, $rolUid)
|
||||
{
|
||||
RbacUsersRoles::insert([
|
||||
'USR_UID' => $userUid,
|
||||
'ROL_UID' => $rolUid
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,49 @@ class User extends Model
|
||||
return $this->belongsTo(GroupUser::class, 'USR_UID', 'USR_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a user
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return integer
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function createUser($data)
|
||||
{
|
||||
try {
|
||||
$usrData = [
|
||||
'USR_UID' => $data['USR_UID'],
|
||||
'USR_USERNAME' => $data['USR_USERNAME'],
|
||||
'USR_PASSWORD' => $data['USR_PASSWORD'],
|
||||
'USR_FIRSTNAME' => $data['USR_FIRSTNAME'],
|
||||
'USR_LASTNAME' => $data['USR_LASTNAME'],
|
||||
'USR_EMAIL' => $data['USR_EMAIL'],
|
||||
'USR_DUE_DATE' => $data['USR_DUE_DATE'],
|
||||
'USR_CREATE_DATE' => $data['USR_CREATE_DATE'],
|
||||
'USR_UPDATE_DATE' => $data['USR_UPDATE_DATE'],
|
||||
'USR_STATUS' => $data['USR_STATUS'],
|
||||
'USR_STATUS_ID' => $data['USR_STATUS_ID'],
|
||||
'USR_COUNTRY' => $data['USR_COUNTRY'],
|
||||
'USR_CITY' => $data['USR_CITY'],
|
||||
'USR_LOCATION' => $data['USR_LOCATION'],
|
||||
'USR_ADDRESS' => $data['USR_ADDRESS'],
|
||||
'USR_PHONE' => $data['USR_PHONE'],
|
||||
'USR_FAX' => $data['USR_FAX'],
|
||||
'USR_CELLULAR' => $data['USR_CELLULAR'],
|
||||
'USR_ZIP_CODE' => $data['USR_ZIP_CODE'],
|
||||
'DEP_UID' => $data['DEP_UID'],
|
||||
'USR_POSITION' => $data['USR_POSITION'],
|
||||
'USR_RESUME' => $data['USR_RESUME'],
|
||||
'USR_ROLE' => $data['ROL_CODE']
|
||||
];
|
||||
$usrId = User::insertGetId($usrData);
|
||||
return $usrId;
|
||||
} catch(Exception $e) {
|
||||
throw new Exception("Error: {$e->getMessage()}.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope for query to get the user by USR_UID
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user