From e4d3c628f3325e53aa8a87fd21db22b2faf685b2 Mon Sep 17 00:00:00 2001 From: Mateusz Rycombel Date: Thu, 18 Jun 2026 14:20:42 +0200 Subject: [PATCH 1/2] add permissions --- Plugin.php | 11 +++++++++++ lang/en/lang.php | 4 ++++ lang/pl/lang.php | 4 ++++ updates/version.yaml | 4 +++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Plugin.php b/Plugin.php index bfcb4b3..943a695 100644 --- a/Plugin.php +++ b/Plugin.php @@ -36,4 +36,15 @@ public function registerSettings() ] ]; } + + public function registerPermissions() + { + return [ + 'initbiz.gusapi.access_gusapi' => [ + 'label' => 'initbiz.gusapi::lang.permissions.label', + 'tab' => 'initbiz.gusapi::lang.permissions.tab', + 'order' => 100 + ] + ]; + } } diff --git a/lang/en/lang.php b/lang/en/lang.php index 30afe80..3dd30d3 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -12,4 +12,8 @@ 'gus_api_key' => 'API Key', 'gus_api_key_comment' => 'Set your key here. By default the testing one is set: abcde12345abcde12345', ], + 'permissions' => [ + 'label' => 'Manage GUS Api', + 'tab' => 'GUS Api' + ], ]; diff --git a/lang/pl/lang.php b/lang/pl/lang.php index b907610..d87e29f 100644 --- a/lang/pl/lang.php +++ b/lang/pl/lang.php @@ -12,4 +12,8 @@ 'gus_api_key' => 'Klucz API', 'gus_api_key_comment' => 'Wpisz tutaj swój klucz. Domyślnie jest ustawiony testowy: abcde12345abcde12345', ], + 'permissions' => [ + 'label' => 'Zarządzaj GUS Api', + 'tab' => 'GUS Api' + ], ]; diff --git a/updates/version.yaml b/updates/version.yaml index 75b42a5..8ba1ffb 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -7,4 +7,6 @@ 1.0.4: - 'Fixed null key' 2.0.0: - - 'Update gusapi/gusapi package' \ No newline at end of file + - 'Update gusapi/gusapi package' +2.1.0: + - 'Add permissions' \ No newline at end of file From 01695c3498c4cd37408de97b32c28d8b33f7aae9 Mon Sep 17 00:00:00 2001 From: Mateusz Rycombel Date: Wed, 24 Jun 2026 14:52:51 +0200 Subject: [PATCH 2/2] move plugin def to plugin.yaml --- Plugin.php | 51 ++++----------------------------------------------- plugin.yaml | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 47 deletions(-) create mode 100644 plugin.yaml diff --git a/Plugin.php b/Plugin.php index 943a695..7e95b83 100644 --- a/Plugin.php +++ b/Plugin.php @@ -1,50 +1,7 @@ - 'GusApi', - 'description' => 'Gus Api plugin for October CMS', - 'author' => 'Initbiz', - 'icon' => 'icon-leaf' - ]; - } +namespace Initbiz\GusApi; - public function registerSettings() - { - return [ - 'gusapi' => [ - 'label' => 'initbiz.gusapi::lang.settings.menu_gusapi_label', - 'description' => 'initbiz.gusapi::lang.settings.menu_gusapi_description', - 'category' => 'initbiz.gusapi::lang.settings.menu_category', - 'icon' => 'icon-cubes', - 'class' => 'Initbiz\GusApi\Models\Settings', - 'order' => 100 - ] - ]; - } +use System\Classes\PluginBase; - public function registerPermissions() - { - return [ - 'initbiz.gusapi.access_gusapi' => [ - 'label' => 'initbiz.gusapi::lang.permissions.label', - 'tab' => 'initbiz.gusapi::lang.permissions.tab', - 'order' => 100 - ] - ]; - } -} +class Plugin extends PluginBase {} diff --git a/plugin.yaml b/plugin.yaml new file mode 100644 index 0000000..7d53e62 --- /dev/null +++ b/plugin.yaml @@ -0,0 +1,21 @@ +plugin: + name: 'initbiz.gusapi::lang.plugin.name' + description: 'initbiz.gusapi::lang.plugin.description' + author: Initbiz + icon: icon-leaf + +settings: + gusapi: + label: initbiz.gusapi::lang.settings.menu_gusapi_label + description: initbiz.gusapi::lang.settings.menu_gusapi_description + category: initbiz.gusapi::lang.settings.menu_category + icon: icon-cubes + class: Initbiz\GusApi\Models\Settings + order: 100 + permissions: + - initbiz.gusapi.settings_access_gusapi + +permissions: + initbiz.gusapi.settings_access_gusapi: + tab: initbiz.gusapi::lang.permissions.tab + label: initbiz.gusapi::lang.permissions.label \ No newline at end of file