Start to work on solution to sort permissions by module
This commit is contained in:
parent
7eab2570aa
commit
87ec1de78e
@ -45,7 +45,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we should be able to see fiscal year.
|
||||
if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year.
|
||||
accessforbidden();
|
||||
|
||||
$error = 0;
|
||||
@ -112,7 +112,7 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
|
||||
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear);
|
||||
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
|
||||
|
||||
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
|
||||
@ -33,7 +33,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (empty($user->rights->accounting->fiscalyear))
|
||||
if (empty($user->rights->accounting->fiscalyear->write))
|
||||
accessforbidden();
|
||||
|
||||
$error = 0;
|
||||
@ -300,7 +300,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if (! empty($user->rights->accounting->fiscalyear))
|
||||
if (! empty($user->rights->accounting->fiscalyear->write))
|
||||
{
|
||||
/*
|
||||
* Barre d'actions
|
||||
|
||||
@ -32,7 +32,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear)
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
@ -36,7 +36,7 @@ if (empty($conf->accounting->enabled)) {
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear->closure)
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ if (empty($conf->accounting->enabled)) {
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear->closure)
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
|
||||
@ -1173,7 +1173,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
|
||||
// Fiscal year - Not really yet used. In a future will lock some periods.
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
|
||||
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear', 20);
|
||||
$newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20);
|
||||
}
|
||||
|
||||
$newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30);
|
||||
@ -1300,13 +1300,13 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
|
||||
// Closure
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
$newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->closure, '', $mainmenu, 'closure');
|
||||
$newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
|
||||
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_closure/', $leftmenu)) {
|
||||
$newmenu->add("/accountancy/closure/validate.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->closure);
|
||||
$newmenu->add("/accountancy/closure/validate.php?leftmenu=accountancy_closure", $langs->trans("MenuAccountancyValidationMovements"), 2, $user->rights->accounting->fiscalyear->write);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Files
|
||||
if ((! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || ! empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU))
|
||||
{
|
||||
|
||||
@ -181,14 +181,6 @@ class modAccounting extends DolibarrModules
|
||||
$this->rights[$r][5] = '';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 50430;
|
||||
$this->rights[$r][1] = 'Define and close a fiscal year';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'fiscalyear';
|
||||
$this->rights[$r][5] = '';
|
||||
$r++;
|
||||
|
||||
$this->rights[$r][0] = 50401;
|
||||
$this->rights[$r][1] = 'Bind products and invoices with accounting accounts';
|
||||
$this->rights[$r][2] = 'r';
|
||||
@ -197,16 +189,6 @@ class modAccounting extends DolibarrModules
|
||||
$this->rights[$r][5] = 'write';
|
||||
$r++;
|
||||
|
||||
/*
|
||||
$this->rights[$r][0] = 50402;
|
||||
$this->rights[$r][1] = 'Make binding with products and invoices';
|
||||
$this->rights[$r][2] = 'r';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'ventilation';
|
||||
$this->rights[$r][5] = 'dispatch_advanced';
|
||||
$r++;
|
||||
*/
|
||||
|
||||
$this->rights[$r][0] = 50411;
|
||||
$this->rights[$r][1] = 'Read operations in Ledger';
|
||||
$this->rights[$r][2] = 'r';
|
||||
|
||||
@ -49,6 +49,8 @@ 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_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL;
|
||||
ALTER TABLE llx_bom_bomline ADD COLUMN position integer NOT NULL DEFAULT 0;
|
||||
ALTER TABLE llx_bom_bomline DROP COLUMN rank;
|
||||
|
||||
@ -22,6 +22,7 @@ create table llx_rights_def
|
||||
id integer NOT NULL,
|
||||
libelle varchar(255),
|
||||
module varchar(64),
|
||||
module_position integer NOT NULL DEFAULT 0,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
perms varchar(50),
|
||||
subperms varchar(50),
|
||||
|
||||
@ -917,7 +917,7 @@ Permission50414=Delete operations in ledger
|
||||
Permission50415=Delete all operations by year and journal in ledger
|
||||
Permission50418=Export operations of the ledger
|
||||
Permission50420=Report and export reports (turnover, balance, journals, ledger)
|
||||
Permission50430=Define and close a fiscal period
|
||||
Permission50430=Define fiscal periods. Validate transactions and close fiscal periods.
|
||||
Permission50440=Manage chart of accounts, setup of accountancy
|
||||
Permission51001=Read assets
|
||||
Permission51002=Create/Update assets
|
||||
|
||||
@ -3481,7 +3481,7 @@ div.info {
|
||||
padding-left: 10px;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 8px;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
margin: 1em 0em 1em 0em;
|
||||
background: #eff8fc;
|
||||
}
|
||||
|
||||
@ -3492,7 +3492,7 @@ div.warning {
|
||||
padding-left: 10px;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 8px;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
margin: 1em 0em 1em 0em;
|
||||
background: #fcf8e3;
|
||||
}
|
||||
div.warning a, div.info a, div.error a {
|
||||
@ -3506,7 +3506,7 @@ div.error {
|
||||
padding-left: 10px;
|
||||
padding-right: 4px;
|
||||
padding-bottom: 8px;
|
||||
margin: 0.5em 0em 0.5em 0em;
|
||||
margin: 1em 0em 1em 0em;
|
||||
background: #EFCFCF;
|
||||
}
|
||||
|
||||
|
||||
@ -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, r.id";
|
||||
$sql.= " ORDER BY r.module_position, r.module, r.id";
|
||||
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
@ -331,11 +331,15 @@ if ($result)
|
||||
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
}
|
||||
print '<td></td>';
|
||||
}else {
|
||||
print '<td></td><td></td>';
|
||||
print '<td> </td>';
|
||||
} else {
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
print '<td></td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user