Enhancements to user switch

This commit is contained in:
Deon George
2018-07-13 14:39:10 +10:00
parent b0fcdaa375
commit ac867a2526
5 changed files with 49 additions and 21 deletions

View File

@@ -2,12 +2,13 @@
namespace Leenooks\Controllers;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Controller;
use App\User;
use Auth;
use Redirect;
use Session;
use App\User;
class AdminController extends Controller
{
public function __construct()
@@ -15,12 +16,22 @@ class AdminController extends Controller
$this->middleware('auth');
}
public function switch_authorised()
{
return TRUE;
}
public function switch_session()
{
return ! Session::get('orig_user');
}
/**
* @todo Change the background color (or something) so we know we are switched
*/
public function user_switch_start($id)
{
if ($this->switch_authorised())
if ($this->switch_session() AND $this->switch_authorised())
{
$uo = User::find($id);
@@ -43,10 +54,4 @@ class AdminController extends Controller
return Redirect::to('/home');
}
public function switch_authorised()
{
// @todo
return TRUE;
}
}
}