PMCORE-4147
This commit is contained in:
@@ -133,8 +133,8 @@ class UserTest extends TestCase
|
|||||||
// Set the important fields with an specific value
|
// Set the important fields with an specific value
|
||||||
$this->assertEquals($table->USR_STATUS, 'CLOSED');
|
$this->assertEquals($table->USR_STATUS, 'CLOSED');
|
||||||
$this->assertEquals($table->USR_STATUS_ID, 0);
|
$this->assertEquals($table->USR_STATUS_ID, 0);
|
||||||
$this->assertEquals($table->USR_FIRSTNAME, $usr::DELETE_USER);
|
$this->assertEquals($table->USR_FIRSTNAME, $usr::DELETED_USER);
|
||||||
$this->assertEquals($table->USR_LASTNAME, $usr::DELETE_USER);
|
$this->assertEquals($table->USR_LASTNAME, $usr::DELETED_USER);
|
||||||
// Clean the string fields
|
// Clean the string fields
|
||||||
$this->assertEmpty($table->USR_USERNAME);
|
$this->assertEmpty($table->USR_USERNAME);
|
||||||
$this->assertEmpty($table->USR_EMAIL);
|
$this->assertEmpty($table->USR_EMAIL);
|
||||||
@@ -147,12 +147,9 @@ class UserTest extends TestCase
|
|||||||
$this->assertEmpty($table->USR_CELLULAR);
|
$this->assertEmpty($table->USR_CELLULAR);
|
||||||
$this->assertEmpty($table->USR_ZIP_CODE);
|
$this->assertEmpty($table->USR_ZIP_CODE);
|
||||||
$this->assertEmpty($table->USR_TIME_ZONE);
|
$this->assertEmpty($table->USR_TIME_ZONE);
|
||||||
$this->assertEmpty($table->USR_EXTENDED_ATTRIBUTES_DATA);
|
$this->assertEquals('{}', $table->USR_EXTENDED_ATTRIBUTES_DATA);
|
||||||
// Clean the date fields
|
// Clean the date fields
|
||||||
$this->assertEquals($table->USR_BIRTHDAY, '0000-00-00');
|
$this->assertEquals($table->USR_BIRTHDAY, '0000-00-00');
|
||||||
$this->assertEquals($table->USR_DUE_DATE, '0000-00-00');
|
$this->assertEquals($table->USR_DUE_DATE, '0000-00-00');
|
||||||
// Clean the datetime fields
|
|
||||||
$this->assertEquals($table->USR_DUE_DATE, '0000-00-00 00:00:00');
|
|
||||||
$this->assertEquals($table->USR_DUE_DATE, '0000-00-00 00:00:00');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ class LdapAdvanced
|
|||||||
public $allListOfUsers = [];
|
public $allListOfUsers = [];
|
||||||
private $arrayDepartmentUserSynchronizedChecked = [];
|
private $arrayDepartmentUserSynchronizedChecked = [];
|
||||||
private $arrayUserUpdateChecked = [];
|
private $arrayUserUpdateChecked = [];
|
||||||
const DELETE_USER = 'unknown';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor method
|
* default constructor method
|
||||||
@@ -696,7 +695,7 @@ class LdapAdvanced
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->log($ldapcnn, "User is repeated: Username \"" . $arrayUserData["sUsername"] . "\", DN \"" . $arrayUserData["sDN"] . "\"");
|
$this->log($ldapcnn, "User have repeated: Username \"" . $arrayUserData["sUsername"] . "\", DN \"" . $arrayUserData["sDN"] . "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ use UsersRolesPeer;
|
|||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
const DELETE_USER = 'unknown';
|
const DELETED_USER = 'unknown';
|
||||||
private $arrayFieldDefinition = array(
|
private $arrayFieldDefinition = array(
|
||||||
"USR_UID" => array(
|
"USR_UID" => array(
|
||||||
"type" => "string",
|
"type" => "string",
|
||||||
@@ -1361,12 +1361,8 @@ class User
|
|||||||
try {
|
try {
|
||||||
// Verify data
|
// Verify data
|
||||||
$this->throwExceptionIfNotExistsUser($usrUid, $this->arrayFieldNameForException["usrUid"]);
|
$this->throwExceptionIfNotExistsUser($usrUid, $this->arrayFieldNameForException["usrUid"]);
|
||||||
// Check user admin
|
// Check user admin or guest
|
||||||
if (RBAC::isAdminUserUid($usrUid)) {
|
if (RBAC::isAdminUserUid($usrUid) || RBAC::isGuestUserUid($usrUid)) {
|
||||||
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", [$usrUid]));
|
|
||||||
}
|
|
||||||
// Check user guest
|
|
||||||
if (RBAC::isGuestUserUid($usrUid)) {
|
|
||||||
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", [$usrUid]));
|
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", [$usrUid]));
|
||||||
}
|
}
|
||||||
// Remove the user from groups
|
// Remove the user from groups
|
||||||
@@ -1384,12 +1380,12 @@ class User
|
|||||||
$fields = [
|
$fields = [
|
||||||
'USR_STATUS' => 'CLOSED',
|
'USR_STATUS' => 'CLOSED',
|
||||||
'USR_USERNAME' => '',
|
'USR_USERNAME' => '',
|
||||||
'USR_FIRSTNAME' => self::DELETE_USER,
|
'USR_FIRSTNAME' => self::DELETED_USER,
|
||||||
'USR_LASTNAME' => self::DELETE_USER,
|
'USR_LASTNAME' => self::DELETED_USER,
|
||||||
'USR_EMAIL' => '',
|
'USR_EMAIL' => '',
|
||||||
'USR_DUE_DATE' => '0000-00-00',
|
'USR_DUE_DATE' => '0000-00-00',
|
||||||
'USR_CREATE_DATE' => '0000-00-00 00:00:00',
|
'USR_CREATE_DATE' => '0000-00-00',
|
||||||
'USR_UPDATE_DATE' => '0000-00-00 00:00:00',
|
'USR_UPDATE_DATE' => '0000-00-00',
|
||||||
];
|
];
|
||||||
ModelRbacUsers::where('USR_UID', $usrUid)->update($fields);
|
ModelRbacUsers::where('USR_UID', $usrUid)->update($fields);
|
||||||
$fields = array_merge(
|
$fields = array_merge(
|
||||||
|
|||||||
Reference in New Issue
Block a user