Skip to content

Commit

Permalink
[fix] global role check for plugin modules
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Apr 23, 2024
1 parent 9fade7a commit b33e7be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions app/Domain/Plugins/Controllers/Details.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Leantime\Domain\Plugins\Controllers;

use Leantime\Core\Controller;
use Leantime\Domain\Auth\Models\Roles;
use Leantime\Domain\Auth\Services\Auth;
use Leantime\Domain\Plugins\Services\Plugins as PluginService;
use Symfony\Component\HttpFoundation\Response;

Expand All @@ -27,6 +29,9 @@ public function init(PluginService $pluginService): void
*/
public function get(): Response
{

Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);

if (! $this->incomingRequest->query->has('id')) {
throw new \Exception('Plugin Identifier is required');
}
Expand Down
5 changes: 5 additions & 0 deletions app/Domain/Plugins/Controllers/Marketplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Leantime\Domain\Plugins\Controllers;

use Leantime\Core\Controller;
use Leantime\Domain\Auth\Models\Roles;
use Leantime\Domain\Auth\Services\Auth;
use Leantime\Domain\Plugins\Services\Plugins as PluginService;
use Symfony\Component\HttpFoundation\Response;

Expand All @@ -27,6 +29,9 @@ public function init(
*/
public function get(): Response
{

Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);

$this->tpl->assign('plugins', []);

return $this->tpl->display('plugins.marketplace');
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Plugins/Controllers/Myapps.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Myapps extends Controller
*/
public function init(PluginService $pluginService): void
{
Auth::authOrRedirect([Roles::$owner, Roles::$admin]);
Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);
$this->pluginService = $pluginService;
}

Expand Down

0 comments on commit b33e7be

Please sign in to comment.