FIX #yogosha5665

This commit is contained in:
Laurent Destailleur 2021-03-19 14:41:57 +01:00
parent 1540f62df0
commit 3a9a3b2b3e
3 changed files with 56 additions and 11 deletions

View File

@ -92,14 +92,6 @@ if ($id || $ref) {
$object->ref = $object->batch; // For document management ( it use $object->ref)
}
// Protection if external user
if ($user->socid > 0) {
//accessforbidden();
}
//$result = restrictedArea($user, 'mymodule', $id);
// Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productlotcard', 'globalcard'));
@ -114,7 +106,21 @@ $usercandelete = $user->rights->produit->supprimer;
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
$permissiontoread = $usercanread;
$permissiontoadd = $usercancreate;
//$permissiontodelete = $usercandelete;
// Security check
if (empty($conf->productbatch->enabled)) {
accessforbidden('Module not enabled');
}
$socid = 0;
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
if (!$permissiontoread) accessforbidden();
/*

View File

@ -90,6 +90,28 @@ if ($id || $ref) {
}
}
$usercanread = $user->rights->produit->lire;
$usercancreate = $user->rights->produit->creer;
$usercandelete = $user->rights->produit->supprimer;
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
$permissiontoread = $usercanread;
$permissiontoadd = $usercancreate;
//$permissiontodelete = $usercandelete;
// Security check
if (empty($conf->productbatch->enabled)) {
accessforbidden('Module not enabled');
}
$socid = 0;
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
if (!$permissiontoread) accessforbidden();
/*
* Actions

View File

@ -129,10 +129,27 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
$object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->stock->lire;
$permissiontoadd = $user->rights->stock->mouvement->creer;
//$permissiontodelete = $user->rights->stock->supprimer;
$usercanread = $user->rights->produit->lire;
$usercancreate = $user->rights->produit->creer;
$usercandelete = $user->rights->produit->supprimer;
$upload_dir = $conf->productbatch->multidir_output[$conf->entity];
$permissiontoread = $usercanread;
$permissiontoadd = $usercancreate;
//$permissiontodelete = $usercandelete;
// Security check
if (empty($conf->productbatch->enabled)) {
accessforbidden('Module not enabled');
}
$socid = 0;
if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
if (!$permissiontoread) accessforbidden();
/*