Commit 7e7ab77c by pupi1985 Committed by Scott

Replace fatal errors with the appropriate exception

parent 4559829f
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
namespace Q2A\Controllers\User; namespace Q2A\Controllers\User;
use Q2A\Middleware\Auth\InternalUsersOnly;
require_once QA_INCLUDE_DIR . 'db/users.php'; require_once QA_INCLUDE_DIR . 'db/users.php';
require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'app/users.php'; require_once QA_INCLUDE_DIR . 'app/users.php';
...@@ -25,6 +27,13 @@ require_once QA_INCLUDE_DIR . 'app/format.php'; ...@@ -25,6 +27,13 @@ require_once QA_INCLUDE_DIR . 'app/format.php';
class UsersList extends \Q2A\Controllers\BaseController class UsersList extends \Q2A\Controllers\BaseController
{ {
public function __construct()
{
parent::__construct();
$this->addMiddleware(new InternalUsersOnly(), array('newest', 'special', 'blocked'));
}
/** /**
* Display top users page (ordered by points) * Display top users page (ordered by points)
* @return array $qa_content * @return array $qa_content
...@@ -59,10 +68,6 @@ class UsersList extends \Q2A\Controllers\BaseController ...@@ -59,10 +68,6 @@ class UsersList extends \Q2A\Controllers\BaseController
*/ */
public function newest() public function newest()
{ {
// check we're not using single-sign on integration
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
// check we have permission to view this page (moderator or above) // check we have permission to view this page (moderator or above)
if (qa_user_permit_error('permit_view_new_users_page')) { if (qa_user_permit_error('permit_view_new_users_page')) {
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
...@@ -99,10 +104,6 @@ class UsersList extends \Q2A\Controllers\BaseController ...@@ -99,10 +104,6 @@ class UsersList extends \Q2A\Controllers\BaseController
*/ */
public function special() public function special()
{ {
// check we're not using single-sign on integration
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
// check we have permission to view this page (moderator or above) // check we have permission to view this page (moderator or above)
if (qa_user_permit_error('permit_view_special_users_page')) { if (qa_user_permit_error('permit_view_special_users_page')) {
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
...@@ -135,10 +136,6 @@ class UsersList extends \Q2A\Controllers\BaseController ...@@ -135,10 +136,6 @@ class UsersList extends \Q2A\Controllers\BaseController
*/ */
public function blocked() public function blocked()
{ {
// check we're not using single-sign on integration
if (QA_FINAL_EXTERNAL_USERS)
qa_fatal_error('User accounts are handled by external code');
// check we have permission to view this page (moderator or above) // check we have permission to view this page (moderator or above)
if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) { if (qa_get_logged_in_level() < QA_USER_LEVEL_MODERATOR) {
$qa_content = qa_content_prepare(); $qa_content = qa_content_prepare();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment