Merge pull request #21938 from Hystepik/develop#2
Fix : category view permission
This commit is contained in:
commit
bce35f8e81
@ -487,6 +487,7 @@ $typeid = $type;
|
|||||||
|
|
||||||
// List of products or services (type is type of category)
|
// List of products or services (type is type of category)
|
||||||
if ($type == Categorie::TYPE_PRODUCT) {
|
if ($type == Categorie::TYPE_PRODUCT) {
|
||||||
|
if ($user->hasRight("product", "read")) {
|
||||||
$permission = ($user->rights->produit->creer || $user->rights->service->creer);
|
$permission = ($user->rights->produit->creer || $user->rights->service->creer);
|
||||||
|
|
||||||
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||||
@ -560,10 +561,15 @@ if ($type == Categorie::TYPE_PRODUCT) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of customers
|
// List of customers
|
||||||
if ($type == Categorie::TYPE_CUSTOMER) {
|
if ($type == Categorie::TYPE_CUSTOMER) {
|
||||||
|
if ($user->hasRight("societe", "read")) {
|
||||||
$permission = $user->rights->societe->creer;
|
$permission = $user->rights->societe->creer;
|
||||||
|
|
||||||
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||||
@ -635,10 +641,15 @@ if ($type == Categorie::TYPE_CUSTOMER) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of suppliers
|
// List of suppliers
|
||||||
if ($type == Categorie::TYPE_SUPPLIER) {
|
if ($type == Categorie::TYPE_SUPPLIER) {
|
||||||
|
if ($user->hasRight("fournisseur", "read")) {
|
||||||
$permission = $user->rights->societe->creer;
|
$permission = $user->rights->societe->creer;
|
||||||
|
|
||||||
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
$socs = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||||
@ -711,10 +722,15 @@ if ($type == Categorie::TYPE_SUPPLIER) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of members
|
// List of members
|
||||||
if ($type == Categorie::TYPE_MEMBER) {
|
if ($type == Categorie::TYPE_MEMBER) {
|
||||||
|
if ($user->hasRight("adherent", "read")) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
|
||||||
$permission = $user->rights->adherent->creer;
|
$permission = $user->rights->adherent->creer;
|
||||||
@ -790,10 +806,15 @@ if ($type == Categorie::TYPE_MEMBER) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of contacts
|
// List of contacts
|
||||||
if ($type == Categorie::TYPE_CONTACT) {
|
if ($type == Categorie::TYPE_CONTACT) {
|
||||||
|
if ($user->hasRight("societe", "read")) {
|
||||||
$permission = $user->rights->societe->creer;
|
$permission = $user->rights->societe->creer;
|
||||||
|
|
||||||
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
$contacts = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||||
@ -872,10 +893,15 @@ if ($type == Categorie::TYPE_CONTACT) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of bank accounts
|
// List of bank accounts
|
||||||
if ($type == Categorie::TYPE_ACCOUNT) {
|
if ($type == Categorie::TYPE_ACCOUNT) {
|
||||||
|
if ($user->hasRight("banque", "read")) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
|
|
||||||
$permission = $user->rights->banque->creer;
|
$permission = $user->rights->banque->creer;
|
||||||
@ -949,10 +975,15 @@ if ($type == Categorie::TYPE_ACCOUNT) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of Project
|
// List of Project
|
||||||
if ($type == Categorie::TYPE_PROJECT) {
|
if ($type == Categorie::TYPE_PROJECT) {
|
||||||
|
if ($user->hasRight("project", "read")) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||||
|
|
||||||
$permission = $user->rights->projet->creer;
|
$permission = $user->rights->projet->creer;
|
||||||
@ -1027,10 +1058,15 @@ if ($type == Categorie::TYPE_PROJECT) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of users
|
// List of users
|
||||||
if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) {
|
if ($type == Categorie::TYPE_USER) {
|
||||||
|
if ($user->hasRight("user", "user", "read")) {
|
||||||
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||||
|
|
||||||
$users = $object->getObjectsInCateg($type);
|
$users = $object->getObjectsInCateg($type);
|
||||||
@ -1099,14 +1135,16 @@ if ($type == Categorie::TYPE_USER && $user->hasRight("user", "user", "read")) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
|
print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user');
|
||||||
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// List of warehouses
|
// List of warehouses
|
||||||
if ($type == Categorie::TYPE_WAREHOUSE) {
|
if ($type == Categorie::TYPE_WAREHOUSE) {
|
||||||
|
if ($user->hasRight("warehouse", "read")) {
|
||||||
$permission = $user->rights->stock->creer;
|
$permission = $user->rights->stock->creer;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
|
||||||
@ -1161,10 +1199,15 @@ if ($type == Categorie::TYPE_WAREHOUSE) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of tickets
|
// List of tickets
|
||||||
if ($type == Categorie::TYPE_TICKET) {
|
if ($type == Categorie::TYPE_TICKET) {
|
||||||
|
if ($user->hasRight("ticket", "read")) {
|
||||||
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
|
$permission = ($user->rights->categorie->creer || $user->rights->categorie->creer);
|
||||||
|
|
||||||
$tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
$tickets = $object->getObjectsInCateg($type, 0, $limit, $offset);
|
||||||
@ -1235,6 +1278,10 @@ if ($type == Categorie::TYPE_TICKET) {
|
|||||||
|
|
||||||
print '</form>'."\n";
|
print '</form>'."\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket');
|
||||||
|
accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user