dump acos, aros

This commit is contained in:
Uwe Steinmann 2016-09-22 08:48:09 +02:00
parent 19d4d84e58
commit 159aa09636

View File

@ -1,5 +1,6 @@
<?php
require_once("../inc/inc.ClassSettings.php");
require_once("../inc/inc.ClassAcl.php");
function usage() { /* {{{ */
echo "Usage:\n";
@ -482,6 +483,37 @@ echo "<dms dbversion=\"".implode('.', array_slice($dms->getDBVersion(), 1, 3))."
/* Dump roles {{{ */
if(!$sections || in_array('roles', $sections)) {
/**
* Show tree of acos
*
*/
function aco_tree($aro=null, $aco=null, $indent='') { /* {{{ */
$tchildren = $aco->getChildren();
$html = '';
if($tchildren) {
foreach($tchildren as $child) {
if($child->getPermission($aro)) {
$html .= $indent."<aco id=\"".$child->getID()."\" alias=\"".$child->getAlias()."\">\n";
$html .= $indent." <attr name=\"permission\">".((int) $child->getPermission($aro))."</attr>\n";
//$html .= $indent." <attr name=\"alias\">".$child->getAlias()."</attr>\n";
//$html .= $indent." <attr name=\"aro\">".($aro ? $aro->getID() : 0)."</attr>\n";
if($thtml = aco_tree($aro, $child, $indent.' ')) {
$html .= $thtml;
}
$html .= $indent."</aco>\n";
} else {
if($thtml = aco_tree($aro, $child, $indent.' ')) {
$html .= $indent."<aco id=\"".$child->getID()."\" alias=\"".$child->getAlias()."\">\n";
//$html .= $indent." <attr name=\"alias\">".$child->getAlias()."</attr>\n";
$html .= $thtml;
$html .= $indent."</aco>\n";
}
}
}
}
return $html;
} /* }}} */
$roles = $dms->getAllRoles();
if($roles) {
echo "<roles>\n";
@ -490,6 +522,22 @@ if($roles) {
echo " <attr name=\"name\">".wrapWithCData($role->getName())."</attr>\n";
echo " <attr name=\"role\">".$role->getRole()."</attr>\n";
echo " <attr name=\"noaccess\">".implode(',', $role->getNoAccess())."</attr>\n";
$aro = SeedDMS_Aro::getInstance($role, $dms);
if($acos = SeedDMS_Aco::getRoot($dms)) {
foreach($acos as $aco) {
echo " <aco id=\"".$aco->getID()."\" alias=\"".$aco->getAlias()."\">\n";
if($aco->getPermission($aro)) {
echo " <attr name=\"permission\">".((int) $aco->getPermission($aro))."</attr>\n";
// echo " <attr name=\"alias\">".$aco->getAlias()."</attr>\n";
// echo " <attr name=\"aro\">".($aro ? $aro->getID() : 0)."</attr>\n";
} else {
// echo " <attr name=\"alias\">".$aco->getAlias()."</attr>\n";
}
if($html = aco_tree($aro, $aco, ' '))
echo $html;
echo " </aco>\n";
}
}
echo " </role>\n";
$statistic['roles']++;
}
@ -746,6 +794,7 @@ if($folder) {
/* }}} */
/* Dump transmittals {{{ */
if(!$sections || in_array('transmittals', $sections)) {
$transmittals = $dms->getAllTransmittals();
if($transmittals) {
echo "<transmittals>\n";
@ -771,6 +820,7 @@ if($transmittals) {
}
echo "</transmittals>\n";
}
}
/* }}} */
/* Dump statistics {{{ */