user and test fixes
This commit is contained in:
@@ -53,7 +53,7 @@ class User extends \Espo\Core\Entities\Person
|
||||
|
||||
public function isRegular()
|
||||
{
|
||||
return $this->get('type') === 'regular';
|
||||
return $this->get('type') === 'regular' || ($this->has('type') && !$this->get('type'));
|
||||
}
|
||||
|
||||
public function isApi()
|
||||
|
||||
@@ -296,7 +296,7 @@ class Tester
|
||||
$userData['password'] = $passwordHash->hash($userData['password']);
|
||||
|
||||
if ($isPortal) {
|
||||
$userData['isPortalUser'] = true;
|
||||
$userData['type'] = 'portal';
|
||||
}
|
||||
|
||||
$user = $entityManager->getEntity('User');
|
||||
|
||||
@@ -197,14 +197,14 @@ class AclTest extends \tests\integration\Core\BaseTestCase
|
||||
];
|
||||
$data = [
|
||||
'id' => $user1->id,
|
||||
'isAdmin' => 1,
|
||||
'type' => 'admin',
|
||||
'teamsIds' => ['id']
|
||||
];
|
||||
$request = $this->createRequest('PATCH', $params, ['CONTENT_TYPE' => 'application/json']);
|
||||
$result = $controllerManager->process('User', 'update', $params, json_encode($data), $request);
|
||||
$resultData = json_decode($result);
|
||||
|
||||
$this->assertTrue(!property_exists($resultData, 'isAdmin') || !$resultData->isAdmin);
|
||||
$this->assertTrue(!property_exists($resultData, 'type') || $resultData->type !== 'admin');
|
||||
$this->assertTrue(
|
||||
!property_exists($resultData, 'teamsIds') || !is_array($resultData->teamsIds) || !in_array('id', $$resultData->teamsIds)
|
||||
);
|
||||
|
||||
@@ -33,6 +33,7 @@ return array(
|
||||
array(
|
||||
'id' => '1',
|
||||
'isAdmin' => true,
|
||||
'type' => 'admin',
|
||||
'userName' => 'admin',
|
||||
'password' => '1',
|
||||
'salutationName' => '',
|
||||
|
||||
@@ -33,6 +33,7 @@ return array(
|
||||
array(
|
||||
'id' => '1',
|
||||
'isAdmin' => true,
|
||||
'type' => 'admin',
|
||||
'userName' => 'admin',
|
||||
'password' => '1',
|
||||
'salutationName' => '',
|
||||
|
||||
Reference in New Issue
Block a user