Fixing style errors.

This commit is contained in:
stickler-ci 2022-06-09 11:20:59 +00:00
parent e729d76833
commit 7b3fe948a0
2 changed files with 10 additions and 10 deletions

View File

@ -703,7 +703,7 @@ class User extends CommonObject
$moduleRightsMapping = array(
'product' => 'produit', // We must check $user->rights->produit...
);
$rightsPath = $module;
if (!empty($moduleRightsMapping[$rightsPath])) {
$rightsPath = $moduleRightsMapping[$rightsPath];
@ -732,13 +732,13 @@ class User extends CommonObject
}
if ($permlevel1 == 'recruitmentcandidature') {
$permlevel1 = 'recruitmentjobposition';
}
}
//var_dump($module.' '.$permlevel1.' '.$permlevel2. ' '. $rightsPath);
//var_dump($this->rights);
if (empty($rightsPath) || empty($this->rights) || empty($this->rights->$rightsPath) || empty($permlevel1)) {
return 0;
}
if ($permlevel2) {
if (!empty($this->rights->$rightsPath->$permlevel1)) {
if (!empty($this->rights->$rightsPath->$permlevel1->$permlevel2)) {

View File

@ -263,11 +263,11 @@ class UserTest extends PHPUnit\Framework\TestCase
/**
* testUserHasRight
*
*
* @param User $localobject User
* @return void
*/
public function testUserHasRight()
{
global $conf,$user,$langs,$db;
@ -282,17 +282,17 @@ class UserTest extends PHPUnit\Framework\TestCase
*/
print __METHOD__." id=". $user->id ."\n";
//$this->assertNotEquals($user->date_creation, '');
$user->addrights(0, 'supplier_proposal');
$this->assertEquals($user->hasRight('member', ''), 0);
//$this->assertNotEquals($user->date_creation, '');
$user->addrights(0, 'supplier_proposal');
$this->assertEquals($user->hasRight('member', ''), 0);
$this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('product', 'member', 'read'), 0);
$this->assertEquals($user->hasRight('member', 'member'), 0);$this->assertEquals($user->hasRight('produit', 'member', 'read'), 0);
$user->clearrights();
//print __METHOD__. $user->hasRight('module', 'level11');
return $user;
}
/**
* testUserSetPassword
*