mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-24 02:44:51 +03:00
_JEXEC & copyright
This commit is contained in:
parent
f821c9becb
commit
ce0b9a6bc9
@ -1,10 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
use Joomla\CMS\Table\Table;
|
use Joomla\CMS\Table\Table;
|
||||||
use Joomla\Database\DatabaseDriver;
|
use Joomla\Database\DatabaseDriver;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $identifier
|
* @property string $identifier
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
use Joomla\CMS\Table\Table;
|
use Joomla\CMS\Table\Table;
|
||||||
use Joomla\Database\DatabaseDriver;
|
use Joomla\Database\DatabaseDriver;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
* @property string $identifier
|
* @property string $identifier
|
||||||
|
@ -1,21 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
use Joomla\CMS\Table\Table;
|
use Joomla\CMS\Table\Table;
|
||||||
use Joomla\Database\DatabaseDriver;
|
use Joomla\Database\DatabaseDriver;
|
||||||
use League\OAuth2\Server\Entities\ClientEntityInterface;
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id;
|
* @property int $id ;
|
||||||
* @property string $identifier;
|
* @property string $identifier ;
|
||||||
* @property string $name;
|
* @property string $name ;
|
||||||
* @property ?string $secret;
|
* @property ?string $secret ;
|
||||||
* @property string|array|null $redirect_uris;
|
* @property string|array|null $redirect_uris ;
|
||||||
* @property string|array|null $grants;
|
* @property string|array|null $grants ;
|
||||||
* @property string|array|null $scopes;
|
* @property string|array|null $scopes ;
|
||||||
* @property int $active;
|
* @property int $active ;
|
||||||
* @property int $public;
|
* @property int $public ;
|
||||||
* @property int $allow_plain_text_pkce;
|
* @property int $allow_plain_text_pkce;
|
||||||
*
|
*
|
||||||
* @since version
|
* @since version
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
use DateTimeImmutable;
|
|
||||||
use Joomla\CMS\Table\Table;
|
use Joomla\CMS\Table\Table;
|
||||||
use Joomla\Database\DatabaseDriver;
|
use Joomla\Database\DatabaseDriver;
|
||||||
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
|
|
||||||
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property int $id
|
* @property int $id
|
||||||
|
@ -1,7 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
interface RevokedTableInterface
|
interface RevokedTableInterface
|
||||||
{
|
{
|
||||||
public function revoke($pks = null): bool;
|
public function revoke($pks = null): bool;
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Administrator
|
||||||
|
* @subpackage com_oauthserver
|
||||||
|
*
|
||||||
|
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||||
|
* @license MIT; see LICENSE.txt
|
||||||
|
**/
|
||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Table;
|
||||||
|
|
||||||
use Joomla\CMS\Event\AbstractEvent;
|
use Joomla\CMS\Event\AbstractEvent;
|
||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
|
use Joomla\Database\DatabaseDriver;
|
||||||
|
|
||||||
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
trait RevokedTableTrait
|
trait RevokedTableTrait
|
||||||
{
|
{
|
||||||
@ -29,22 +39,14 @@ trait RevokedTableTrait
|
|||||||
protected $_tbl_keys = [];
|
protected $_tbl_keys = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \Joomla\Database\DatabaseDriver
|
* @var DatabaseDriver
|
||||||
* @since version
|
* @since version
|
||||||
* @noinspection PhpMissingFieldTypeInspection
|
* @noinspection PhpMissingFieldTypeInspection
|
||||||
*/
|
*/
|
||||||
protected $_db;
|
protected $_db;
|
||||||
|
|
||||||
abstract public function getDispatcher();
|
|
||||||
|
|
||||||
abstract public function setError($error);
|
|
||||||
|
|
||||||
abstract public function getColumnAlias($column);
|
|
||||||
|
|
||||||
abstract public function getDbo();
|
abstract public function getDbo();
|
||||||
|
|
||||||
abstract public function appendPrimaryKeys($query, $pk = null);
|
|
||||||
|
|
||||||
public function revoke($pks = null): bool
|
public function revoke($pks = null): bool
|
||||||
{
|
{
|
||||||
// Pre-processing by observers
|
// Pre-processing by observers
|
||||||
@ -57,26 +59,35 @@ trait RevokedTableTrait
|
|||||||
);
|
);
|
||||||
$this->getDispatcher()->dispatch('onTableBeforeRevoke', $event);
|
$this->getDispatcher()->dispatch('onTableBeforeRevoke', $event);
|
||||||
|
|
||||||
if (!\is_null($pks)) {
|
if (!\is_null($pks))
|
||||||
if (!\is_array($pks)) {
|
{
|
||||||
|
if (!\is_array($pks))
|
||||||
|
{
|
||||||
$pks = [$pks];
|
$pks = [$pks];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pks as $key => $pk) {
|
foreach ($pks as $key => $pk)
|
||||||
if (!\is_array($pk)) {
|
{
|
||||||
|
if (!\is_array($pk))
|
||||||
|
{
|
||||||
$pks[$key] = [$this->_tbl_key => $pk];
|
$pks[$key] = [$this->_tbl_key => $pk];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no primary keys set check to see if the instance key is set.
|
// If there are no primary keys set check to see if the instance key is set.
|
||||||
if (empty($pks)) {
|
if (empty($pks))
|
||||||
|
{
|
||||||
$pk = [];
|
$pk = [];
|
||||||
|
|
||||||
foreach ($this->_tbl_keys as $key) {
|
foreach ($this->_tbl_keys as $key)
|
||||||
if ($this->$key) {
|
{
|
||||||
|
if ($this->$key)
|
||||||
|
{
|
||||||
$pk[$key] = $this->$key;
|
$pk[$key] = $this->$key;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// We don't have a full primary key - return false
|
// We don't have a full primary key - return false
|
||||||
$this->setError(Text::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
|
$this->setError(Text::_('JLIB_DATABASE_ERROR_NO_ROWS_SELECTED'));
|
||||||
|
|
||||||
@ -89,7 +100,8 @@ trait RevokedTableTrait
|
|||||||
|
|
||||||
$revokedField = $this->getColumnAlias('revoked');
|
$revokedField = $this->getColumnAlias('revoked');
|
||||||
|
|
||||||
foreach ($pks as $pk) {
|
foreach ($pks as $pk)
|
||||||
|
{
|
||||||
$query = $this->_db->getQuery(true)
|
$query = $this->_db->getQuery(true)
|
||||||
->update($this->_db->quoteName($this->_tbl))
|
->update($this->_db->quoteName($this->_tbl))
|
||||||
->set($this->_db->quoteName($revokedField) . ' = 0');
|
->set($this->_db->quoteName($revokedField) . ' = 0');
|
||||||
@ -99,9 +111,12 @@ trait RevokedTableTrait
|
|||||||
|
|
||||||
$this->_db->setQuery($query);
|
$this->_db->setQuery($query);
|
||||||
|
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
$this->_db->execute();
|
$this->_db->execute();
|
||||||
} catch (\RuntimeException $e) {
|
}
|
||||||
|
catch (\RuntimeException $e)
|
||||||
|
{
|
||||||
$this->setError($e->getMessage());
|
$this->setError($e->getMessage());
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -110,13 +125,16 @@ trait RevokedTableTrait
|
|||||||
// If the Table instance value is in the list of primary keys that were set, set the instance.
|
// If the Table instance value is in the list of primary keys that were set, set the instance.
|
||||||
$ours = true;
|
$ours = true;
|
||||||
|
|
||||||
foreach ($this->_tbl_keys as $key) {
|
foreach ($this->_tbl_keys as $key)
|
||||||
if ($this->$key != $pk[$key]) {
|
{
|
||||||
|
if ($this->$key != $pk[$key])
|
||||||
|
{
|
||||||
$ours = false;
|
$ours = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ours) {
|
if ($ours)
|
||||||
|
{
|
||||||
$this->$revokedField = 0;
|
$this->$revokedField = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,4 +153,12 @@ trait RevokedTableTrait
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract public function getDispatcher();
|
||||||
|
|
||||||
|
abstract public function setError($error);
|
||||||
|
|
||||||
|
abstract public function getColumnAlias($column);
|
||||||
|
|
||||||
|
abstract public function appendPrimaryKeys($query, $pk = null);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user