Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- °public static function checkRules() {
- $controller = Request::instance()->controller;
- $action = Request::instance()->action;
- $access = Model_A11n::getAccessFromSession();
- $rules = Kohana::config( 'rules' )->as_array();
- $rules = $rules[$controller][$action];
- $hasAccess = false;
- forEach ( $rules as $key => $value ) {
- if ( $value === $access ) {
- $hasAccess = true;
- break;
- }
- }
- if ( $hasAccess === false ) {
- throw new Exception( 'Access denied!' );
- }
- }
Add Comment
Please, Sign In to add comment