list_perm_templ.php
author rejo
Thu, 27 Mar 2008 21:10:34 +0000
changeset 105 df46fd74c2ee
parent 85 1687c1b107fa
child 110 455405c757e1
permissions -rw-r--r--
[feladat @ 205] Bugfix. A user with with at least view access could change user details, including the assigned permission template, for which he did have rights. Reported by Maarten te Paske.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
82
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     1
<?php
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     2
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     3
/*  PowerAdmin, a friendly web-based admin tool for PowerDNS.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     4
 *  See <https://rejo.zenger.nl/poweradmin> for more details.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     5
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     6
 *  Copyright 2007, 2008  Rejo Zenger <rejo@zenger.nl>
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     7
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     8
 *  This program is free software: you can redistribute it and/or modify
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
     9
 *  it under the terms of the GNU General Public License as published by
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    10
 *  the Free Software Foundation, either version 3 of the License, or
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    11
 *  (at your option) any later version.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    12
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    13
 *  This program is distributed in the hope that it will be useful,
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    16
 *  GNU General Public License for more details.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    17
 *
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    18
 *  You should have received a copy of the GNU General Public License
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    19
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    20
 */
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    21
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    22
require_once("inc/toolkit.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    23
include_once("inc/header.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    24
verify_permission(templ_perm_edit) ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    25
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    26
$permission_templates = get_list_permission_templates() ;
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    27
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    28
if ($perm_templ_perm_edit == "0") {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    29
	error(ERR_PERM_EDIT_PERM_TEMPL);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    30
} else {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    31
	echo "    <h2>" . _('Permission templates') . "</h2>\n"; 
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    32
	echo "     <table>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    33
	echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    34
	echo "       <th>&nbsp;</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    35
	echo "       <th>" . _('Name') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    36
	echo "       <th>" . _('Description') . "</th>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    37
	echo "      </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    38
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    39
	foreach ($permission_templates as $template) {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    40
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    41
		$perm_item_list = get_permissions_by_template_id($template['id'], true);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    42
		$perm_items = implode(', ', $perm_item_list);
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    43
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    44
		echo "      <tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    45
		if ($perm_templ_perm_edit == "1") {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    46
			echo "       <td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    47
			echo "        <a href=\"edit_perm_templ.php?id=" . $template["id"] . "\"><img src=\"images/edit.gif\" alt=\"[ " . _('Edit template') . "\" ]></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    48
			echo "        <a href=\"delete_perm_templ.php?id=" . $template["id"] . "\"><img src=\"images/delete.gif\" alt=\"[ " . _('Delete template') . "\" ]></a>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    49
			echo "       </td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    50
		} else {
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    51
			echo "       <td>&nbsp;</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    52
		}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    53
		echo "       <td class=\"y\">" . $template['name'] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    54
		echo "       <td class=\"y\">" . $template['descr'] . "</td>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    55
		echo "      </tr>\n";
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    56
	}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    57
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    58
	echo "     </table>\n";
85
1687c1b107fa [feladat @ 185]
rejo
parents: 82
diff changeset
    59
        echo "     <p>" . _('Add') . " <a href=\"add_perm_templ.php\">" . _('permission template') . "</a>.</p>\n";
82
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    60
}
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    61
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    62
include_once("inc/footer.inc.php");
c255196bc447 [feladat @ 182]
rejo
parents:
diff changeset
    63
?>