Clean code

This commit is contained in:
ldestailleur 2025-09-03 12:53:38 +02:00
parent a5a947a570
commit cc6f43493c
49 changed files with 67 additions and 63 deletions

View file

@ -94,9 +94,11 @@ $hookmanager->initHooks(array('membernote'));
// Security check
$result = restrictedArea($user, 'adherent', $object->id, '', '', 'socid', 'rowid', 0);
/*
* Actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View file

@ -113,7 +113,7 @@ if (($action == 'update' || $action == 'edit') && $object->status != $object::ST
// Security check
$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', 0);
/*

View file

@ -49,7 +49,7 @@ if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));

View file

@ -51,7 +51,7 @@ if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));

View file

@ -57,7 +57,7 @@ if ($user->socid > 0) {
$action = '';
$socid = $user->socid;
}
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = (int) dol_print_date(dol_now('gmt'), "%Y", 'gmt');
$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));

View file

@ -120,7 +120,7 @@ $arrayfields = array(
);
// Security check
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
restrictedArea($user, 'adherent', '', '', 'cotisation');
$permissiontodelete = $user->hasRight('adherent', 'cotisation', 'creer');

View file

@ -25,12 +25,6 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -38,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/ldap.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/ldap.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("admin", "members", "ldap"));
@ -54,11 +53,11 @@ $result = restrictedArea($user, 'adherent', $id, 'adherent_type');
$object = new AdherentType($db);
$object->fetch($id);
/*
* Actions
*/
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {

View file

@ -107,7 +107,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
$permissionnote = $user->admin; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->admin; // Used by the include of actions_dellink.inc.php

View file

@ -101,7 +101,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'emailcollector', $id, '');
//restrictedArea($user, 'emailcollector', $id, '');
// Initialize array of search criteria
$search_all = trim(GETPOST('search_all', 'alphanohtml'));

View file

@ -51,7 +51,7 @@ $element = GETPOST('element', 'alpha');
$action = GETPOST('action', 'aZ09');
if ($element === 'facture') {
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', 'rowid', 0);
restrictedArea($user, 'facture', $id, '', '', 'fk_soc', 'rowid', 0);
} else {
accessforbidden('Bad value for element');
}

View file

@ -52,7 +52,7 @@ $ref = GETPOST('ref', 'alpha');
// Security check - Protection if external user
// if ($user->socid > 0) accessforbidden();
// if ($user->socid > 0) $socid = $user->socid;
// $result = restrictedArea($user, 'bom', $id);
// restrictedArea($user, 'bom', $id);
// Load variables for pagination
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;

View file

@ -91,7 +91,7 @@ if ($object->id > 0) {
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'bom', $object->id, $object->table_element, '', '', 'rowid', $isdraft);
restrictedArea($user, 'bom', $object->id, $object->table_element, '', '', 'rowid', $isdraft);
// Permissions
$permissionnote = $user->hasRight('bom', 'write'); // Used by the include of actions_setnotes.inc.php

View file

@ -61,7 +61,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'bom', $id);
//restrictedArea($user, 'bom', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals

View file

@ -65,7 +65,7 @@ if (!$sortfield) {
}
// Security check
//$result = restrictedArea($user, 'agenda', 0, '', 'myactions');
//restrictedArea($user, 'agenda', 0, '', 'myactions');
if (!$user->hasRight("agenda", "allactions", "read")) {
accessforbidden();
}

View file

@ -46,7 +46,7 @@ $langs->load("mails");
if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
accessforbidden();
}
//$result = restrictedArea($user, 'mailing');
//restrictedArea($user, 'mailing');

View file

