@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param string $event The event to use. |
| 38 | 38 | */ |
| 39 | - public function initialize(array $config) |
|
| 40 | - { |
|
| 41 | - parent::initialize($config); |
|
| 39 | + public function initialize(array $config) |
|
| 40 | + { |
|
| 41 | + parent::initialize($config); |
|
| 42 | 42 | |
| 43 | - $this->controller = $this->_registry->getController(); |
|
| 44 | - $this->session = $this->controller->request->session(); |
|
| 45 | - } |
|
| 43 | + $this->controller = $this->_registry->getController(); |
|
| 44 | + $this->session = $this->controller->request->session(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Initialization to get controller variable |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * @param array $rules Array of rules for permissions. |
| 51 | 51 | * @return string '0' if user / group doesn't have permission, 1 if has permission |
| 52 | 52 | */ |
| 53 | - public function allow ($rules) { |
|
| 54 | - $user_id = $this->session->read('Auth.User.id'); |
|
| 53 | + public function allow ($rules) { |
|
| 54 | + $user_id = $this->session->read('Auth.User.id'); |
|
| 55 | 55 | |
| 56 | 56 | $actions = array(); |
| 57 | 57 | $bool = true; |
@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | foreach($rules as $key => $value){ |
| 67 | 67 | switch($key){ |
| 68 | 68 | case "user_type": |
| 69 | - $userType = $value; |
|
| 70 | - break; |
|
| 71 | - case "redirect": |
|
| 72 | - $redirect = $value; |
|
| 73 | - break; |
|
| 74 | - case "action": |
|
| 75 | - $action = $value; |
|
| 76 | - break; |
|
| 77 | - case "controller": |
|
| 78 | - $controller = $value; |
|
| 79 | - break; |
|
| 80 | - case "message": |
|
| 81 | - $message = $value; |
|
| 82 | - break; |
|
| 69 | + $userType = $value; |
|
| 70 | + break; |
|
| 71 | + case "redirect": |
|
| 72 | + $redirect = $value; |
|
| 73 | + break; |
|
| 74 | + case "action": |
|
| 75 | + $action = $value; |
|
| 76 | + break; |
|
| 77 | + case "controller": |
|
| 78 | + $controller = $value; |
|
| 79 | + break; |
|
| 80 | + case "message": |
|
| 81 | + $message = $value; |
|
| 82 | + break; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
@@ -140,5 +140,5 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $bool; |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | } |
| 145 | 145 | \ No newline at end of file |
@@ -109,8 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | header("Location: " . $redirect); |
| 111 | 111 | exit; |
| 112 | - } |
|
| 113 | - else{ |
|
| 112 | + } else{ |
|
| 114 | 113 | $bool = false; |
| 115 | 114 | } |
| 116 | 115 | } |
@@ -130,8 +129,7 @@ discard block |
||
| 130 | 129 | |
| 131 | 130 | header("Location: " . $redirect); |
| 132 | 131 | exit; |
| 133 | - } |
|
| 134 | - else{ |
|
| 132 | + } else{ |
|
| 135 | 133 | $bool = false; |
| 136 | 134 | } |
| 137 | 135 | } |