19 include_once (
'Class.DbObj.php');
20 include_once (
'Class.QueryDb.php');
21 include_once (
'Class.Log.php');
22 include_once (
'Class.Application.php');
38 create table groups ( iduser int not null,
39 idgroup int not null);
40 create index groups_idx1 on groups(iduser);
41 create unique index groups_idx2 on groups(iduser,idgroup);
42 create trigger t_nogrouploop before insert or update on groups for each row execute procedure nogrouploop();";
56 $query->AddQuery(
"iduser='{$this->iduser}'");
60 while (list($k, $v) = each(
$list)) {
61 $this->groups[] = $v->idgroup;
79 if (($this->iduser > 0) && (
$uid > 0)) {
80 $err = $this->
exec_query(
"delete from groups where idgroup=" . $this->iduser .
" and iduser=$uid");
81 $err = $this->
exec_query(
"delete from sessions where userid=$uid");
86 $err = $g->exec_query(
"delete from groups where idgroup=" . $this->iduser .
" and iduser=$uid");
103 $err = $this->
exec_query(sprintf(
"select * from groups where idgroup=%s and iduser=%s", $this->idgroup, $this->iduser));
115 else $u =
new User(
"", $this->iduser);
116 if (
$u->isgroup ==
"Y") {
121 $g =
new Group($dbf);
122 $g->iduser = $this->iduser;
123 $g->idgroup = $this->idgroup;
124 $err = $g->exec_query(
"delete from groups where idgroup=" . $this->iduser .
" and iduser=" .
$u->id);
127 $g->exec_query(
"delete from docperm where upacl=0 and unacl=0 and userid=" . $g->iduser);
128 $g->exec_query(
"update docperm set cacl=0 where cacl != 0 and userid=" . $g->iduser);
129 $g->exec_query(
"delete from permission where computed");
132 $p->deletePermission($g->iduser, null, null,
true);
140 $err = $this->
exec_query(
"delete from sessions where userid=" . $this->iduser);
143 $u =
new User(
"", $this->iduser);
144 if (
$u->isgroup ==
"Y") {
149 $g =
new Group($dbf);
150 $g->iduser = $this->iduser;
151 $g->idgroup = $this->idgroup;
152 $err = $g->Add(
true);
155 $g->exec_query(
"delete from docperm where upacl=0 and unacl=0 and userid=" . $g->iduser);
156 $g->exec_query(
"update docperm set cacl=0 where cacl != 0 and userid=" . $g->iduser);
157 $g->exec_query(
"delete from permission where computed");
160 $p->deletePermission($g->iduser, null, null,
true);
169 $err = $this->
exec_query(
"delete from sessions where userid=" . $this->iduser);
173 $cmd = $wsh .
" --api=freedom_groups";
188 while (list($k, $gid) = each($this->groups)) {
189 $og =
new Group($this->dbaccess, $gid);
190 $allg = array_merge($allg, $og->GetAllGroups());
192 $allg = array_unique($allg);
207 if ($this->allgroups) {
208 foreach ($this->allgroups as $k => $v) {
209 if ($v[
"idgroup"] == $pgid) {
230 if ($this->allgroups) {
231 foreach ($this->allgroups as $k => $v) {
232 if ($v[
"iduser"] == $pgid) {
233 $gid = $v[
"idgroup"];
234 $groupsid[$gid] = $gid;
235 $this->levgid[$gid] = max($level, $this->levgid[$gid]);
249 $this->levgid = array();
253 asort($this->levgid);
254 foreach ($this->levgid as $k => $v) {
255 if ($v == 0) $groupsid[$k] = $k;
256 else $uasid[$k] = $k;
262 if (!isset($this->allgroups)) {
273 $list =
$query->Query(0, 0,
"TABLE",
"select * from groups where iduser in (select id from users where isgroup='Y')");
275 foreach (
$list as $v) {
276 $this->allgroups[] = $v;