21 include_once (
"FDL/Class.Doc.php");
35 $perm =
new DocPerm($dbaccess, array(
42 $acls[] =
"modifyacl";
47 $action->lay->
Set(
"docid",
$doc->id);
48 $action->lay->
Set(
"userid",
$user->id);
49 foreach ($acls as $k => $acl) {
50 $tableacl[$k][
"aclname"] =
mb_ucfirst(_($acl));
52 if (!empty(
$doc->dacls[$acl][
"description"])) {
54 $tableacl[$k][
"acldesc"] = _(
$doc->dacls[$acl][
"description"]);
56 $tableacl[$k][
"acldesc"] =
"";
59 $tableacl[$k][
"aclid"] = $acl;
60 $tableacl[$k][
"iacl"] = $acl;
61 if (isset(
$doc->extendedAcls[$acl])) {
63 if ($grant ==
'green') {
65 $tableacl[$k][
"selectedup"] =
"checked";
66 $tableacl[$k][
"imgacl"] =
"bgreen.png";
68 $tableacl[$k][
"selectedup"] =
"";
69 if ($grant ==
'grey') {
70 $tableacl[$k][
"imgacl"] =
"bgrey.png";
72 $tableacl[$k][
"imgacl"] =
"bred.png";
77 $pos =
$doc->dacls[$acl][
"pos"];
78 if ($perm->ControlUp($pos)) {
80 $tableacl[$k][
"selectedup"] =
"checked";
81 $tableacl[$k][
"imgacl"] =
"bgreen.png";
83 $tableacl[$k][
"selectedup"] =
"";
84 if ($perm->ControlU($pos)) {
85 $tableacl[$k][
"imgacl"] =
"bgrey.png";
87 $tableacl[$k][
"imgacl"] =
"bred.png";
93 $action->lay->set(
"readonly", (
$doc->control(
"modifyacl") !=
'' ||
$doc->dprofid ||
$doc->profid !=
$doc->id));
94 $action->lay->setBlockData(
"SELECTACL", $tableacl);
95 $action->lay->set(
"updateWaitText", sprintf(_(
"Update profiling is in progress.")));
100 $Aclpos = isset($doc->dacls[$acl][
"pos"]) ? $doc->dacls[$acl][
"pos"] : -1;
103 if (!$doc->dprofid) {
105 if ($doc->profid == $doc->id) {
106 $msg = sprintf(_(
"Direct set through document itself \"%s\"") , $doc->getHtmlTitle());
109 $msg = sprintf(_(
"Set through \"%s\" linked profil") , $doc->getHtmlTitle($doc->profid));
113 $dperm =
new DocPerm($perm->dbaccess, array(
119 if ($dperm->isAffected()) {
120 if ($dperm->ControlUp($Aclpos)) {
121 $tAtt[] = sprintf(_(
"explicit privilege"));
122 $msg = sprintf(_(
"Set from template profil \"%s\"") , $doc->getHtmlTitle($doc->dprofid));
124 $msg = sprintf(_(
"Something wrong. No acl found in %s (user #%d)") , $doc->getHtmlTitle($doc->dprofid) , $perm->userid);
128 $sql = sprintf(
'select vgroup.id as aid from docperm,vgroup where docid=%d and userid >= %d and upacl & %d != 0 and docperm.userid=vgroup.num', $doc->dprofid,
STARTIDVGROUP, 1 << $Aclpos);
130 foreach ($dynAids as $aid) {
133 $tva = explode(
"\n", str_replace(
'<BR>',
"\n", $va));
134 if (in_array($user->fid, $tva)) {
136 if ($oa) $alabel = $oa->getLabel();
138 $tAtt[] = sprintf(_(
"the attribute %s") , htmlspecialchars($alabel));
142 if (count($tAtt) > 0) {
143 $sAtt =
'<ul><li>' . implode(
'</li><li>', $tAtt) .
'</li></ul>';
144 $msg = sprintf(_(
"Set by %s from template profil \"%s\"") , $sAtt, $doc->getHtmlTitle($doc->dprofid));
148 $msg =
'? role/group';
149 if (!$doc->dprofid) {
151 $msg =
'? profid role/group';
152 if (isset($doc->extendedAcls[$acl])) {
153 $sql = sprintf(
"SELECT userid from docpermext where docid=%d and acl = '%s'", $doc->profid, pg_escape_string($acl));
155 $sql = sprintf(
"SELECT userid from docperm where docid=%d and upacl & %d != 0", $doc->profid, 1 << $Aclpos);
160 $asIds = array_intersect($gids, $mo);
162 if (count($asIds) > 0) {
163 $sql = sprintf(
"select fid, accounttype, lastname, login from users where %s",
GetSqlCond($asIds,
"id",
true));
167 foreach ($uas as $as) {
168 if ($as[
"accounttype"] ==
'R') {
169 $tFrom[] = sprintf(_(
"Role \"%s\"") , htmlspecialchars($as[
"lastname"]));
171 $tFrom[] = sprintf(_(
"Group \"%s\"") , htmlspecialchars($as[
"lastname"]));
174 if (count($tFrom) > 0) {
175 $sFrom =
'<ul><li>' . implode(
'</li><li>', $tFrom) .
'</li></ul>';
177 $sFrom = implode(
', ', $tFrom);
180 if ($doc->profid == $doc->id) {
181 $msg = sprintf(_(
"Set by %s through document itself \"%s\"") , $sFrom, $doc->getHtmlTitle());
183 $msg = sprintf(_(
"Set by %s through \"%s\" linked profil") , $sFrom, $doc->getHtmlTitle($doc->profid));
186 $msg =
'? dprofid role/group';
188 $sql = sprintf(
"SELECT userid from docperm where docid=%d and upacl & %d != 0", $doc->dprofid, 1 << $Aclpos);
192 $asIds = array_intersect($gids, $mo);
194 if (count($asIds) > 0) {
195 $sql = sprintf(
"select fid, accounttype, lastname, login from users where %s",
GetSqlCond($asIds,
"id",
true));
199 foreach ($uas as $as) {
200 if ($as[
"accounttype"] ==
'R') {
201 $tFrom[] = sprintf(_(
"Role \"%s\"") , htmlspecialchars($as[
"lastname"]));
203 $tFrom[] = sprintf(_(
"Group \"%s\"") , htmlspecialchars($as[
"lastname"]));
206 if (count($tFrom) > 0) {
207 $sFrom =
'<ul><li>' . implode(
'</li><li>', $tFrom) .
'</li></ul>';
209 $sFrom = implode(
', ', $tFrom);
211 $msg = sprintf(_(
"Set by %s through template profil \"%s\"") , $sFrom, $doc->getHtmlTitle($doc->dprofid));
213 $msg = sprintf(_(
"Set by %s through template profil \"%s\"") , $sFrom, $doc->getHtmlTitle($doc->dprofid));
215 $sql = sprintf(
'select vgroup.id as aid from docperm,vgroup where docid=%d and userid >= %d and upacl & %d != 0 and docperm.userid=vgroup.num', $doc->dprofid,
STARTIDVGROUP, 1 << $Aclpos);
216 simpleQuery($perm->dbaccess, $sql, $dynAids,
true);
218 foreach ($dynAids as $aid) {
221 $tva = explode(
"\n", str_replace(
'<BR>',
"\n", $va));
222 $as = array_intersect($tva, $mo);
223 if (count($as) > 0) {
225 if ($oa) $alabel = $oa->getLabel();
228 foreach ($as as $gid) {
229 $gv[] = $doc->getHtmlTitle($gid);
232 $msg = sprintf(_(
"Set by \"%s\" attribute (%s) from template profil \"%s\"") , htmlspecialchars($alabel) , implode(
', ', $gv) , $doc->getHtmlTitle($doc->dprofid));
& getAttribute($idAttr, &$oa=null, $useMask=true)
exitError($texterr, $exit=true, $code="")
getAclCause($acl, Doc &$doc, DocPerm &$perm, Account &$user)
static hasExtAclGrant($docid, $accountId, $aclName)
new_Doc($dbaccess, $id= '', $latest=false)
GetSqlCond($Table, $column, $integer=false)
static getArgument($k, $def= '')
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err
getRawValue($idAttr, $def="")
getMemberOf($useSystemId=true)