diff --git a/com_oauthserver/administrator/src/Model/ScopeModel.php b/com_oauthserver/administrator/src/Model/ScopeModel.php index e4c55ac..c258c06 100644 --- a/com_oauthserver/administrator/src/Model/ScopeModel.php +++ b/com_oauthserver/administrator/src/Model/ScopeModel.php @@ -9,13 +9,14 @@ namespace Webmasterskaya\Component\OauthServer\Administrator\Model; -use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\MVC\Model\BaseModel; use Joomla\CMS\MVC\Model\ItemModelInterface; +use Joomla\CMS\MVC\Model\ListModelInterface; +use Webmasterskaya\Component\OauthServer\Administrator\ValueObject\Scope; \defined('_JEXEC') or die; -class ScopeModel extends BaseModel implements ItemModelInterface +class ScopeModel extends BaseModel implements ItemModelInterface, ListModelInterface { private const PREDEFINED_SCOPES = ['userinfo', 'email']; private static array $_storage; @@ -25,10 +26,33 @@ class ScopeModel extends BaseModel implements ItemModelInterface // 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. } }