@ -102,7 +102,7 @@ $permissiontodelete = $user->hasRight('mailing', 'delete');
if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) {
accessforbidden();
}
//$result = restrictedArea($user, 'mailing');
//restrictedArea($user, 'mailing');
/*

View file

@ -57,7 +57,7 @@ if ($user->socid) {
$socid = $user->socid;
}
// TODO ajouter regle pour restreindre access paiement
//$result = restrictedArea($user, 'facture', $id,'');
//restrictedArea($user, 'facture', $id,'');
$object = new PaymentVAT($db);
if ($id > 0) {

View file

@ -80,7 +80,7 @@ $object = new Tva($db);
if ($user->socid) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'tax|salaries', '', '', 'charges|');
//restrictedArea($user, 'tax|salaries', '', '', 'charges|');
$result = restrictedArea($user, 'tax', '', 'tva', 'charges');

View file

@ -25,9 +25,6 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@ -35,16 +32,24 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
$langs->loadLangs(array("contacts", "companies", "projects"));
$action = GETPOST('action', 'aZ09');
// Security check
$id = GETPOSTINT('id');
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
$hookmanager->initHooks(array('projectcontact'));
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Project($db);
restrictedArea($user, 'contact', $id, 'socpeople&societe');
/*
* Actions
@ -56,6 +61,7 @@ if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
/*
* View
*/
@ -63,9 +69,6 @@ if ($reshook < 0) {
$form = new Form($db);
if ($id) {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
$object = new Contact($db);
$result = $object->fetch($id);

View file

@ -53,7 +53,7 @@ if ($user->socid) {
$socid = $user->socid;
}
// TODO Add rule to restrict access payment
//$result = restrictedArea($user, 'facture', $id,'');
//restrictedArea($user, 'facture', $id,'');
$object = new PaymentDonation($db);
if ($id > 0) {

View file

@ -59,7 +59,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'eventorganization', $id);
//restrictedArea($user, 'eventorganization', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals

View file

@ -53,7 +53,7 @@ if ($user->socid) {
$socid = $user->socid;
}
// TODO Add rule to restrict access payment
//$result = restrictedArea($user, 'facture', $id,'');
//restrictedArea($user, 'facture', $id,'');
$object = new PaymentExpenseReport($db);

View file

@ -50,7 +50,7 @@ if ($user->socid) {
$socid = $user->socid;
}
// TODO ajouter regle pour restreindre access paiement
//$result = restrictedArea($user, 'facture', $id,'');
//restrictedArea($user, 'facture', $id,'');
$payment = new PaymentLoan($db);
if ($id > 0) {

View file

@ -101,7 +101,7 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
//restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) {
accessforbidden();
}

View file

@ -68,7 +68,7 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
//restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) {
accessforbidden();
}

View file

@ -89,7 +89,7 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
//restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) {
accessforbidden();
}

View file

@ -174,7 +174,7 @@ $permissiontodelete = $user->hasRight('partnership', 'delete');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
//restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) {
accessforbidden();
}

View file

@ -58,7 +58,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $id);
//restrictedArea($user, 'partnership', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals
@ -74,7 +74,7 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'partnership', $object->id);
//restrictedArea($user, 'partnership', $object->id);
if (empty($conf->partnership->enabled)) {
accessforbidden();
}

View file

@ -92,7 +92,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);
//restrictedArea($user, 'mymodule', $id);
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
$permissiontoread = $user->hasRight('stock', 'lire');

View file

@ -114,7 +114,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'mymodule', $id);
//restrictedArea($user, 'mymodule', $id);
//Parameters Page
$paramwithsearch = '&sortfield=' . urlencode($sortfield);

View file

@ -137,7 +137,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
//restrictedArea($user, 'productbatch');
if (!$permissiontoread) {
accessforbidden();
}

View file

@ -126,7 +126,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
//restrictedArea($user, 'productbatch');
if (!$permissiontoread) {
accessforbidden();
}

View file

@ -156,7 +156,7 @@ if ($user->socid > 0) { // Protection if external user
//$socid = $user->socid;
accessforbidden();
}
//$result = restrictedArea($user, 'productbatch');
//restrictedArea($user, 'productbatch');
if (!$permissiontoread) {
accessforbidden();
}

View file

