Update perms

This commit is contained in:
aspangaro 2014-08-28 06:48:22 +02:00
parent d03763f6c3
commit add4528e6c
12 changed files with 51 additions and 30 deletions

View File

@ -194,7 +194,7 @@ if ($result) {
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($user->rights->accountingex->admin) { if ($user->admin) {
print '<a href="./card.php?action=update&id=' . $obj->rowid . '">'; print '<a href="./card.php?action=update&id=' . $obj->rowid . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;'; print '</a>&nbsp;';

View File

@ -273,13 +273,13 @@ if ($action == 'create') {
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($user->rights->accountingex->admin) { if ($user->admin) {
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
} else { } else {
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>'; print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Modify') . '</a>';
} }
if ($user->rights->accountingex->admin) { if ($user->admin) {
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
} else { } else {
print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>'; print '<a class="butActionRefused" href="#" title="' . dol_escape_htmltag($langs->trans("NotAllowed")) . '">' . $langs->trans('Delete') . '</a>';

View File

@ -44,7 +44,7 @@ $langs->load("accounting");
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');
@ -320,7 +320,7 @@ if ($action == 'create') {
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
if ($user->rights->accountingex->access) { if ($user->rights->accounting->access) {
print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">'; print '<input type="submit" class="button" value="' . $langs->trans("Update") . '">';
} }
print '</form>'; print '</form>';
@ -335,7 +335,7 @@ if ($action == 'create') {
print '<td>' . $line->sens . '</td>'; print '<td>' . $line->sens . '</td>';
print '<td>'; print '<td>';
if ($user->rights->accoutingex->access) { if ($user->rights->accouting->access) {
print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">'; print '<a href="./card.php?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '">';
print img_edit(); print img_edit();
print '</a>&nbsp;'; print '</a>&nbsp;';

View File

@ -52,7 +52,7 @@ $account_parent = GETPOST('account_parent');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountancy->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);

View File

@ -74,7 +74,7 @@ $action = GETPOST('action');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
/* /*

View File

@ -71,7 +71,7 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -45,7 +45,7 @@ $langs->load("accountancy");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
llxHeader('', 'Journaux', ''); llxHeader('', 'Journaux', '');

View File

@ -64,7 +64,7 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -65,7 +65,7 @@ $date_endyear = GETPOST('date_endyear');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$action = GETPOST('action'); $action = GETPOST('action');

View File

@ -53,7 +53,7 @@ $langs->load("accountancy");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);

View File

@ -54,7 +54,7 @@ $mesCasesCochees = GETPOST('mesCasesCochees', 'array');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accountingex->access) if (! $user->rights->accounting->access)
accessforbidden(); accessforbidden();
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);

View File

@ -54,7 +54,7 @@ class modAccounting extends DolibarrModules
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
$this->special = 0; $this->special = 0;
$this->picto = 'accountingex@accountingex'; $this->picto = 'accounting';
// Defined if the directory /mymodule/inc/triggers/ contains triggers or not // Defined if the directory /mymodule/inc/triggers/ contains triggers or not
// $this->triggers = 1; // $this->triggers = 1;
@ -65,7 +65,7 @@ class modAccounting extends DolibarrModules
); );
// Config pages // Config pages
$this->config_page_url = array('index.php@accounting'); $this->config_page_url = array('index.php@accountancy');
// Dependencies // Dependencies
$this->depends = array ("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled $this->depends = array ("modFacture","modBanque","modTax"); // List of modules id that must be enabled if this module is enabled
@ -77,10 +77,10 @@ class modAccounting extends DolibarrModules
); // Minimum version of PHP required by module ); // Minimum version of PHP required by module
$this->need_dolibarr_version = array ( $this->need_dolibarr_version = array (
3, 3,
4 6
); // Minimum version of Dolibarr required by module ); // Minimum version of Dolibarr required by module
$this->langfiles = array ( $this->langfiles = array (
"accountingex@accountingex" "accountancy"
); );
// Constants // Constants
@ -182,11 +182,7 @@ class modAccounting extends DolibarrModules
$this->tabs = array(); $this->tabs = array();
// Css // Css
$this->module_parts = array ( $this->module_parts = array ();
'css' => array (
'/accountingex/css/accountingex.css.php'
)
);
// Boxes // Boxes
$this->boxes = array (); $this->boxes = array ();
@ -197,12 +193,37 @@ class modAccounting extends DolibarrModules
$this->rights = array (); // Permission array used by this module $this->rights = array (); // Permission array used by this module
$r = 0; $r = 0;
$this->rights[$r][0] = 150001; // Permission id (must not be already used) $this->rights[$r][0] = 50401;
$this->rights[$r][1] = 'Acces_module'; // Permission label $this->rights[$r][1] = 'Access_accountancy';
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][2] = 'r';
$this->rights[$r][4] = 'access'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][3] = 0;
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'access';
$r ++; $this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 50411;
$this->rights[$r][1] = 'Lire les mouvements comptables';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvements';
$this->rights[$r][5] = 'lire';
$r++;
$this->rights[$r][0] = 50412;
$this->rights[$r][1] = 'Creer/modifier/annuler les mouvements comptables';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvements';
$this->rights[$r][5] = 'creer';
$r++;
$this->rights[$r][0] = 50420;
$this->rights[$r][1] = 'Lire CA, bilans, resultats, journaux, grands livres';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'comptarapport';
$this->rights[$r][5] = 'lire';
$r++;
// Main menu entries // Main menu entries
$this->menus = array (); $this->menus = array ();
@ -218,7 +239,7 @@ class modAccounting extends DolibarrModules
'langs' => 'accountingex@accountingex', 'langs' => 'accountingex@accountingex',
'position' => 100, 'position' => 100,
'perms' => '$user->rights->accountingex->access', 'perms' => '$user->rights->accountingex->access',
'enabled' => '$conf->accountingexpert->enabled', 'enabled' => '$conf->accounting->enabled',
'target' => '', 'target' => '',
'user' => 0 'user' => 0
); );