Gestion des droits sur 3 digits

This commit is contained in:
Rodolphe Quiedeville 2003-11-10 13:09:59 +00:00
parent bc5fbf3468
commit 4b7da31570

View File

@ -71,21 +71,45 @@ class User
{ {
$topid = substr($rid,0,1); $topid = substr($rid,0,1);
$lowid = substr($rid,1,1); $lowid = substr($rid,1,1);
if ($lowid == 1) }
{
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
if ($this->db->query($sql))
{
}
}
if ($lowid > 1) if (strlen($rid) == 3)
{
$topid = substr($rid,0,2);
$lowid = substr($rid,2,1);
}
if ($lowid == 1)
{
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
if ($this->db->query($sql))
{ {
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)"; }
if ($this->db->query($sql)) }
{
} if ($lowid > 1)
$nid = $topid . "1"; {
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $rid)";
if ($this->db->query($sql))
{
}
$nid = $topid . "1";
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
if ($this->db->query($sql))
{
}
else
{
print $sql;
}
}
if ($lowid == 0)
{
for ($i = 1 ; $i < 10 ; $i++)
{
$nid = $topid . "$i";
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)"; $sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -96,25 +120,9 @@ class User
print $sql; print $sql;
} }
} }
if ($lowid == 0)
{
for ($i = 1 ; $i < 10 ; $i++)
{
$nid = $topid . "$i";
$sql = "REPLACE INTO llx_user_rights (fk_user, fk_id) VALUES ($this->id, $nid)";
if ($this->db->query($sql))
{
}
else
{
print $sql;
}
}
}
} }
return 1; return 1;
} }
/* /*