/** * Show the application dashboard to the user. * * @return Response */ public function index() { if (!Sentry::check()) { return Redirect::to('/giris'); } return view('apanel/yonetim'); }
public function getLogin() { if (Sentry::check()) { return Redirect::to('/'); } return View::make('auth.login'); }
/** * Register the service provider. * * @return void */ public function register() { $this->app['router']->before(function ($request) { // First clear out all "old" visitors Visitor::clear(); $page = Request::path(); $ignore = Config::get('visitor-log::ignore'); if (is_array($ignore) && in_array($page, $ignore)) { //We ignore this site return; } $visitor = Visitor::getCurrent(); if (!$visitor) { //We need to add a new user $visitor = new Visitor(); $visitor->ip = Request::getClientIp(); $visitor->useragent = Request::server('HTTP_USER_AGENT'); $visitor->sid = str_random(25); } $user = null; $usermodel = strtolower(Config::get('visitor-log::usermodel')); if (($usermodel == "auth" || $usermodel == "laravel") && Auth::check()) { $user = Auth::user()->id; } if ($usermodel == "sentry" && class_exists('Cartalyst\\Sentry\\SentryServiceProvider') && Sentry::check()) { $user = Sentry::getUser()->id; } //Save/Update the rest $visitor->user = $user; $visitor->page = $page; $visitor->save(); }); }
/** * Check if user logged in and active. * * @return bool */ public function check() { if (!Sentry::check()) { return false; } return true; }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (!Sentry::check()) { return redirect('/login'); } return $next($request); }
/** * @param $route * @param $request * @param $value * @return mixed */ public function hasPermission($route, $request, $value) { if (!Sentry::check()) { return Redirect::to('aut/login'); } $user = Sentry::getUser(); if (!$user->hasAccess($value)) { return Redirect::to('dash')->with('error_message', 'شما دسترسی به صفحه مورد نظر را ندارید.'); } }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $currentUser = null; if (Sentry::check()) { $tempUser = Sentry::getUser(); $currentUser = array("id" => $tempUser->id, "firstname" => $tempUser->first_name, "fullname" => $tempUser->first_name . " " . $tempUser->last_name); } view()->share('currentUser', $currentUser); return $next($request); }
public function editor($field) { $admin = Sentry::findGroupByName('admin'); if (Sentry::check() && Sentry::getUser()->inGroup($admin)) { $pageEditor = $this; $fieldEdit = "editor_init_" . get_class($pageEditor) . "_" . $field . "_" . $pageEditor->id; return View::make('builder::partials.editor_init', compact("pageEditor", "field", "fieldEdit")); } else { return $this->{$field}; } }
private function replaceData($data) { $data['ip'] = getIp(); $data['ratingspage_id'] = $data['id']; $data['ratingspage_type'] = str_replace("\\", "_", Crypt::decrypt($data['model'])); $data['rating'] = $data['value']; if (Sentry::check()) { $data['user_id'] = Sentry::getUser()->id; } return $data; }
public function getLogin() { if (Sentry::check()) { $user = Sentry::getUser(); //Return if user is an admin if ($user->hasAccess('admin')) { Session::flash('info', 'Already logged in as ' . $user->email); return Redirect::to('admin'); } } return View::make('admin.login'); }
public function doAddComment() { parse_str(Input::get('data'), $data); if (isset($data['id_page'])) { $data['commentpage_type'] = Crypt::decrypt($data['commentable']); $data['commentpage_id'] = $data['id_page']; if (Sentry::check()) { $data['user_id'] = Sentry::getUser()->id; $data['name'] = Sentry::getUser()->getFullName(); } Comment::create($data); return $this->listCommetns($data['commentpage_type'], $data['id_page']); } }
/** * Determine if the current user is authenticated. * * @return bool */ public function check() { return Sentry::check(); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return Sentry::check(); }
/** * Check if the user is logged in * @return mixed */ public function check() { if (Sentry::check()) { return Sentry::getUser(); } return false; }
/** * {@inheritDoc} */ public function getFunctions() { return [new Twig_SimpleFunction('user_active', function () { return Sentry::check(); })]; }