Esempio n. 1
0
 public function before()
 {
     $this->current_user = Auth::instance()->get_user();
     $admin = ORM::factory('role')->where('name', '=', 'admin')->find();
     if ($this->current_user && $this->current_user->has('roles', $admin)) {
         // pass
     } else {
         Message::instance()->set('You\'re not allowed to access the management dashboard.', Message::ERROR);
         $this->request->redirect('auth');
     }
     parent::before();
     $this->layout->page_title = 'Management';
 }
Esempio n. 2
0
 public function before()
 {
     if (!Auth::instance()->get_user()) {
         Message::instance()->set('You must be signed in to use the importer.');
         $this->request->redirect('/auth?next=/tools/import/google');
     }
     $current_user = Auth::instance()->get_user();
     $import_role = ORM::factory('role')->where('name', '=', 'import')->find();
     $admin_role = ORM::factory('role')->where('name', '=', 'admin')->find();
     if ($current_user->has('roles', $import_role) || $current_user->has('roles', $admin_role)) {
         // pass
     } else {
         Message::instance()->set('You don\'t have access to the Google Docs importer.');
         $this->request->redirect('/home');
     }
     parent::before();
 }