Enhancements to user switch
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user