mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 22:34:50 +03:00
Страница с oauth клиентами
This commit is contained in:
parent
f4dc0127a9
commit
39a878f2c8
@ -4,20 +4,48 @@
|
|||||||
<inlinehelp button="show"/>
|
<inlinehelp button="show"/>
|
||||||
</config>
|
</config>
|
||||||
<fieldset name="global">
|
<fieldset name="global">
|
||||||
<field name="client_name" type="text"
|
<field name="name"
|
||||||
label="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_NAME_LABEL"
|
type="text"
|
||||||
description="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_NAME_DESCRIPTION"
|
label="COM_OAUTHSERVER_CLIENT_NAME_LABEL"
|
||||||
|
description="COM_OAUTHSERVER_NAME_DESCRIPTION"
|
||||||
required="1"
|
required="1"
|
||||||
/>
|
/>
|
||||||
<field name="client_token"
|
<field name="public"
|
||||||
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
label="COM_OAUTHSERVER_CLIENT_PUBLIC_LABEL"
|
||||||
|
description="COM_OAUTHSERVER_CLIENT_PUBLIC_DESCRIPTION"
|
||||||
|
filter="boolean"
|
||||||
|
default="0">
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
<field name="redirect_uri"
|
||||||
|
type="url"
|
||||||
|
filter="url"
|
||||||
|
validate="url"
|
||||||
|
label="COM_OAUTHSERVER_CLIENT_REDIRECT_URI_LABEL"
|
||||||
|
description="COM_OAUTHSERVER_CLIENT_REDIRECT_URI_DESCRIPTION"/>
|
||||||
|
|
||||||
|
<field name="allow_plain_text_pkce"
|
||||||
|
type="radio"
|
||||||
|
layout="joomla.form.field.radio.switcher"
|
||||||
|
label="COM_OAUTHSERVER_CLIENT_ALLOW_PLAIN_TEXT_PKCE_LABEL"
|
||||||
|
description="COM_OAUTHSERVER_CLIENT_ALLOW_PLAIN_TEXT_PKCE_DESCRIPTION"
|
||||||
|
filter="boolean"
|
||||||
|
default="1">
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
<field name="identifier"
|
||||||
type="text"
|
type="text"
|
||||||
readonly="1"
|
readonly="1"
|
||||||
label="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_TOKEN_LABEL"
|
label="COM_OAUTHSERVER_CLIENT_IDENTIFIER_LABEL"
|
||||||
description="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_TOKEN_DESCRIPTION"/>
|
description="COM_OAUTHSERVER_CLIENT_IDENTIFIER_DESCRIPTION"/>
|
||||||
<field name="client_id"
|
<field name="secret"
|
||||||
type="text"
|
type="text"
|
||||||
readonly="1"
|
readonly="1"
|
||||||
label="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_ID_LABEL"
|
label="COM_OAUTHSERVER_CLIENT_SECRET_LABEL"
|
||||||
description="COM_OAUTHSERVER_CLIENT_FORM_CLIENT_ID_DESCRIPTION"/>
|
description="COM_OAUTHSERVER_CLIENT_SECRET_DESCRIPTION"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
@ -0,0 +1,4 @@
|
|||||||
|
COM_OAUTHSERVER_CLIENTS_HEADING_NAME = "Клиент"
|
||||||
|
COM_OAUTHSERVER_CLIENTS_HEADING_IDENTIFIER = "ID клиента"
|
||||||
|
COM_OAUTHSERVER_CLIENTS_HEADING_SECRET = "Ключ"
|
||||||
|
COM_OAUTHSERVER_CLIENTS_HEADING_PUBLIC = "Публичный"
|
@ -96,7 +96,7 @@ class ClientsModel extends ListModel
|
|||||||
|
|
||||||
$query = $db->getQuery(true);
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
$query->select(['client.id', 'client.client_name', 'client.client_token', 'client.client_id',])
|
$query->select(['client.id', 'client.name', 'client.secret', 'client.identifier', 'client.public', 'client.redirect_uri', 'client.allow_plain_text_pkce'])
|
||||||
->from($db->qn('#__webmasterskaya_oauthserver_clients', 'client'));
|
->from($db->qn('#__webmasterskaya_oauthserver_clients', 'client'));
|
||||||
|
|
||||||
// Filter by search state
|
// Filter by search state
|
||||||
|
@ -9,6 +9,7 @@ use Joomla\CMS\Language\Text;
|
|||||||
use Joomla\CMS\MVC\View\GenericDataException;
|
use Joomla\CMS\MVC\View\GenericDataException;
|
||||||
use Joomla\CMS\Object\CMSObject;
|
use Joomla\CMS\Object\CMSObject;
|
||||||
use Joomla\CMS\Pagination\Pagination;
|
use Joomla\CMS\Pagination\Pagination;
|
||||||
|
use Joomla\CMS\Toolbar\Toolbar;
|
||||||
use Joomla\CMS\Toolbar\ToolbarFactoryInterface;
|
use Joomla\CMS\Toolbar\ToolbarFactoryInterface;
|
||||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ class HtmlView extends \Joomla\CMS\MVC\View\HtmlView
|
|||||||
$canDo = ContentHelper::getActions('com_oauthserver', 'clients');
|
$canDo = ContentHelper::getActions('com_oauthserver', 'clients');
|
||||||
|
|
||||||
$user = $this->getCurrentUser();
|
$user = $this->getCurrentUser();
|
||||||
$toolbar = Factory::getContainer()->get(ToolbarFactoryInterface::class)->createToolbar('toolbar');
|
$toolbar = Toolbar::getInstance('toolbar');
|
||||||
|
|
||||||
// Set page title
|
// Set page title
|
||||||
ToolbarHelper::title(Text::_('COM_OAUTHSERVER') . ': ' . Text::_('COM_OAUTHSERVER_CLIENTS'));
|
ToolbarHelper::title(Text::_('COM_OAUTHSERVER') . ': ' . Text::_('COM_OAUTHSERVER_CLIENTS'));
|
||||||
|
@ -1,2 +1,107 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
|
use Joomla\CMS\HTML\HTMLHelper;
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\CMS\Layout\LayoutHelper;
|
||||||
|
use Joomla\CMS\Router\Route;
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var \Webmasterskaya\Component\OauthServer\Administrator\View\Clients\HtmlView $this
|
||||||
|
*/
|
||||||
|
|
||||||
|
$wa = $this->document->getWebAssetManager();
|
||||||
|
$wa->useScript('table.columns')
|
||||||
|
->useScript('multiselect');
|
||||||
|
$user = Factory::getApplication()->getIdentity();
|
||||||
|
$userId = $user->get('id');
|
||||||
|
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||||
|
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<form action="<?php echo Route::_('index.php?option=com_oauthserver&view=clients'); ?>" method="post" name="adminForm"
|
||||||
|
id="adminForm">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div id="j-main-container" class="j-main-container">
|
||||||
|
<?php
|
||||||
|
// Search tools bar
|
||||||
|
echo LayoutHelper::render('joomla.searchtools.default', ['view' => $this]);
|
||||||
|
?>
|
||||||
|
<?php if (empty($this->items)) : ?>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<span class="icon-info-circle" aria-hidden="true"></span><span
|
||||||
|
class="visually-hidden"><?php echo Text::_('INFO'); ?></span>
|
||||||
|
<?php echo Text::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<table class="table" id="clientList">
|
||||||
|
<caption class="visually-hidden">
|
||||||
|
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_TABLE_CAPTION'); ?>,
|
||||||
|
<span id="orderedBy"><?php echo Text::_('JGLOBAL_SORTED_BY'); ?> </span>,
|
||||||
|
<span id="filteredBy"><?php echo Text::_('JGLOBAL_FILTERED_BY'); ?></span>
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td class="w-1 text-center">
|
||||||
|
<?php echo HTMLHelper::_('grid.checkall'); ?>
|
||||||
|
</td>
|
||||||
|
<th scope="col">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'COM_OAUTHSERVER_CLIENTS_HEADING_NAME', 'client.name', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_HEADING_IDENTIFIER'); ?>
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
<?php echo Text::_('COM_OAUTHSERVER_CLIENTS_HEADING_SECRET'); ?>
|
||||||
|
</th>
|
||||||
|
<th scope="col">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'COM_OAUTHSERVER_CLIENTS_HEADING_PUBLIC', 'client.public', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="w-5 d-none d-md-table-cell">
|
||||||
|
<?php echo HTMLHelper::_('searchtools.sort', 'JGRID_HEADING_ID', 'client.id', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($this->items as $i => $item) : ?>
|
||||||
|
|
||||||
|
<?php $canCreate = $user->authorise('core.create', 'com_oauthserver.clients');
|
||||||
|
$canEdit = $user->authorise('core.edit', 'com_oauthserver.clients');
|
||||||
|
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || is_null($item->checked_out);
|
||||||
|
$canChange = $user->authorise('core.edit.state', 'com_oauthserver.clients') && $canCheckin; ?>
|
||||||
|
<tr class="row<?php echo $i % 2; ?>">
|
||||||
|
<td class="text-center">
|
||||||
|
<?php echo HTMLHelper::_('grid.id', $i, $item->id, false, 'cid', 'cb', $item->name); ?>
|
||||||
|
</td>
|
||||||
|
<td class="small text-start">
|
||||||
|
<?php echo $item->name; ?>
|
||||||
|
</td>
|
||||||
|
<td class="small text-center d-none d-md-table-cell">
|
||||||
|
<?php echo $item->identifier; ?>
|
||||||
|
</td>
|
||||||
|
<td class="small d-none d-md-table-cell">
|
||||||
|
<?php echo $item->secret; ?>
|
||||||
|
</td>
|
||||||
|
<td class="small d-none d-md-table-cell">
|
||||||
|
<?php echo Text::_((bool) $item->public ? 'JYES' : 'JNO'); ?>
|
||||||
|
</td>
|
||||||
|
<td class="small text-center">
|
||||||
|
<?php echo $item->id; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="task" value="">
|
||||||
|
<input type="hidden" name="boxchecked" value="0">
|
||||||
|
<?php echo HTMLHelper::_('form.token'); ?>
|
||||||
|
</form>
|
Loading…
Reference in New Issue
Block a user