|
@@ -83,6 +83,12 @@ if ($user->socid) {
|
|
|
}
|
|
|
$result = restrictedArea($user, 'ecm', 0);
|
|
|
|
|
|
+$permissiontoread = $user->hasRight('ecm', 'read');
|
|
|
+$permissiontocreate = $user->hasRight('ecm', 'upload');
|
|
|
+$permissiontocreatedir = $user->hasRight('ecm', 'setup');
|
|
|
+$permissiontodelete = $user->hasRight('ecm', 'upload');
|
|
|
+$permissiontodeletedir = $user->hasRight('ecm', 'setup');
|
|
|
+
|
|
|
|
|
|
/*
|
|
|
* Actions
|
|
@@ -93,7 +99,7 @@ $result = restrictedArea($user, 'ecm', 0);
|
|
|
//include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
|
|
|
|
|
// Upload file (code similar but different than actions_linkedfiles.inc.php)
|
|
|
-if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
|
|
|
+if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC) && $permissiontocreate) {
|
|
|
// Define relativepath and upload_dir
|
|
|
$relativepath = '';
|
|
|
if ($ecmdir->id) {
|
|
@@ -130,7 +136,7 @@ if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC))
|
|
|
}
|
|
|
|
|
|
// Remove file (code similar but different than actions_linkedfiles.inc.php)
|
|
|
-if ($action == 'confirm_deletefile') {
|
|
|
+if ($action == 'confirm_deletefile' && $permissiontodelete) {
|
|
|
if (GETPOST('confirm') == 'yes') {
|
|
|
// GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections.
|
|
|
|
|
@@ -152,7 +158,7 @@ if ($action == 'confirm_deletefile') {
|
|
|
}
|
|
|
|
|
|
// Add directory
|
|
|
-if ($action == 'add' && $user->rights->ecm->setup) {
|
|
|
+if ($action == 'add' && $permissiontocreatedir) {
|
|
|
$ecmdir->ref = 'NOTUSEDYET';
|
|
|
$ecmdir->label = GETPOST("label");
|
|
|
$ecmdir->description = GETPOST("desc");
|
|
@@ -170,7 +176,7 @@ if ($action == 'add' && $user->rights->ecm->setup) {
|
|
|
}
|
|
|
|
|
|
// Remove directory
|
|
|
-if ($action == 'confirm_deletesection' && GETPOST('confirm', 'alpha') == 'yes') {
|
|
|
+if ($action == 'confirm_deletesection' && GETPOST('confirm', 'alpha') == 'yes' && $permissiontodeletedir) {
|
|
|
$result = $ecmdir->delete($user);
|
|
|
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
|
|
|
|
|
@@ -180,7 +186,7 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm', 'alpha') == 'yes')
|
|
|
// Refresh directory view
|
|
|
// This refresh list of dirs, not list of files (for preformance reason). List of files is refresh only if dir was not synchronized.
|
|
|
// To refresh content of dir with cache, just open the dir in edit mode.
|
|
|
-if ($action == 'refreshmanual') {
|
|
|
+if ($action == 'refreshmanual' && $permissiontoread) {
|
|
|
$ecmdirtmp = new EcmDirectory($db);
|
|
|
|
|
|
// This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
|