Skip to content

Commit 70d7bdf

Browse files
committed
Update permissions in admin controllers
See 4fd1822
1 parent 30cac60 commit 70d7bdf

17 files changed

Lines changed: 46 additions & 17 deletions

‎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::get()->g_id != ForumEnv::get('FEATHER_ADMIN') && (User::get()->g_moderator != '1' || User::get()->g_mod_ban_users == '0')) {
25+
if (!Container::get('perms')->can(User::get(), 'mod.bans')) {
2626
throw new Error(__('No permission'), '403');
2727
}
2828
}

‎featherbb/Controller/Admin/Categories.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public function __construct()
2121
{
2222
$this->model = new \FeatherBB\Model\Admin\Categories();
2323
translate('admin/categories');
24+
if (!Container::get('perms')->can(User::get(), 'board.categories')) {
25+
throw new Error(__('No permission'), '403');
26+
}
2427
}
2528

2629
public function add($req, $res, $args)

‎featherbb/Controller/Admin/Censoring.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public function __construct()
1818
{
1919
$this->model = new \FeatherBB\Model\Admin\Censoring();
2020
translate('admin/censoring');
21+
if (!Container::get('perms')->can(User::get(), 'board.censoring')) {
22+
throw new Error(__('No permission'), '403');
23+
}
2124
}
2225

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

‎featherbb/Controller/Admin/Forums.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public function __construct()
2020
{
2121
$this->model = new \FeatherBB\Model\Admin\Forums();
2222
translate('admin/forums');
23+
if (!Container::get('perms')->can(User::get(), 'board.forums')) {
24+
throw new Error(__('No permission'), '403');
25+
}
2326
}
2427

2528
public function add()

‎featherbb/Controller/Admin/Groups.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public function __construct()
1919
{
2020
$this->model = new \FeatherBB\Model\Admin\Groups();
2121
translate('admin/groups');
22+
if (!Container::get('perms')->can(User::get(), 'board.groups')) {
23+
throw new Error(__('No permission'), '403');
24+
}
2225
}
2326

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

‎featherbb/Controller/Admin/Index.php‎

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

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

‎featherbb/Controller/Admin/Maintenance.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public function __construct()
1818
{
1919
$this->model = new \FeatherBB\Model\Admin\Maintenance();
2020
translate('admin/maintenance');
21+
if (!Container::get('perms')->can(User::get(), 'board.maintenance')) {
22+
throw new Error(__('No permission'), '403');
23+
}
2124
}
2225

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

‎featherbb/Controller/Admin/Options.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public function __construct()
1818
{
1919
$this->model = new \FeatherBB\Model\Admin\Options();
2020
translate('admin/options');
21+
if (!Container::get('perms')->can(User::get(), 'board.options')) {
22+
throw new Error(__('No permission'), '403');
23+
}
2124
}
2225

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

‎featherbb/Controller/Admin/Parser.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public function __construct()
2020
{
2121
$this->model = new \FeatherBB\Model\Admin\Parser();
2222
translate('admin/parser');
23+
if (!Container::get('perms')->can(User::get(), 'board.parser')) {
24+
throw new Error(__('No permission'), '403');
25+
}
2326
}
2427

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

‎featherbb/Controller/Admin/Permissions.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public function __construct()
1818
{
1919
$this->model = new \FeatherBB\Model\Admin\Permissions();
2020
translate('admin/permissions');
21+
if (!Container::get('perms')->can(User::get(), 'board.permissions')) {
22+
throw new Error(__('No permission'), '403');
23+
}
2124
}
2225

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

0 commit comments

Comments
 (0)