Todo: mettre au clair les droits du user dans les

modules commercial, agenda et tiers
This commit is contained in:
Regis Houssin 2009-04-29 09:05:57 +00:00
parent c1b3f88cc3
commit 86aea55e61
8 changed files with 36 additions and 32 deletions

View File

@ -50,7 +50,7 @@ function llxHeader($head = "")
$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts")); $menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"));
} }
if ($conf->commercial->enabled && $user->rights->commercial->lire) if ($conf->commercial->enabled && $user->rights->commercial->main->lire)
{ {
$langs->load("commercial"); $langs->load("commercial");
$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial")); $menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));

View File

@ -44,7 +44,8 @@ $langs->load("agenda");
$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid']; $socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid'];
$id = isset($_GET["id"])?$_GET["id"]:''; $id = isset($_GET["id"])?$_GET["id"]:'';
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'societe', $id, 'actioncomm', '', '', 'id'); // TODO: revoir les droits car pas clair
//$result = restrictedArea($user, 'commercial', $id, 'actioncomm', 'actions', '', 'id');
if (isset($_GET["error"])) $error=$_GET["error"]; if (isset($_GET["error"])) $error=$_GET["error"];

View File

@ -49,7 +49,7 @@ function llxHeader($head = "", $title="", $help_url='')
$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts")); $menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"));
} }
if ($conf->commercial->enabled && $user->rights->commercial->lire) if ($conf->commercial->enabled && $user->rights->commercial->main->lire)
{ {
$langs->load("commercial"); $langs->load("commercial");
$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial")); $menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));

View File

@ -272,7 +272,7 @@ if ($modulepart)
if ($modulepart == 'actions') if ($modulepart == 'actions')
{ {
$user->getrights('commercial'); $user->getrights('commercial');
//if ($user->rights->commercial->actions->lire || eregi('^specimen',$original_file)) // Ce droit n'existe pas encore //if ($user->rights->commercial->actions->lire || eregi('^specimen',$original_file)) // TODO: revoir les droits car pas clair
//{ //{
$accessallowed=1; $accessallowed=1;
//} //}
@ -284,7 +284,7 @@ if ($modulepart)
if ($modulepart == 'actionsreport') if ($modulepart == 'actionsreport')
{ {
$user->getrights('commercial'); $user->getrights('commercial');
//if ($user->rights->commercial->actions->lire || eregi('^specimen',$original_file)) // Ce droit n'existe pas encore //if ($user->rights->commercial->actions->lire || eregi('^specimen',$original_file)) // TODO: revoir les droits car pas clair
//{ //{
$accessallowed=1; $accessallowed=1;
//} //}
@ -296,10 +296,10 @@ if ($modulepart)
if ($modulepart == 'produit') if ($modulepart == 'produit')
{ {
$user->getrights('produit'); $user->getrights('produit');
//if ($user->rights->commercial->lire || eregi('^specimen',$original_file)) // Ce droit n'existe pas encore if ($user->rights->produit->lire || eregi('^specimen',$original_file))
//{ {
$accessallowed=1; $accessallowed=1;
//} }
$original_file=$conf->produit->dir_output.'/'.$original_file; $original_file=$conf->produit->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = ''; $sqlprotectagainstexternals = '';
} }
@ -308,7 +308,7 @@ if ($modulepart)
if ($modulepart == 'contract') if ($modulepart == 'contract')
{ {
$user->getrights('contrat'); $user->getrights('contrat');
if ($user->rights->contrat->lire || eregi('^specimen',$original_file)) // Ce droit n'existe pas encore if ($user->rights->contrat->lire || eregi('^specimen',$original_file))
{ {
$accessallowed=1; $accessallowed=1;
} }

View File

@ -102,7 +102,7 @@ class modCommercial extends DolibarrModules
$this->rights[$r][3] = 1; $this->rights[$r][3] = 1;
$this->rights[$r][4] = 'main'; $this->rights[$r][4] = 'main';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
$r++;
} }
/** /**

View File

@ -1332,7 +1332,9 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
if ($dbt_select != 'rowid') $objectid = "'".$objectid."'"; if ($dbt_select != 'rowid') $objectid = "'".$objectid."'";
//print "$user->id, $feature, $objectid, $dbtablename, ".$user->rights->societe->contact->lire; //print "user_id=".$user->id.", feature=".$feature.", feature2=".$feature2.", object_id=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_socfield.", dbt_select=".$dbt_select;
//print ", user_societe_contact_lire=".$user->rights->societe->contact->lire."<br>";
// Check read permission from module // Check read permission from module
// TODO Replace "feature" param by permission for reading // TODO Replace "feature" param by permission for reading
@ -1371,6 +1373,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='',
if (empty($user->rights->$feature->lire) if (empty($user->rights->$feature->lire)
&& empty($user->rights->$feature->read)) $readok=0; && empty($user->rights->$feature->read)) $readok=0;
} }
//print "Read access is down";
if (! $readok) accessforbidden(); if (! $readok) accessforbidden();
//print "Read access is ok"; //print "Read access is ok";

View File

@ -55,7 +55,7 @@ function llxHeader($head = '', $title='', $help_url='')
$menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("Categories")); $menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("Categories"));
} }
if (! empty($conf->commercial->enabled) && isset($user->rights->commercial->lire) && $user->rights->commercial->lire) if (! empty($conf->commercial->enabled) && isset($user->rights->commercial->main->lire) && $user->rights->commercial->main->lire)
{ {
$langs->load("commercial"); $langs->load("commercial");
$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial")); $menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));