<?php // include_once($this->store->get_config("code")."modules/mod_grant.php"); include_once "dialog.grants.logic.php"; $data = $this->getdata('data'); echo "<p>The grants specified below will be set. If you are satisfied with the changes, please press 'Apply' once more to set the grants.</p>"; echo "<table width=\"100%\">"; echo "<tr><th>" . $ARnls["path"] . "</th><th>User/group</th><th>" . $ARnls["grants"] . "</th></tr>"; foreach ($data as $gpath => $gusers) { foreach ($gusers as $upath => $value) { echo "<tr><td>" . htmlspecialchars($gpath) . "</td><td>" . htmlspecialchars($upath) . "</td>"; if (is_array($value['grants']['array'])) { echo "<td>" . htmlentities(grantsArrayToString($value["grants"]["array"]), ENT_QUOTES, 'UTF-8') . "</td>"; } else { echo "<td>" . htmlentities($value['grants']['grantsstring'], ENT_QUOTES, 'UTF-8') . "</td>"; } echo "</tr>"; } } echo "</table>";
$formdata = $data[$selectedpath][$path]; $stored_formdata = $stored_vars['data'][$selectedpath][$path]; // Merge info fromdata form with $info $info['grants'] = arrayMergeCorrect($info['grants'], $stored_formdata['grants']); $info['grants'] = arrayMergeCorrect($info['grants'], $formdata['grants']); // $info['grants'] = array_merge($info['grants'], $stored_formdata['grants'], $formdata['grants']); // echo "<pre>"; // print_r($info['grants']); if (isset($textswitch) && $textswitch == 1) { $grants = (array) $formdata['grants']['array']; foreach ($grants as $key => $val) { if ($val == 8) { $grants[$key] = $formdata['grants']['bytype'][$key]; } } $info['grants']['grantsstring'] = grantsArrayToString($grants); } else { if (isset($textswitch) && $textswitch == 0) { $g_comp = new mod_grant(); $newgrants = array(); // print_r($info['grants']); $g_comp->compile($formdata['grants']['grantsstring'], $newgrants); $grants_by_type = array(); foreach ($newgrants as $grantname => $grantvalue) { if (!isset($available_grants[$grantname])) { $available_grants[$grantname] = yui::labelspan($grantname, 8); } if (is_array($grantvalue)) { $grants_by_type[$grantname] = $grantvalue; $newgrants[$grantname] = ARGRANTBYTYPE; }
<?php include_once $this->store->get_config("code") . "modules/mod_yui.php"; $grants = array(); $userPath = $this->getvar('selecteduser'); if ($this->exists($userPath)) { $user = current($this->get($userPath, 'system.get.phtml')); $userName = $user->data->name; if (is_array($user->data->config->usergrants)) { foreach ($user->data->config->usergrants as $grantsPath => $grantsArray) { if (sizeof($grantsArray) && $this->exists($grantsPath)) { $object = current($this->get($grantsPath, 'system.get.phtml')); $grants[$grantsPath] = array('name' => $object->nlsdata->name, 'type' => $object->type, 'grants' => array('array' => $grantsArray, 'string' => grantsArrayToString($grantsArray))); } } } } /* $other_grants = array( "/sites/mysite/" => array( "name" => "My site", "type" => "psite", "grants" => array( "string" => "add edit read" ) ), "/sites/mysite/two/" => array( "name" => "Section two", "type" => "psection", "grants" => array( "string" => "read" )
$userGroups[$userGroupPath] = $group; } } $allInactive = false; $grantsPathPrev = ''; $grantsPath = $this->getvar('selectedpath'); $grantsList = array(); do { $object = current($this->get($grantsPath, 'system.get.phtml')); if ($user->data->config->usergrants[$grantsPath]) { array_unshift($grantsList, array('active' => !$allInactive, 'object' => array('path' => $object->path, 'type' => $object->type), 'owner' => array('name' => $user->data->name, 'path' => $user->path, 'type' => $user->type), 'grants' => array('array' => $user->data->config->usergrants[$grantsPath], 'string' => grantsArrayToString($user->data->config->usergrants[$grantsPath])))); $allInactive = true; } foreach ($userGroups as $group) { if ($group->data->config->usergrants[$grantsPath]) { array_unshift($grantsList, array('active' => $group->active & !$allInactive, 'object' => array('path' => $object->path, 'type' => $object->type), 'owner' => array('name' => $group->data->name, 'path' => $group->path, 'type' => $group->type), 'grants' => array('array' => $group->data->config->usergrants[$grantsPath], 'string' => grantsArrayToString($group->data->config->usergrants[$grantsPath])))); $group->active = false; } } $grantsPathPrev = $grantsPath; $grantsPath = $this->make_path($grantsPath, '..'); } while ($grantsPath != $grantsPathPrev); } ?> <div class="explain"> <h2><?php echo $ARnls['ariadne:grants:grants_explained']; echo $userName; ?> </h2> <?php