Esempio n. 1
0
 protected function access($module)
 {
     $user = Session::get('user');
     if ($user) {
         $right = Model_Access_Right::find('first', array('where' => array('user_id' => $user->id)));
         return $right[$module];
     }
 }
Esempio n. 2
0
 protected function has_access($page)
 {
     $user = Session::get('user');
     $access = Model_Access_Right::find('first', array('where' => array('page' => $page)));
     $ac = $user->access_level;
     if ($access->{$ac} == 0) {
         Session::set_flash('error', 'Sorry! You do not have access to this page.');
         Response::redirect('welcome');
     }
 }
Esempio n. 3
0
 public function action_accessSubmit()
 {
     parent::has_access("add_user");
     if (Input::method() == 'POST') {
         $page = Input::post('page');
         $mod1 = Model_Access_Right::find('first', array('where' => array('page' => $page)));
         $mod1->mod1 = Input::post('moderator1');
         $mod1->save();
         $mod2 = Model_Access_Right::find('first', array('where' => array('page' => $page)));
         $mod2->mod2 = Input::post('moderator2');
         $mod2->save();
         $user = Model_Access_Right::find('first', array('where' => array('page' => $page)));
         $user->user = Input::post('user');
         $user->save();
         Response::redirect('users/access');
     }
 }