aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/api/permissions.php
blob: 9eb48e36e1fb94cabb754888b6de26a6e78b47b4 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
 * @var Admin_ApiController $controller
 * @var RESTAPI\ConsumerPermissions $permissions
 * @var string $consumer_id
 * @var array $routes
 * @var bool $global
 */
?>
<form action="<?= $controller->url_for('admin/api/permissions', $consumer_id) ?>" method="post" class="default">
<table class="default">
    <thead>
        <tr>
            <th><?= _('Zugriff') ?></th>
            <th><?= _('Route') ?></th>
            <th><?= _('Methoden') ?></th>
            <th><?= _('Zugriff auf') ?></th>
            <th><?= _('Quelle') ?></th>
        </tr>
    </thead>
<? foreach ($routes as $route => $methods): ?>
    <tbody>

    <? $i = 0; ?>
    <? foreach ($methods as $method => $info): ?>
        <tr style="vertical-align: top;">
            <td>
                <input type="hidden" name="permission[<?= urlencode($route) ?>][<?= urlencode($method) ?>]" value="0">
                <input type="checkbox" name="permission[<?= urlencode($route) ?>][<?= urlencode($method) ?>]"
                <? if (!$global || $global->check($route, $method)): ?>
                    <? if ($permissions->check($route, $method)) echo 'checked'; ?>
                <? else: ?>
                    disabled
                <? endif; ?>
                    value="1">
            </td>
        <? if ($i++): ?>
            <td>&nbsp;</td>
        <? else: ?>
            <td><?= htmlReady($route) ?></td>
        <? endif; ?>
            <td><?= htmlReady($method) ?></td>
            <td><?= htmlReady($info['description']) ?></td>
            <td><?= $info['source'] ?></td>
        </tr>
    <? endforeach; ?>
    </tbody>
<? endforeach; ?>
    <tfoot>
        <tr>
            <td>
                <label>
                    <input type="checkbox" data-proxyfor="[name^=permission]:checkbox"> <?= _('Alle') ?>
                </label>
            </td>
            <td colspan="4">
                <?= Studip\Button::createAccept(_('Speichern'), 'store') ?>
            </td>
        </tr>
    </tfoot>
</table>
</form>