Fix travis
This commit is contained in:
parent
7e7d419e2d
commit
fec9a96ad1
@ -137,7 +137,7 @@ class User extends CommonObject
|
||||
|
||||
public $default_c_exp_tax_cat;
|
||||
public $default_range;
|
||||
|
||||
|
||||
public $fields=array(
|
||||
'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'lastname'=>array('type'=>'varchar(50)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
@ -434,7 +434,7 @@ class User extends CommonObject
|
||||
/**
|
||||
* Add a right to the user
|
||||
*
|
||||
* @param int $rid id of permission to add
|
||||
* @param int $rid Id of permission to add or 0 to add several permissions
|
||||
* @param string $allmodule Add all permissions of module $allmodule
|
||||
* @param string $allperms Add all permissions of module $allmodule, subperms $allperms only
|
||||
* @param int $entity Entity to use
|
||||
@ -679,24 +679,28 @@ class User extends CommonObject
|
||||
/**
|
||||
* Load permissions granted to user into object user
|
||||
*
|
||||
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
||||
* @param string $moduletag Limit permission for a particular module ('' by default means load all permissions)
|
||||
* @param int $forcereload Force reload of permissions even if they were already loaded (ignore cache)
|
||||
* @return void
|
||||
* @see clearrights, delrights, addrights
|
||||
*/
|
||||
function getrights($moduletag='')
|
||||
function getrights($moduletag='', $forcereload=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag])
|
||||
if (empty($forcereload))
|
||||
{
|
||||
// Le fichier de ce module est deja charge
|
||||
return;
|
||||
}
|
||||
if ($moduletag && isset($this->_tab_loaded[$moduletag]) && $this->_tab_loaded[$moduletag])
|
||||
{
|
||||
// Rights for this module are already loaded, so we leave
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->all_permissions_are_loaded)
|
||||
{
|
||||
// Si les permissions ont deja ete charge pour ce user, on quitte
|
||||
return;
|
||||
if ($this->all_permissions_are_loaded)
|
||||
{
|
||||
// We already loaded all rights for this user, so we leave
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Recuperation des droits utilisateurs + recuperation des droits groupes
|
||||
|
||||
@ -31,7 +31,7 @@ require_once dirname(__FILE__).'/../../htdocs/supplier_proposal/class/supplier_p
|
||||
|
||||
if (empty($user->id))
|
||||
{
|
||||
print "Load permissions for admin user nb 1\n";
|
||||
print "Load permissions for user nb 1 (that should be admin)\n";
|
||||
$user->fetch(1);
|
||||
|
||||
//$user->addrights(0, 'supplier_proposal');
|
||||
@ -110,7 +110,12 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
print __METHOD__."\n";
|
||||
//print $db->getVersion()."\n";
|
||||
|
||||
// Set permission not set by default sql sample
|
||||
$user->addrights(0, 'supplier_proposal');
|
||||
$user->getrights('supplier_proposal', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
@ -134,10 +139,6 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
var_dump($conf->supplier_proposal->enabled);
|
||||
var_dump($user->rights->supplier_proposal);
|
||||
$user->rights->supplier_proposal->creer = 1; // Not set after the reload of module done in 7.0
|
||||
|
||||
$localobject=new SupplierProposal($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
@ -214,8 +215,6 @@ class SupplierProposalTest extends PHPUnit_Framework_TestCase
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$user->rights->supplier_proposal->creer = 1; // Not set after the reload of module done in 7.0
|
||||
|
||||
$result=$localobject->valid($user);
|
||||
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user