17 include_once (
"FDL/Class.Doc.php");
18 include_once (
"FDL/Class.VGroup.php");
29 $usage->setStrictMode(
false);
30 $usage->setDefinitionText(
"view or modify document accessibilities");
31 $docid =
$usage->addRequiredParameter(
"id",
"document identifier to profil");
32 $gid =
$usage->addOptionalParameter(
"gid",
"group identificator, view user access for this group");
33 $green = (
$usage->addOptionalParameter(
"allgreen",
"view only up acl", array(
37 $viewgroup = (
$usage->addOptionalParameter(
"group",
"view group", array(
41 $limit =
$usage->addOptionalParameter(
"memberLimit",
"when gid option is set, limit members to display", array() , 100);
45 $action->parent->AddJsRef($action->GetParam(
"CORE_JSURL") .
"/subwindow.js");
46 $action->parent->AddJsRef($action->GetParam(
"CORE_JSURL") .
"/geometry.js");
47 $action->parent->AddJsRef($action->GetParam(
"CORE_JSURL") .
"/AnchorPosition.js");
48 $action->parent->addJsRef(
"lib/jquery/jquery.js");
49 $action->parent->addCssRef(
"css/dcp/jquery-ui.css");
56 $acls[] =
"modifyacl";
62 $width = floor(70 / count($acls));
63 $action->lay->set(
"cellwidth", $width .
'%');
67 foreach ($acls as $k => $v) {
69 $desc = isset(
$doc->dacls[$v]) ?
$doc->dacls[$v][
"description"] :
"";
71 $desc =
$doc->extendedAcls[$v][
"description"];
76 $hacl[$k][
"oddoreven"] = ($k % 2) ?
"even" :
"odd";
79 $action->lay->SetBlockData(
"DACLS", $hacl);
80 $action->lay->
Set(
"title",
$doc->title);
81 $action->lay->
Set(
"hasgid", ($gid > 0));
82 $action->lay->
Set(
"stitle", str_replace(array(
85 ) ,
"",
$doc->title));
89 $sql = sprintf(
"SELECT users.* from docperm,users where docperm.docid=%d and users.id=docperm.userid and docperm.upacl != 0 order by users.lastname",
$doc->profid);
92 foreach ($tusers as $k => $v) {
93 $tgreenUid[] = $v[
"id"];
94 $title[$v[
"id"]] = $v[
"firstname"] .
" " . $v[
"lastname"];
99 "accountType" => $v[
"accounttype"],
100 "displaygroup" => ($v[
"accounttype"] !=
"U") ?
"inline" :
"none"
104 if (
$doc->extendedAcls) {
106 $sql = sprintf(
"select users.id, users.firstname, users.lastname,users.accounttype, array_agg(docpermext.acl) as acls from docpermext,users where users.id=docpermext.userid and docpermext.docid=%d",
$doc->profid);
107 if (!empty($tgreenUid))
$sql.= sprintf(
" and id not in (%s)", implode(
',', $tgreenUid));
108 $sql.=
" group by users.id, users.firstname, users.lastname, users.accounttype ;";
112 foreach ($tusers as $k => $v) {
114 $title[$v[
"id"]] = $v[
"firstname"] .
" " . $v[
"lastname"];
119 "extacl" => $v[
"acls"],
120 "accountType" => $v[
"accounttype"],
121 "displaygroup" => ($v[
"accounttype"] !=
"U") ?
"inline" :
"none"
125 }
else if ($gid == 0) {
130 $tidAccount = array_merge($ouser->getGroupList(
"TABLE") , $ouser->getRoleList(
"TABLE"));
132 $tidAccount = $ouser->getRoleList(
"TABLE");
137 foreach ($tidAccount as $k => $v) {
138 $g =
new Group(
"", $v[
"id"]);
140 $title[$v[
"id"]] = $v[
"firstname"] .
" " . $v[
"lastname"];
141 foreach ($g->groups as $kg => $gid) {
143 $hg[$gid][$v[
"id"]] = $v;
144 $sgroup[$v[
"id"]] = $v[
"id"];
149 foreach ($tidAccount as $k => $v) {
150 if (!in_array($v[
"id"], $sgroup)) {
152 $tg = array_merge($tg,
getTableG($hg, $v[
"id"], $v[
"accounttype"]));
155 if ($action->user->id > 1) {
158 "gid" => $action->user->id,
160 "accountType" =>
"U",
161 "displaygroup" =>
"none"
163 $title[$action->user->id] = $action->user->firstname .
" " . $action->user->lastname;
168 $ouser =
new Account(
"", $gid);
169 if ($ouser->accounttype ==
'G') {
170 $tusers = $ouser->getGroupUserList(
"TABLE",
false, $limit);
172 $tusers = $ouser->getAllMembers($limit,
false);
174 if (count($tusers) == $limit) $action->AddWarningMsg(sprintf(_(
"limit reached, only %d members has been displayed") , $limit));
180 "accountType" => $ouser->accounttype,
181 "displaygroup" =>
"none"
183 $title[$gid] = $ouser->firstname .
" " . $ouser->lastname;
185 foreach ($tusers as $k => $v) {
188 $action->AddWarningMsg(sprintf(_(
"Not all users can be vieved.\nlimit %d has been reached") , $k));
191 $title[$v[
"id"]] = $v[
"firstname"] .
" " . $v[
"lastname"];
196 "accountType" => $v[
"accounttype"],
197 "displaygroup" =>
"none"
203 if (
$doc->getRawValue(
"DPDOC_FAMID") > 0) {
206 $pattr = $pdoc->GetProfilAttributes();
210 foreach ($pattr as $k => $v) {
212 if (!$vg->isAffected()) {
220 "accountType" => $v->isMultiple() ?
"M" :
"D",
221 "displaygroup" =>
"none"
223 $title[$vg->num] = $v->getLabel();
228 foreach ($tg as $k => $v) {
230 $tg[$k][
"gname"] =
$title[$v[
"gid"]];
231 $tg[$k][
"ACLS"] =
"ACL$k";
232 $action->lay->setBlockData(
"ACL$k", $tacl[$v[
"gid"]]);
235 $action->lay->setBlockData(
"GROUPS", $tg);
236 $action->lay->set(
"docid",
$doc->id);
238 $action->lay->eset(
"allgreen", $action->
getArgument(
"allgreen",
"N"));
239 $action->lay->set(
"viewgroup", (
bool)$viewgroup);
240 $action->lay->eset(
"group", $action->
getArgument(
"group",
"N"));
241 $action->lay->set(
"isgreen", (
bool)$green);
243 $action->lay->set(
"profcount",
"");
244 $action->lay->set(
"cellWidth",
"65");
245 if (count($acls) > 15) $action->lay->set(
"cellWidth",
"50");
247 $action->lay->set(
"updateWaitText", sprintf(_(
"Update profiling is in progress.")));
249 $action->lay->set(
"MODIFY",
true);
250 $action->lay->set(
"dmodify",
"");
251 if (
$doc->isRealProfile()) {
252 if (
$doc->getRawValue(
"dpdoc_famid")) {
260 if ($cont > 1) $action->lay->set(
"profcount", sprintf(_(
"%d documents linked to the profil") , $cont));
261 else $action->lay->set(
"profcount", _(
"only one document linked to the profil"));
262 $action->lay->set(
"updateWaitText", sprintf(_(
"Update profiling of %d documents is in progress.") , $cont));
266 $action->lay->set(
"dmodify",
"none");
267 $action->lay->set(
"MODIFY",
false);
270 $action->lay->
Set(
"toOrigin",
$doc->getDocAnchor(
$doc->id,
'account',
true,
false,
false,
'latest',
true));
273 $action->lay->
Set(
"dynamic",
true);
274 $action->lay->
Set(
"dprofid",
$doc->dprofid);
275 $action->lay->
Set(
"toDynProfil",
$doc->getHtmlTitle(
$doc->dprofid));
276 $action->lay->
Set(
"ComputedFrom", _(
"Computed from profil"));
277 } elseif (
$doc->profid !=
$doc->id) {
279 $action->lay->
Set(
"dynamic",
true);
280 $action->lay->
Set(
"dprofid",
$doc->profid);
281 $action->lay->
Set(
"toDynProfil",
$doc->getHtmlTitle(
$doc->profid));
282 $action->lay->
Set(
"ComputedFrom", _(
"Linked from profil"));
284 $action->lay->
Set(
"dynamic",
false);
286 $action->lay->setBlockData(
"legendcolor", array(
288 "legendimage" =>
"G",
289 "legendexplication" => _(
"Legend:Groups")
292 "legendimage" =>
"U",
293 "legendexplication" => _(
"Legend:Users")
296 "legendimage" =>
"R",
297 "legendexplication" => _(
"Legend:Roles")
300 "legendimage" =>
"D",
301 "legendexplication" => _(
"Legend:Dynamic")
304 "legendimage" =>
"M",
305 "legendexplication" => _(
"Legend:Dynamic multiple")
315 "level" => $level * 10,
317 "accountType" =>
$type,
318 "displaygroup" =>
"inline"
321 if (isset($hg[$id])) {
322 foreach ($hg[$id] as $kg =>
$account) {
338 foreach ($acls as $k => $v) {
339 $tableacl[$k][
"aclname"] = $v;
341 if (!$extAcl && isset($dacls[$v])) $pos = $dacls[$v][
"pos"];
342 $tableacl[$k][
"selected"] =
"";
343 $tableacl[$k][
"bimg"] =
"1x1.gif";
344 $tableacl[$k][
"oddoreven"] = ($k % 2) ?
"even" :
"odd";
345 $tableacl[$k][
"aclid"] = $v;
346 $tableacl[$k][
"iacl"] = $v;
348 $tableacl[$k][
"aclname"] = $extAcl;
351 if ($grant ==
'green') {
352 $tableacl[$k][
"bimg"] =
"bgreen.png";
353 $tableacl[$k][
"selected"] =
"checked";
355 $tableacl[$k][
"bimg"] =
"bgrey.png";
358 } elseif ($perm->ControlUp($pos)) {
359 $tableacl[$k][
"selected"] =
"checked";
360 $tableacl[$k][
"bimg"] =
"bgreen.png";
362 if ($perm->ControlU($pos)) {
363 $tableacl[$k][
"bimg"] =
"bgrey.png";
getTacl($dbaccess, $dacls, $acls, $docid, $gid, $extAcl= '')
exitError($texterr, $exit=true, $code="")
static hasExtAclGrant($docid, $accountId, $aclName)
Verify arguments for action function.
new_Doc($dbaccess, $id= '', $latest=false)
getTableG($hg, $id, $type, $level=0)
static getArgument($k, $def= '')
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err