Skip to content

Commit 61e9b13

Browse files
committed
Use User:: isAdmin() in admin controllers
1 parent 8c2b6f5 commit 61e9b13

File tree

15 files changed

+16
-23
lines changed

15 files changed

+16
-23
lines changed

featherbb/Controller/Admin/Bans.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct()
2222
translate('admin/bans');
2323
translate('admin/common');
2424

25-
if (!User::can('modpanel.bans') || !User::can('mod.ban_users')) {
25+
if (!User::can('mod.ban_users')) {
2626
throw new Error(__('No permission'), '403');
2727
}
2828
}

featherbb/Controller/Admin/Categories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct()
2121
{
2222
$this->model = new \FeatherBB\Model\Admin\Categories();
2323
translate('admin/categories');
24-
if (!User::can('board.categories')) {
24+
if (!User::isAdmin()) {
2525
throw new Error(__('No permission'), '403');
2626
}
2727
}

featherbb/Controller/Admin/Censoring.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
use FeatherBB\Core\AdminUtils;
1313
use FeatherBB\Core\Utils;
14+
use FeatherBB\Core\Error;
1415

1516
class Censoring
1617
{
1718
public function __construct()
1819
{
1920
$this->model = new \FeatherBB\Model\Admin\Censoring();
2021
translate('admin/censoring');
21-
if (!User::can('board.censoring')) {
22+
if (!User::isAdmin()) {
2223
throw new Error(__('No permission'), '403');
2324
}
2425
}

featherbb/Controller/Admin/Forums.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use FeatherBB\Core\AdminUtils;
1313
use FeatherBB\Core\Url;
1414
use FeatherBB\Core\Utils;
15+
use FeatherBB\Core\Error;
1516
use FeatherBB\Model\Cache;
1617

1718
class Forums
@@ -20,7 +21,7 @@ public function __construct()
2021
{
2122
$this->model = new \FeatherBB\Model\Admin\Forums();
2223
translate('admin/forums');
23-
if (!User::can('board.forums')) {
24+
if (!User::isAdmin()) {
2425
throw new Error(__('No permission'), '403');
2526
}
2627
}

featherbb/Controller/Admin/Groups.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct()
1919
{
2020
$this->model = new \FeatherBB\Model\Admin\Groups();
2121
translate('admin/groups');
22-
if (!User::can('board.groups')) {
22+
if (!User::isAdmin()) {
2323
throw new Error(__('No permission'), '403');
2424
}
2525
}

featherbb/Controller/Admin/Index.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ class Index
1919
public function __construct()
2020
{
2121
translate('admin/index');
22-
if (!User::can('modpanel.index')) {
23-
throw new Error(__('No permission'), '403');
24-
}
2522
}
2623

2724
public function display($req, $res, $args)

featherbb/Controller/Admin/Maintenance.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
use FeatherBB\Core\AdminUtils;
1313
use FeatherBB\Core\Utils;
14+
use FeatherBB\Core\Error;
1415

1516
class Maintenance
1617
{
1718
public function __construct()
1819
{
1920
$this->model = new \FeatherBB\Model\Admin\Maintenance();
2021
translate('admin/maintenance');
21-
if (!User::can('board.maintenance')) {
22+
if (!User::isAdmin()) {
2223
throw new Error(__('No permission'), '403');
2324
}
2425
}

featherbb/Controller/Admin/Options.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
use FeatherBB\Core\AdminUtils;
1313
use FeatherBB\Core\Utils;
14+
use FeatherBB\Core\Error;
1415

1516
class Options
1617
{
1718
public function __construct()
1819
{
1920
$this->model = new \FeatherBB\Model\Admin\Options();
2021
translate('admin/options');
21-
if (!User::can('board.options')) {
22+
if (!User::isAdmin()) {
2223
throw new Error(__('No permission'), '403');
2324
}
2425
}

featherbb/Controller/Admin/Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct()
2020
{
2121
$this->model = new \FeatherBB\Model\Admin\Parser();
2222
translate('admin/parser');
23-
if (!User::can('board.parser')) {
23+
if (!User::isAdmin()) {
2424
throw new Error(__('No permission'), '403');
2525
}
2626
}

featherbb/Controller/Admin/Permissions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111

1212
use FeatherBB\Core\AdminUtils;
1313
use FeatherBB\Core\Utils;
14+
use FeatherBB\Core\Error;
1415

1516
class Permissions
1617
{
1718
public function __construct()
1819
{
1920
$this->model = new \FeatherBB\Model\Admin\Permissions();
2021
translate('admin/permissions');
21-
if (!User::can('board.permissions')) {
22+
if (!User::isAdmin()) {
2223
throw new Error(__('No permission'), '403');
2324
}
2425
}

0 commit comments

Comments
 (0)