Fix: Wrong permission test
This commit is contained in:
parent
6e3737139c
commit
194b985440
@ -48,7 +48,7 @@ $status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
|
|||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'societe', $socid,'');
|
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
|
||||||
|
|
||||||
$canedit=1;
|
$canedit=1;
|
||||||
if (! $user->rights->agenda->myactions->read) accessforbidden();
|
if (! $user->rights->agenda->myactions->read) accessforbidden();
|
||||||
|
|||||||
@ -47,7 +47,7 @@ $status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
|
|||||||
// Security check
|
// Security check
|
||||||
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$result = restrictedArea($user, 'societe', $socid,'');
|
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
|
||||||
|
|
||||||
$canedit=1;
|
$canedit=1;
|
||||||
if (! $user->rights->agenda->myactions->read) accessforbidden();
|
if (! $user->rights->agenda->myactions->read) accessforbidden();
|
||||||
|
|||||||
@ -38,12 +38,10 @@ $offset = $limit * $page ;
|
|||||||
if (! $sortorder) $sortorder="DESC";
|
if (! $sortorder) $sortorder="DESC";
|
||||||
if (! $sortfield) $sortfield="a.datep";
|
if (! $sortfield) $sortfield="a.datep";
|
||||||
|
|
||||||
// Sécurité accés client
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
$socid = isset($_GET["socid"])?$_GET["socid"]:'';
|
||||||
{
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
$action = '';
|
$result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
|
||||||
$socid = $user->societe_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1273,8 +1273,9 @@ function info_admin($texte,$infoonimgalt=0)
|
|||||||
\param feature Feature to check (in most cases, it's module name)
|
\param feature Feature to check (in most cases, it's module name)
|
||||||
\param objectid Object ID if we want to check permission on on object (optionnal)
|
\param objectid Object ID if we want to check permission on on object (optionnal)
|
||||||
\param dbtable Table name where object is stored. Not used if objectid is null (optionnel)
|
\param dbtable Table name where object is stored. Not used if objectid is null (optionnel)
|
||||||
|
\param feature Feature to check (second level of permission)
|
||||||
*/
|
*/
|
||||||
function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='')
|
function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',$feature2='')
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
@ -1303,7 +1304,11 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='')
|
|||||||
{
|
{
|
||||||
if (! $user->rights->banque->cheque) $readok=0;
|
if (! $user->rights->banque->cheque) $readok=0;
|
||||||
}
|
}
|
||||||
else if (! empty($feature))
|
else if (! empty($feature2)) // This should be used for future changes
|
||||||
|
{
|
||||||
|
if (! $user->rights->$feature->$feature2->read) $readok=0;
|
||||||
|
}
|
||||||
|
else if (! empty($feature)) // This is for old permissions
|
||||||
{
|
{
|
||||||
if (! $user->rights->$feature->lire) $readok=0;
|
if (! $user->rights->$feature->lire) $readok=0;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user