mirror of
https://github.com/webmasterskaya/joomla-oauth-server.git
synced 2024-11-23 22:34:50 +03:00
Add default scopes
This commit is contained in:
parent
2a7cad85db
commit
0f895497b8
@ -9,13 +9,14 @@
|
|||||||
|
|
||||||
namespace Webmasterskaya\Component\OauthServer\Administrator\Model;
|
namespace Webmasterskaya\Component\OauthServer\Administrator\Model;
|
||||||
|
|
||||||
use Joomla\CMS\Component\ComponentHelper;
|
|
||||||
use Joomla\CMS\MVC\Model\BaseModel;
|
use Joomla\CMS\MVC\Model\BaseModel;
|
||||||
use Joomla\CMS\MVC\Model\ItemModelInterface;
|
use Joomla\CMS\MVC\Model\ItemModelInterface;
|
||||||
|
use Joomla\CMS\MVC\Model\ListModelInterface;
|
||||||
|
use Webmasterskaya\Component\OauthServer\Administrator\ValueObject\Scope;
|
||||||
|
|
||||||
\defined('_JEXEC') or die;
|
\defined('_JEXEC') or die;
|
||||||
|
|
||||||
class ScopeModel extends BaseModel implements ItemModelInterface
|
class ScopeModel extends BaseModel implements ItemModelInterface, ListModelInterface
|
||||||
{
|
{
|
||||||
private const PREDEFINED_SCOPES = ['userinfo', 'email'];
|
private const PREDEFINED_SCOPES = ['userinfo', 'email'];
|
||||||
private static array $_storage;
|
private static array $_storage;
|
||||||
@ -25,10 +26,33 @@ class ScopeModel extends BaseModel implements ItemModelInterface
|
|||||||
// TODO: Implement getItem() method.
|
// TODO: Implement getItem() method.
|
||||||
}
|
}
|
||||||
|
|
||||||
private function fillStorage(): void
|
private function fillStorage(): array
|
||||||
{
|
{
|
||||||
$config = ComponentHelper::getParams('com_oauthserver');
|
if (isset(self::$_storage))
|
||||||
|
{
|
||||||
|
return self::$_storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$_storage = [
|
||||||
|
'userinfo' => new Scope(
|
||||||
|
'userinfo',
|
||||||
|
'COM_OAUTHSERVER_SCOPE_USERINFO',
|
||||||
|
'COM_OAUTHSERVER_SCOPE_USERINFO_DESCRIPTION'
|
||||||
|
),
|
||||||
|
'email' => new Scope(
|
||||||
|
'email',
|
||||||
|
'COM_OAUTHSERVER_SCOPE_EMAIL',
|
||||||
|
'COM_OAUTHSERVER_SCOPE_EMAIL_DESCRIPTION'
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getItems()
|
||||||
|
{
|
||||||
|
// TODO: Implement getItems() method.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user