mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 18:24:50 +03:00
_JEXEC & copyright
This commit is contained in:
parent
9a4ff028f4
commit
ffc26f48a8
@ -1,21 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_oauthserver
|
||||
*
|
||||
* @copyright (c) 2024. Webmasterskaya. <https://webmasterskaya.xyz>
|
||||
* @license MIT; see LICENSE.txt
|
||||
**/
|
||||
|
||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Model;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
use Joomla\CMS\Table\Table;
|
||||
use Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable;
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
class AccessTokenModel extends AdminModel implements RevokedModelInterface
|
||||
{
|
||||
use GetItemByIdentifierTrait;
|
||||
use RevokedModelTrait;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* @since version
|
||||
*/
|
||||
public function getForm($data = [], $loadData = true): Form|bool
|
||||
{
|
||||
$form = $this->loadForm('com_oauthserver.access_token', 'access_token', ['control' => 'jform', 'load_data' => $loadData]);
|
||||
|
||||
if (empty($form)) {
|
||||
if (empty($form))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -23,11 +39,7 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the data that should be injected in the form.
|
||||
*
|
||||
* @return mixed The data for the form.
|
||||
*
|
||||
* @throws \Exception
|
||||
* @inheritdoc
|
||||
* @since version
|
||||
*/
|
||||
protected function loadFormData(): mixed
|
||||
@ -35,7 +47,8 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface
|
||||
// Check the session for previously entered form data.
|
||||
$data = Factory::getApplication()->getUserState('com_oauthserver.edit.access_token.data', []);
|
||||
|
||||
if (empty($data)) {
|
||||
if (empty($data))
|
||||
{
|
||||
$data = $this->getItem();
|
||||
}
|
||||
|
||||
@ -45,19 +58,30 @@ class AccessTokenModel extends AdminModel implements RevokedModelInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable $table
|
||||
* @param \Webmasterskaya\Component\OauthServer\Administrator\Table\AccessTokenTable $table
|
||||
*
|
||||
* @return void
|
||||
* @since version
|
||||
*/
|
||||
protected function prepareTable($table)
|
||||
{
|
||||
if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable) {
|
||||
if ($table->expiry instanceof \DateTime || $table->expiry instanceof \DateTimeImmutable)
|
||||
{
|
||||
$table->expiry = $table->expiry->format($table->getDbo()->getDateFormat());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $prefix
|
||||
* @param $options
|
||||
*
|
||||
* @return bool|Table|AccessTokenTable
|
||||
* @throws \Exception
|
||||
* @since version
|
||||
*/
|
||||
public function getTable($name = 'AccessToken', $prefix = 'Administrator', $options = [])
|
||||
{
|
||||
return parent::getTable($name, $prefix, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user