mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Work on sort of permission per family+module
This commit is contained in:
parent
de396dc9b3
commit
005b1b12c4
|
|
@ -50,6 +50,7 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
|
|||
-- For v11
|
||||
|
||||
ALTER TABLE llx_rights_def ADD COLUMN module_position INTEGER NOT NULL DEFAULT 0;
|
||||
ALTER TABLE llx_rights_def ADD COLUMN family_position INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
ALTER TABLE llx_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ create table llx_rights_def
|
|||
libelle varchar(255),
|
||||
module varchar(64),
|
||||
module_position integer NOT NULL DEFAULT 0,
|
||||
family_position integer NOT NULL DEFAULT 0,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
perms varchar(50),
|
||||
subperms varchar(50),
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
|||
$sql.= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql.= " AND r.entity = " . $entity;
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql.= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is disable
|
||||
$sql.= " ORDER BY r.module_position, r.module, r.id";
|
||||
$sql.= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
|
|
@ -308,12 +308,16 @@ if ($result)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Fix field module_position in database if value is still zero
|
||||
// Save field module_position in database if value is still zero
|
||||
if (empty($obj->module_position))
|
||||
{
|
||||
if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0))
|
||||
{
|
||||
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def set module_position = ".$modules[$obj->module]->module_position;
|
||||
// TODO Define familyposition
|
||||
$family = $modules[$obj->module]->family_position;
|
||||
$familyposition = 0;
|
||||
$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."rights_def SET module_position = ".$modules[$obj->module]->module_position.",";
|
||||
$sqlupdate.= " family_position = ".$familyposition;
|
||||
$sqlupdate.= " WHERE module_position = 0 AND module = '".$db->escape($obj->module)."'";
|
||||
$db->query($sqlupdate);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user