-
Notifications
You must be signed in to change notification settings - Fork 1
/
editsecgroup.inc.php
125 lines (111 loc) · 4.77 KB
/
editsecgroup.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
require "includes/form-messages.inc.php";
if (!showResults($result)) {
# Retrieve the requested security group
$permList = $tplHelper->getSecGroupPerms($securitygroup['id']);
?>
<table class="ui-widget ui-widget-content secgroupperms" summary="Permissions">
<thead>
<tr class="ui-widget-header head">
<th><?php echo _('Permission'); ?></th>
<th><?php echo _('Object'); ?></th>
<?php if ($securitygroup['id'] > 5) { ?>
<th><?php echo _('Delete'); ?></th>
<th><?php echo _('Deny/Allow'); ?></th>
<?php } ?>
<th>|</th>
<th><?php echo _('Permission'); ?></th>
<th><?php echo _('Object'); ?></th>
<?php if ($securitygroup['id'] > 5) { ?>
<th><?php echo _('Delete'); ?></th>
<th><?php echo _('Deny/Allow'); ?></th>
<?php } ?>
</tr>
</thead>
<tbody id="secgroupermlist">
<?php
# make sure we have an even number of permissions so that both columns are always filled in
$nrOfPermission = count($permList);
if ($nrOfPermission % 2 == 1) {
$permList[] = array('permissionid' => -1,
'permissionname' => ' ',
'objectid' => ' ');
# we now have one permission more
$nrOfPermission++;
}
$rows = $nrOfPermission / 2;
for($i = 0; $i < $rows; $i++) {
echo '<tr>';
for($j = 0; $j < 2; $j++) {
($j==0)?$perm = $permList[$i]:$perm = $permList[$i+$rows];
?>
<td> <?php echo $perm['permissionname']; ?> </td>
<td> <?php echo $perm['objectid']; ?> </td>
<?php if ($securitygroup['id'] > 5) {
if ($perm['permissionid'] != -1) { ?>
<td>
<form action="<?php echo $tplHelper->makeEditSecGroupAction(); ?>" method="post">
<input type="hidden" name="editsecgroupform[permissionid]" value="<?php echo $perm['permissionid']; ?>">
<input type="hidden" name="editsecgroupform[objectid]" value="<?php echo $perm['objectid']; ?>">
<input type="hidden" name="editsecgroupform[xsrfid]" value="<?php echo $tplHelper->generateXsrfCookie('editsecgroupform'); ?>">
<input type="hidden" name="editsecgroupform[http_referer]" value="<?php echo $http_referer; ?>">
<input type="hidden" name="groupid" value="<?php echo $securitygroup['id']; ?>">
<input class="smallGreyButton" type="submit" name="editsecgroupform[submitremoveperm]" value="<?php echo _('Delete'); ?>">
</form>
</td>
<td>
<form action="<?php echo $tplHelper->makeEditSecGroupAction(); ?>" method="post">
<input type="hidden" name="editsecgroupform[permissionid]" value="<?php echo $perm['permissionid']; ?>">
<input type="hidden" name="editsecgroupform[objectid]" value="<?php echo $perm['objectid']; ?>">
<input type="hidden" name="editsecgroupform[xsrfid]" value="<?php echo $tplHelper->generateXsrfCookie('editsecgroupform'); ?>">
<input type="hidden" name="editsecgroupform[http_referer]" value="<?php echo $http_referer; ?>">
<input type="hidden" name="groupid" value="<?php echo $securitygroup['id']; ?>">
<?php if ($perm['deny']) { ?>
<input class="smallGreyButton" type="submit" name="editsecgroupform[submitsetallow]" value="<?php echo _('Denied'); ?>" title="<?php echo _('Set to allow'); ?>">
<?php } else { ?>
<input class="smallGreyButton" type="submit" name="editsecgroupform[submitsetdeny]" value="<?php echo _('Allowed'); ?>" title="<?php echo _('Set to deny'); ?>">
<?php } ?>
</form>
</td>
<?php } else { ?>
<td> </td><td> </td>
<?php } # else
} # if ?>
<?php
if ($j == 0) {
echo '<td></td>';
} # if
} // for j
echo '</tr>';
}
?>
</tbody>
</table>
<br >
<br >
<!-- Security recht toevoegen -->
<?php if ($securitygroup['id'] > 5) { ?>
<form class="editsecgroupform" name="editsecgroupform" action="<?php echo $tplHelper->makeEditSecGroupAction(); ?>" method="post">
<input type="hidden" name="editsecgroupform[xsrfid]" value="<?php echo $tplHelper->generateXsrfCookie('editsecgroupform'); ?>">
<input type="hidden" name="editsecgroupform[http_referer]" value="<?php echo $http_referer; ?>">
<input type="hidden" name="groupid" value="<?php echo $securitygroup['id']; ?>">
<fieldset>
<dt><label for="editsecgroupform[permissionid]"><?php echo _('Add the following rights'); ?></label></dt>
<dd>
<select name="editsecgroupform[permissionid]">
<?php foreach($tplHelper->getAllAvailablePerms() as $key => $val) { ?>
<option value="<?php echo $key; ?>"><?php echo $val; ?></option>
<?php } ?>
</select>
</dd>
<dt><label for="editsecgroupform[objectid]"><?php echo _('ObjectID (normally empty)'); ?></label></dt>
<dd>
<input type="text" name="editsecgroupform[objectid]" />
</dd>
<dd>
<input class="smallGreyButton" type="submit" name="editsecgroupform[submitaddperm]" value="<?php echo _('Add'); ?>">
</dd>
</fieldset>
</form>
<?php }
}