summaryrefslogtreecommitdiff
path: root/core/views/permissions_form.html.php
blob: f0b6706366979d1fc221506dc6f302688d7ee209 (plain)
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
<?php defined("SYSPATH") or die("No direct script access.") ?>
<form method="post" action="<?= url::site("permissions/edit/$item->id") ?>">
  <?= access::csrf_form_field() ?>
  <fieldset>
    <legend> <?= t("Edit Permissions") ?> </legend>

    <table>
      <tr>
        <th> </th>
        <? foreach ($groups as $group): ?>
        <th> <?= $group->name ?> </th>
        <? endforeach ?>
      </tr>

      <? foreach ($permissions as $permission): ?>
      <tr>
        <td> <?= t($permission->display_name) ?> </td>
        <? foreach ($groups as $group): ?>
        <td>
          <? $intent = access::group_intent($group, $permission->name, $item) ?>
          <? $allowed = access::group_can($group, $permission->name, $item) ?>
          <? $lock = access::locked_by($group, $permission->name, $item) ?>

          <? if ($lock): ?>
            <?= t("denied and locked by") ?> <a href="javascript:show(<?= $lock->id ?>)"><?= t("parent") ?></a>
          <? else: ?>
            <? if ($intent === null): ?>
              <? if ($allowed): ?>
                <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)">allowed by parent</a>
              <? else: ?>
                <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)">denied by parent</a>
              <? endif ?>
            <? elseif ($intent === access::DENY): ?>
              <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)">denied</a>
            <? elseif ($intent === access::ALLOW): ?>
              <? if ($item->id == 1): ?>
              <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)">allowed</a>
              <? else: ?>
              <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)">allowed</a>
              <? endif ?>
            <? endif ?>
          <? endif ?>
        </td>
        <? endforeach ?>
      </tr>
      <? endforeach ?>
    </table>
  </fieldset>
</form>