Example #1
0
 /**
  * Validate if we have permission to run the query, throws @see Exceptions\ACL if not.
  *
  * @return  void
  */
 public function validate_acl()
 {
     if (!$this->_acl) {
         return;
     }
     ACL::validate_query($this->_build, array($this->_actor, $this->_db_id));
 }
Example #2
0
 function test_select_query_blacklist()
 {
     $this->set_testing_rules_wildcard();
     ACL::set_actor(\CrossORM\ACTOR_DEFAULT, \CrossORM\MODE_BLACKLIST);
     $rules = ACL::get_rules();
     $actor = ACL::get_actor();
     try {
         $result = DB::factory()->acl()->for_table('test')->find_one();
         $this->fail('ACL should cause failure');
     } catch (\CrossORM\Exceptions\ACL $e) {
         echo json_encode(array('rules' => $rules, 'flat' => ACL::get_rules(true), 'actor' => $actor, 'result' => stripslashes(json_encode($e))), JSON_NUMERIC_CHECK);
     }
 }