diff options
Diffstat (limited to 'app/views/admin/api')
| -rw-r--r-- | app/views/admin/api/config.php | 35 | ||||
| -rw-r--r-- | app/views/admin/api/edit.php | 136 | ||||
| -rw-r--r-- | app/views/admin/api/index.php | 77 | ||||
| -rw-r--r-- | app/views/admin/api/permissions.php | 62 |
4 files changed, 0 insertions, 310 deletions
diff --git a/app/views/admin/api/config.php b/app/views/admin/api/config.php deleted file mode 100644 index 83d2ae5..0000000 --- a/app/views/admin/api/config.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * @var Admin_ApiController $controller - * @var array $config - */ -use Studip\Button, Studip\LinkButton; -?> - -<form class="default" action="<?= $controller->url_for('admin/api/config') ?>" method="post"> - <fieldset> - <legend><?= _('Konfiguration') ?></legend> - - <input type="hidden" name="active" value="0"> - <label> - <input type="checkbox" name="active" value="1" <? if ($config['API_ENABLED']) echo 'checked'; ?>> - <?= _('REST-API aktiviert') ?> - </label> - - - <label class="caption" for="auth"> - <?= _('Standard-Authentifizierung beim Login') ?> - <select name="auth" id="auth"> - <? foreach ($GLOBALS['STUDIP_AUTH_PLUGIN'] as $plugin): ?> - <option <? if ($config['API_OAUTH_AUTH_PLUGIN'] === $plugin) echo 'selected'; ?>> - <?= $plugin ?> - </option> - <? endforeach; ?> - </select> - </label> - </fieldset> - <footer> - <?= Button::createAccept(_('Speichern')) ?> - <?= LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admin/api')) ?> - </footer> -</form> diff --git a/app/views/admin/api/edit.php b/app/views/admin/api/edit.php deleted file mode 100644 index f1c7e03..0000000 --- a/app/views/admin/api/edit.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * @var Admin_ApiController $controller - * @var RESTAPI\Consumer\Base $consumer - * @var array $types - */ -use Studip\Button, Studip\LinkButton; -?> - -<? if ($consumer->id): ?> - <h1> - <?= sprintf( - _('Registrierte Applikation "%s" bearbeiten'), - htmlReady($consumer->title) - ) ?> - </h1> -<? else: ?> - <h1 class="hide-in-dialog"> - <?= _('Neue Applikation registrieren') ?> - </h1> -<? endif; ?> - -<form class="settings default" - action="<?= $controller->url_for('admin/api/edit', $consumer->id) ?>" method="post"> - <?= CSRFProtection::tokenTag() ?> - - <fieldset> - <legend><?= _('Grundeinstellungen') ?></legend> - - <label for="active"> - <input type="checkbox" class="switch" id="active" name="active" value="1" - <?= $consumer->active ? 'checked' : '' ?>> - <?= _('Aktiviert') ?> - </label> - - - <label for="title"> - <?= _('Titel') ?> - <input required type="text" id="title" name="title" - placeholder="<?= _('Beispiel-Applikation') ?>" - value="<?= htmlReady($consumer->title) ?>" - maxlength="128"> - </label> - - <label for="contact"> - <?= _('Kontaktperson') ?> - <input required type="text" id="contact" name="contact" - placeholder="John Doe" - value="<?= htmlReady($consumer->contact) ?>" - maxlength="255"> - </label> - - <label for="email"> - <?= _('Kontaktadresse') ?> - <input required type="text" id="email" name="email" - placeholder="support@appsite.tld" - value="<?= htmlReady($consumer->email) ?>" - maxlength="255"> - </label> - - <label for="callback"> - <?= _('Callback URL') ?> - <input required type="text" id="callback" name="callback" - placeholder="http://appsite.tld/auth" - value="<?= htmlReady($consumer->callback) ?>" - maxlength="255"> - </label> - - <? if ($consumer->id): ?> - <label for="consumer_key"> - <?= _('Consumer Key') ?> - <input readonly type="text" id="consumer_key" - value="<?= htmlReady($consumer->auth_key) ?>"> - </label> - - <label for="consumer_secret"> - <?= _('Consumer Secret') ?> - <input readonly type="text" id="consumer_secret" - value="<?= htmlReady($consumer->auth_secret) ?>"> - </label> - - <div class="centered"> - <?= strftime(_('Erstellt am %d.%m.%Y %H:%M:%S'), $consumer->mkdate) ?><br> - <? if ($consumer->mkdate != $consumer->chdate): ?> - <?= strftime(_('Zuletzt geändert am %d.%m.%Y %H:%M:%S'), $consumer->chdate) ?> - <? endif; ?> - </div> - <? endif; ?> - </fieldset> - - <fieldset> - <legend><?= _('Applikation-Details') ?></legend> - - <label for="commercial"> - <input type="checkbox" class="switch" id="commercial" name="commercial" value="1" - <?= $consumer->commercial ? 'checked' : '' ?>> - <?= _('Kommerziell') ?> - </label> - - <label for="description"> - <?= _('Beschreibung') ?> - <textarea id="description" name="description" maxlength="65535"><?= htmlReady($consumer->description) ?></textarea> - </label> - - <label for="url"> - <?= _('URL') ?> - <input type="text" id="url" name="url" - placeholder="http://appsite.tld" - value="<?= htmlReady($consumer->url) ?>" - maxlength="255"> - </label> - - <label for="type"> - <?= _('Typ') ?> - <select name="type" id="type"> - <option value="">- <?= _('Keine Angabe') ?> -</option> - <? foreach ($types as $type => $label): ?> - <option value="<?= $type ?>" <?= $consumer->type == $type ? 'selected' : '' ?>> - <?= $label ?> - </option> - <? endforeach; ?> - </select> - </label> - - - <label for="notes"> - <?= _('Notizen') ?> - <textarea id="notes" name="notes" maxlength="65535"><?= htmlReady($consumer->notes) ?></textarea> - </label> - </fieldset> - - <footer data-dialog-button> - <?= Button::createAccept(_('Speichern'), 'store') ?> - <?= LinkButton::createCancel(_('Abbrechen'), $controller->url_for('admin/api')) ?> - </footer> -</form> diff --git a/app/views/admin/api/index.php b/app/views/admin/api/index.php deleted file mode 100644 index 132deac..0000000 --- a/app/views/admin/api/index.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * @var Admin_ApiController $controller - * @var RESTAPI\Consumer\Base[] $consumers - * @var array $types - */ -?> -<? if (!empty($consumers)): ?> -<form action="#" method="post" class="default"> -<table class="default"> - <caption><?= _('Registrierte Applikationen') ?></caption> - <thead> - <tr> - <th><?= ('Aktiv') ?></th> - <th><?= _('Name') ?></th> - <th><?= _('Typ') ?></th> - <th><?= _('Kontakt') ?></th> - <th><?= _('Kommerziell') ?></th> - <th> </th> - </tr> - </thead> - <tbody> -<? foreach ($consumers as $consumer): ?> - <tr> - <td id="<?= $consumer->id ?>"> - <a href="<?= $controller->url_for('admin/api/toggle', $consumer->id, $consumer->active ? 'off' : 'on') ?>"> - <?= Icon::create('checkbox-' . ($consumer->active ? '' : 'un') . 'checked', 'clickable')->asImg() ?> - </a> - </td> - <td> - <? if ($consumer->url): ?> - <a href="<?= htmlReady($consumer->url) ?>" target="_blank" rel="noopener noreferrer"> - <?= htmlReady($consumer->title) ?> - </a> - <? else: ?> - <?= htmlReady($consumer->title) ?> - <? endif; ?> - </td> - <td><?= $types[$consumer->type] ?? ' ' ?></td> - <td> - <a href="mailto:<?= htmlReady($consumer->email) ?>"> - <?= htmlReady($consumer->contact) ?> - </a> - </td> - - <td><?= Icon::create('checkbox-' . ($consumer->commercial ? '' : 'un') . 'checked', 'clickable')->asImg() ?></td> - <td class="actions"> - <a href="<?= $controller->url_for('admin/api/keys', $consumer->id) ?>" - data-dialog="size=auto" - title="<?= htmlReady(sprintf(_('Schlüssel anzeigen für Applikation "%s"'), $consumer->title)) ?>"> - <?= Icon::create('info-circle', 'clickable')->asImg() ?> - </a> - <a href="<?= $controller->url_for('admin/api/edit', $consumer->id) ?>" title="<?= _('Applikation bearbeiten') ?>" data-dialog> - <?= Icon::create('edit', 'clickable')->asImg() ?> - </a> - <a href="<?= $controller->url_for('admin/api/permissions', $consumer->id) ?>" title="<?= _('Zugriffsberechtigungen verwalten') ?>"> - <?= Icon::create('admin', 'clickable')->asImg() ?> - </a> - <?= Icon::create('trash')->asInput([ - 'formaction' => $controller->url_for('admin/api/delete/', $consumer->id), - 'title' => sprintf(_('Applikation "%s" entfernen'), $consumer->title), - 'data-confirm' => '', - 'style' => 'vertical-align: middle' - ]) ?> - </td> - </tr> -<? endforeach; ?> - </tbody> -</table> -</form> - -<? else: ?> -<p> - <?= MessageBox::info(_('Es wurde noch keine Applikation registriert.'), - [sprintf(_('Klicken Sie <a href="%s">hier</a>, um eine Applikation zu registrieren.'), $controller->url_for('admin/api/edit'))]) ?> -</p> -<? endif; ?> diff --git a/app/views/admin/api/permissions.php b/app/views/admin/api/permissions.php deleted file mode 100644 index 9eb48e3..0000000 --- a/app/views/admin/api/permissions.php +++ /dev/null @@ -1,62 +0,0 @@ -<?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> </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> |
