Ejemplo n.º 1
0
 function setaclForm(&$header, $post_args, $pagehash)
 {
     $acl = $post_args['acl'];
     //FIXME: find intersection of all pages perms, not just from the last pagename
     $pages = array();
     foreach ($pagehash as $name => $checked) {
         if ($checked) {
             $pages[] = $name;
         }
     }
     $perm_tree = pagePermissions($name);
     $table = pagePermissionsAclFormat($perm_tree, !empty($pages));
     $header->pushContent(HTML::strong(_("Selected Pages: ")), HTML::tt(join(', ', $pages)), HTML::br());
     $first_page = $GLOBALS['request']->_dbi->getPage($name);
     $owner = $first_page->getOwner();
     list($type, $perm) = pagePermissionsAcl($perm_tree[0], $perm_tree);
     //if (DEBUG) $header->pushContent(HTML::pre("Permission tree for $name:\n",print_r($perm_tree,true)));
     if ($type == 'inherited') {
         $type = sprintf(_("page permission inherited from %s"), $perm_tree[1][0]);
     } elseif ($type == 'page') {
         $type = _("individual page permission");
     } elseif ($type == 'default') {
         $type = _("default page permission");
     }
     $header->pushContent(HTML::strong(_("Type") . ': '), HTML::tt($type), HTML::br());
     $header->pushContent(HTML::strong(_("ACL") . ': '), HTML::tt($perm->asAclLines()), HTML::br());
     $header->pushContent(HTML::p(HTML::strong(_("Description") . ': '), _("Selected Grant checkboxes allow access, unselected checkboxes deny access."), _("To ignore delete the line."), _("To add check 'Add' near the dropdown list.")));
     $header->pushContent($table);
     //
     // display array of checkboxes for existing perms
     // and a dropdown for user/group to add perms.
     // disabled if inherited,
     // checkbox to disable inheritance,
     // another checkbox to progate new permissions to all childs (if there exist some)
     //Todo:
     // warn if more pages are selected and they have different perms
     //$header->pushContent(HTML::input(array('name' => 'admin_setacl[acl]',
     //                                       'value' => $post_args['acl'])));
     $header->pushContent(HTML::br());
     if (!empty($pages) and defined('EXPERIMENTAL') and EXPERIMENTAL) {
         $checkbox = HTML::input(array('type' => 'checkbox', 'name' => 'admin_setacl[updatechildren]', 'value' => 1));
         if (!empty($post_args['updatechildren'])) {
             $checkbox->setAttr('checked', 'checked');
         }
         $header->pushContent($checkbox, _("Propagate new permissions to all subpages?"), HTML::raw("  "), HTML::em(_("(disable individual page permissions, enable inheritance)?")), HTML::br(), HTML::em(_("(Currently not working)")));
     }
     $header->pushContent(HTML::hr());
     return $header;
 }
Ejemplo n.º 2
0
 function _getValue($page_handle, &$revision_handle)
 {
     $perm_tree = pagePermissions($page_handle->_pagename);
     return pagePermissionsAclFormat($perm_tree);
 }