Layout updates, switch user updates
This commit is contained in:
@@ -16,9 +16,9 @@ class AdminController extends Controller
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
public function switch_authorised()
|
||||
public function switch_authorised($id)
|
||||
{
|
||||
return Auth::user()->isAdmin ? TRUE : FALSE;
|
||||
return (method_exists(Auth::user(),'isAdmin') && Auth::user()->isAdmin($id)) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
public function switch_session()
|
||||
@@ -31,7 +31,7 @@ class AdminController extends Controller
|
||||
*/
|
||||
public function user_switch_start($id)
|
||||
{
|
||||
if ($this->switch_session() AND $this->switch_authorised())
|
||||
if ($this->switch_session() AND $this->switch_authorised($id))
|
||||
{
|
||||
$uo = User::find($id);
|
||||
|
||||
|
@@ -9,13 +9,13 @@ use Session;
|
||||
|
||||
trait UserSwitch
|
||||
{
|
||||
public function GetIsAdminAttribute()
|
||||
{
|
||||
return isset($this->admin) ? $this->admin : FALSE;
|
||||
}
|
||||
|
||||
public function getSwitchedAttribute()
|
||||
{
|
||||
return Session::get('orig_user');
|
||||
}
|
||||
|
||||
public function isAdmin($id)
|
||||
{
|
||||
return isset($this->admin) ? $this->admin : FALSE;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user