diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php
index 8096aa3d771..324e640702b 100755
--- a/htdocs/workstation/workstation_agenda.php
+++ b/htdocs/workstation/workstation_agenda.php
@@ -82,13 +82,11 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity]."/".$object->id;
}
-// Security check - Protection if external user
-//if ($user->socid > 0) accessforbidden();
-//if ($user->socid > 0) $socid = $user->socid;
-//$result = restrictedArea($user, 'workstation', $object->id);
-
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
+// Security check
+restrictedArea($user, $object->element, $object->id);
+
/*
* Actions
diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php
index b64f15e1f76..5d0d92c7cb0 100755
--- a/htdocs/workstation/workstation_card.php
+++ b/htdocs/workstation/workstation_card.php
@@ -82,15 +82,8 @@ $permissionnote = $user->rights->workstation->workstation->write; // Used by the
$permissiondellink = $user->rights->workstation->workstation->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->workstation->multidir_output[isset($object->entity) ? $object->entity : 1];
-// Security check - Protection if external user
-//if ($user->socid > 0) accessforbidden();
-//if ($user->socid > 0) $socid = $user->socid;
-//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
-//$result = restrictedArea($user, 'workstation', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
-
-if (!$permissiontoread) {
- accessforbidden();
-}
+// Security check
+restrictedArea($user, $object->element, $object->id);
/*
@@ -343,7 +336,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Object card
// ------------------------------------------------------------
- $linkback = ''.$langs->trans("BackToList").'';
+ $linkback = ''.$langs->trans("BackToList").'';
$morehtmlref = '
';
/*
diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php
index 2c1a9906c8e..324546a9647 100755
--- a/htdocs/workstation/workstation_document.php
+++ b/htdocs/workstation/workstation_document.php
@@ -74,13 +74,10 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->workstation->multidir_output[$object->entity ? $object->entity : $conf->entity]."/workstation/".get_exdir(0, 0, 0, 1, $object);
}
-// Security check - Protection if external user
-//if ($user->socid > 0) accessforbidden();
-//if ($user->socid > 0) $socid = $user->socid;
-//$result = restrictedArea($user, 'workstation', $object->id);
-
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
+// Security check
+restrictedArea($user, $object->element, $object->id);
/*
diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php
index 59dbfc658d3..2d8b371cd52 100755
--- a/htdocs/workstation/workstation_list.php
+++ b/htdocs/workstation/workstation_list.php
@@ -146,18 +146,7 @@ $permissiontoadd = $user->rights->workstation->workstation->write;
$permissiontodelete = $user->rights->workstation->workstation->delete;
// Security check
-if (empty($conf->workstation->enabled)) {
- accessforbidden('Module not enabled');
-}
-$socid = 0;
-if ($user->socid > 0) {
- // Protection if external user
- //$socid = $user->socid;
- accessforbidden();
-}
-//$result = restrictedArea($user, 'workstation', $id, '');
-//if (!$permissiontoread) accessforbidden();
-
+restrictedArea($user, $object->element, 0);
/*
diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php
index f2fa055102a..ddafd1136fe 100755
--- a/htdocs/workstation/workstation_note.php
+++ b/htdocs/workstation/workstation_note.php
@@ -60,6 +60,8 @@ if ($id > 0 || !empty($ref)) {
$permissionnote = $user->rights->workstation->workstation->write; // Used by the include of actions_setnotes.inc.php
$permissiontoadd = $user->rights->workstation->workstation->write; // Used by the include of actions_addupdatedelete.inc.php
+// Security check
+restrictedArea($user, $object->element, $object->id);
/*