44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|
|
|
class AdminController extends Controller
|
|
{
|
|
/**
|
|
* Construct this object by extending the basic Controller class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
|
|
// special authentication check for the entire controller: Note the check-ADMIN-authentication!
|
|
// All methods inside this controller are only accessible for admins (= users that have role type 7)
|
|
Auth::checkAdminAuthentication();
|
|
}
|
|
|
|
/**
|
|
* This method controls what happens when you move to /admin or /admin/index in your app.
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->View->render('admin/index', array(
|
|
'users' => UserModel::getPublicProfilesOfAllUsers(),
|
|
'groups' => GroupModel::getAllGroups()
|
|
)
|
|
);
|
|
}
|
|
|
|
public function actionAccountSettings()
|
|
{
|
|
AdminModel::setAccountSuspensionAndDeletionStatus(
|
|
Request::post('suspension'), Request::post('softDelete'), Request::post('user_id')
|
|
);
|
|
|
|
Redirect::to("admin");
|
|
}
|
|
|
|
public function changeUserGroup()
|
|
{
|
|
GroupModel::setUserGroup(Request::post('user_id'), Request::post('group_id'));
|
|
Redirect::to("admin");
|
|
}
|
|
}
|