diff --git a/ChangeLog b/ChangeLog index 92b8c7a624f..28c73b7b1cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ For users: - Added average amount in invoices statistics reports. - Can move a contract line to another contract of same third party. - Add an export definition to export interventions. +- Can set umask file permissions on Unix/Linux/BSD systems. For translators: - The errors language file contains only error or warning messages with diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index b4f5d9d77df..1ceaf10308c 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -69,6 +69,13 @@ if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') exit; } +if ($_GET["action"] == 'MAIN_UMASK') +{ + dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"]); + Header("Location: security_other.php"); + exit; +} + if ($_GET["action"] == 'activate_avscan') { dolibarr_set_const($db, "MAIN_USE_AVSCAN", '1'); @@ -127,6 +134,20 @@ print ''; +print ''; +print ''.$langs->trans("UMask").''; +print $form->textwithhelp('',$langs->trans("UMaskExplanation")); +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + $var=!$var; if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=ini_get("session.gc_maxlifetime"); print '
'; diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php index f025a579514..dcbfe9231e1 100644 --- a/htdocs/conf/conf.class.php +++ b/htdocs/conf/conf.class.php @@ -469,6 +469,8 @@ class Conf if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2; if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8; + // Define umask + if (empty($conf->global->MAIN_UMASK)) $conf->global->MAIN_UMASK='0664'; /* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de desactiver la fonction TVA * (pour particuliers ou liberaux en franchise) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2f1aa5d7abe..e465ead53fe 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -208,6 +208,8 @@ DoTestServerAvailability=Test server connectivity DoTestSend=Test sending DoTestSendHTML=Test sending HTML ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Error, can't user option @ if sequence {yy}{mm} or {yyyy}{mm} is not in mask. +UMask=UMask parameter for new files on Unix/Linux/BSD file system. +UMaskExplanation=This parameter allow you to define permissions set by default on files created by Dolibarr on server (during upload for example).
It must be the octal value (for example, 0666 means read and write for everyone).
Ce paramètre ne sert pas sous un serveur Windows. # Modules Module0Name=Users & groups diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index f018dc326e3..144aa39f168 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -207,6 +207,8 @@ DoTestServerAvailability=Tester disponibilit DoTestSend=Tester envoi DoTestSendHTML=Tester envoi HTML ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Erreur, ne peut utiliser l'option @ si la séquence {yy}{mm} ou {yyyy}{mm} n'est pas dans le masque. +UMask=Paramètre UMask des nouveaux fichiers sous Unix/Linux/BSD. +UMaskExplanation=Ce paramètre permet de définir les droits des fichiers créés sur le serveur par Dolibarr (lors d'upload par exemple).
Ce doit être la valeur octal (par exemple 0666 signifie lecture/ecriture pour tous).
This parameter is useless on a Windows server. # Modules Module0Name=Utilisateurs & groupes diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 11b0c8c5c3d..51b954a85c5 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -1672,8 +1672,9 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite) // Move file $return=move_uploaded_file($src_file, $file_name); if ($return) - { - dolibarr_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name, LOG_DEBUG); + { + @chmod($file_name, $conf->global->MAIN_UMASK); + dolibarr_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); return 1; } else diff --git a/htdocs/lib/ldap.class.php b/htdocs/lib/ldap.class.php index 34f67fd5769..49a46fc6cf1 100644 --- a/htdocs/lib/ldap.class.php +++ b/htdocs/lib/ldap.class.php @@ -599,8 +599,8 @@ class Ldap fclose($fp); // We change mod to allow file to be overwritten if dump is launched // from command line or a web session. - // 0662 = rw-rw-rw- - @chmod($file, 0666); + // 0666 = rw-rw-rw- + @chmod($file, $conf->global->MAIN_UMASK); return 1; } else diff --git a/htdocs/lib/xcal.lib.php b/htdocs/lib/xcal.lib.php index 8b2e5add843..56f4cf6fb75 100644 --- a/htdocs/lib/xcal.lib.php +++ b/htdocs/lib/xcal.lib.php @@ -315,8 +315,8 @@ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$fil // We change mod to allow file to be overwritten if dump is launched // from command line or a web session. - // 0662 = rw-rw-rw- - @chmod($fichier, 0666); + // 0666 = rw-rw-rw- + @chmod($fichier, $conf->global->MAIN_UMASK); } }