18 include_once (
"Class.DbObj.php");
35 "getuperm(userid,docid) as uperm"
48 create table docperm (
49 docid int check (docid > 0),
50 userid int check (userid > 1),
55 create unique index idx_perm on docperm(docid, userid);
56 create trigger tinitacl AFTER INSERT OR UPDATE ON docperm FOR EACH ROW EXECUTE PROCEDURE initacl();";
60 if (count(
$tid) == 2) {
61 $this->docid =
$tid[0];
62 $this->userid =
$tid[1];
68 if ($this->userid == 1)
return _(
"not perm for admin");
69 if (($this->upacl == 0) && ($this->unacl == 0))
return "";
70 if ($this->unacl ===
"") $this->unacl =
"0";
71 if ($this->cacl ===
"") $this->cacl =
"0";
87 $err = $this->
exec_query(sprintf(
"update docperm set cacl=0 where docid=%d and cacl != 0;",
$docid));
93 $q =
new QueryDb($this->dbaccess,
"docperm");
94 $t =
$q->Query(0, 1,
"TABLE",
"select getuperm($userid,$docid) as uperm");
96 return ((
$q->nb > 0) ?
$t[0][
"uperm"] : 0);
100 if ($this->docid > 0) $this->
exec_query(
"select getuperm(userid,docid) as uperm from docperm where docid=" . $this->docid);
106 if ($this->cacl == 0) {
107 $this->cacl = $this->
getUperm($this->docid, $this->userid);
115 if (!isset($this->gacl)) {
116 $q =
new QueryDb($this->dbaccess,
"docperm");
117 $t =
$q->Query(0, 1,
"TABLE",
"select computegperm({$this->userid},{$this->docid}) as uperm");
119 $this->gacl =
$t[0][
"uperm"];
146 return (($acl & (1 << ($pos))) != 0);
163 $this->upacl = $this->upacl | (1 << $pos);
172 $this->upacl = $this->upacl & (~(1 << $pos));
180 $this->unacl = $this->unacl | (1 << $pos);
189 $this->unacl = $this->unacl & (~(1 << $pos));