FIX upload documents into manual ECM was reported a permission error

This commit is contained in:
Laurent Destailleur 2020-06-28 22:05:55 +02:00
parent 70efaa4235
commit a5893db106
2 changed files with 19 additions and 28 deletions

View File

@ -233,28 +233,22 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
continue;
}
if ($feature == 'societe')
{
if ($feature == 'societe') {
if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { $readok = 0; $nbko++; }
}
elseif ($feature == 'contact')
{
elseif ($feature == 'contact') {
if (!$user->rights->societe->contact->lire) { $readok = 0; $nbko++; }
}
elseif ($feature == 'produit|service')
{
elseif ($feature == 'produit|service') {
if (!$user->rights->produit->lire && !$user->rights->service->lire) { $readok = 0; $nbko++; }
}
elseif ($feature == 'prelevement')
{
elseif ($feature == 'prelevement') {
if (!$user->rights->prelevement->bons->lire) { $readok = 0; $nbko++; }
}
elseif ($feature == 'cheque')
{
elseif ($feature == 'cheque') {
if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; }
}
elseif ($feature == 'projet')
{
elseif ($feature == 'projet') {
if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; }
}
elseif (!empty($feature2)) // This is for permissions on 2 levels
@ -296,30 +290,27 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
{
foreach ($featuresarray as $feature)
{
if ($feature == 'contact')
{
if ($feature == 'contact') {
if (!$user->rights->societe->contact->creer) { $createok = 0; $nbko++; }
}
elseif ($feature == 'produit|service')
{
elseif ($feature == 'produit|service') {
if (!$user->rights->produit->creer && !$user->rights->service->creer) { $createok = 0; $nbko++; }
}
elseif ($feature == 'prelevement')
{
elseif ($feature == 'prelevement') {
if (!$user->rights->prelevement->bons->creer) { $createok = 0; $nbko++; }
}
elseif ($feature == 'commande_fournisseur')
{
elseif ($feature == 'commande_fournisseur') {
if (!$user->rights->fournisseur->commande->creer) { $createok = 0; $nbko++; }
}
elseif ($feature == 'banque')
{
elseif ($feature == 'banque') {
if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; }
}
elseif ($feature == 'cheque')
{
elseif ($feature == 'cheque') {
if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; }
}
elseif ($feature == 'ecm') {
if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; }
}
elseif (!empty($feature2)) // This is for permissions on one level
{
foreach ($feature2 as $subfeature)

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -97,21 +97,21 @@ class modECM extends DolibarrModules
$r++;
$this->rights[$r][0] = 2501;
$this->rights[$r][1] = 'Consulter/Télécharger les documents';
$this->rights[$r][1] = 'Read or download documents';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read';
$r++;
$this->rights[$r][0] = 2503;
$this->rights[$r][1] = 'Soumettre ou supprimer des documents';
$this->rights[$r][1] = 'Upload a document';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'upload';
$r++;
$this->rights[$r][0] = 2515;
$this->rights[$r][1] = 'Administrer les rubriques de documents';
$this->rights[$r][1] = 'Administer directories of documents';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'setup';