@ -104,8 +104,8 @@ $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $ob
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer');
//restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer');
if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
accessforbidden();

View file

@ -111,7 +111,7 @@ $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $ob
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
accessforbidden();

View file

@ -93,8 +93,8 @@ $upload_dir = $conf->stocktransfer->multidir_output[isset($object->entity) ? $ob
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//$result = restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer');
//restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//restrictedArea($user, 'stocktransfer', $object->id, '', 'stocktransfer');
if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
accessforbidden();

View file

@ -87,7 +87,7 @@ if ($id > 0 || !empty($ref)) {
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'stocktransfer', $object->id);
//restrictedArea($user, 'stocktransfer', $object->id);
$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write'); // Used by the include of actions_addupdatedelete.inc.php

View file

@ -146,7 +146,7 @@ if (empty($conf->stocktransfer->enabled)) {
if ($user->socid > 0) {
accessforbidden();
}
//$result = restrictedArea($user, 'stocktransfer', $id, '');
//restrictedArea($user, 'stocktransfer', $id, '');
if (!$permissiontoread) {
accessforbidden();
}

View file

@ -57,7 +57,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'stocktransfer', $id);
//restrictedArea($user, 'stocktransfer', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals

View file

@ -62,7 +62,7 @@ $socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'projet', $projectid);
//restrictedArea($user, 'projet', $projectid);
if (!$user->hasRight('projet', 'lire')) {
accessforbidden();
}

View file

@ -98,7 +98,7 @@ if ($id > 0 || $ref) {
$object->fetch($id, $ref);
}
//$result = restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification
//restrictedArea($user, 'projet', $id, '', 'task'); // TODO ameliorer la verification
restrictedArea($user, 'projet', $object->fk_project, 'projet&project');
$permissionnote = ($user->hasRight('projet', 'creer') || $user->hasRight('projet', 'all', 'creer'));

View file

@ -57,7 +57,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Security check - Protection if external user
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'recruitment', $id);
//restrictedArea($user, 'recruitment', $id);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals

View file

@ -48,7 +48,7 @@ $socid = GETPOSTINT("socid");
if ($user->socid) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'salaries', '', '', '');
//restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');

View file

@ -48,7 +48,7 @@ $socid = GETPOSTINT("socid");
if ($user->socid) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'salaries', '', '', '');
//restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');

View file

@ -48,7 +48,7 @@ $socid = GETPOSTINT("socid");
if ($user->socid) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'salaries', '', '', '');
//restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$rowid = GETPOST("rowid", 'alpha');

View file

@ -72,7 +72,7 @@ $endyear = $year;
$object = new Ticket($db);
// Security check
//$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', '');
//restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', '');
if (!$user->hasRight('ticket', 'read') && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
accessforbidden('Not enough permissions');
}

View file

@ -115,7 +115,7 @@ $permissiontosimpleedit = ($selfpermission || $usercanadd);
$childids = $user->getAllChildIds(1);
// Ok if user->hasRight('salaries', 'readall') or user->hasRight('hrm', 'read')
//$result = restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2);
//restrictedArea($user, 'salaries|hrm', $object->id, 'user&user', $feature2);
$ok = false;
if ($user->id == $id) {
$ok = true; // A user can always read its own card

View file

@ -78,7 +78,7 @@ $socid = 0;
if (!empty($user->socid) && $user->socid > 0) {
$socid = $user->socid;
}
//$result = restrictedArea($user, 'user', $id, 'usergroup', '');
//restrictedArea($user, 'user', $id, 'usergroup', '');
if (!$permissiontoread) {
accessforbidden();
}

View file

@ -80,7 +80,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'inclu
// Security check
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$result = restrictedArea($user, 'website', $id);
//restrictedArea($user, 'website', $id);
$permissiontoaccess = (isModEnabled('website') && $user->hasRight('website', 'read')) || isModEnabled('webportal');
if (!$permissiontoaccess) {
accessforbidden('NotAllowed');