Completed
Push — feature/fixing_cost ( 414fbf...99877f )
by Laurent
01:40
created
Infrastructure/Common/Routes/guards.conf.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 global $db;
9 9
 
10 10
 return [
11
-    new Guard('get_one_damage', function(User $user){
11
+    new Guard('get_one_damage', function(User $user) {
12 12
         return $user->rights->flightlog->vol->financial;
13 13
     }),
14 14
 ];
Please login to merge, or discard this patch.
Infrastructure/Common/Routes/RouteManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      *
39 39
      * @throws \Exception
40 40
      */
41
-    public function add(Route $route){
42
-        if(isset($this->routes[$route->getName()])){
41
+    public function add(Route $route) {
42
+        if (isset($this->routes[$route->getName()])) {
43 43
             throw new \Exception('Route exists');
44 44
         }
45 45
 
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
      *
52 52
      * @throws \Exception
53 53
      */
54
-    public function load(array $routes){
55
-        foreach($routes as $currentRoute){
54
+    public function load(array $routes) {
55
+        foreach ($routes as $currentRoute) {
56 56
             $this->add($currentRoute);
57 57
         }
58 58
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function loadGuards($routesGuards)
64 64
     {
65
-        foreach($routesGuards as $guard){
65
+        foreach ($routesGuards as $guard) {
66 66
             $this->guards[$guard->getRouteName()] = $guard;
67 67
         }
68 68
     }
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
      * @param $routeName
74 74
      * @return bool
75 75
      */
76
-    public function isAuthorized(User $user, $routeName){
77
-        if(!isset($this->guards[$routeName])){
76
+    public function isAuthorized(User $user, $routeName) {
77
+        if (!isset($this->guards[$routeName])) {
78 78
             return true;
79 79
         }
80 80
 
@@ -92,11 +92,11 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function __invoke($name, User $user)
94 94
     {
95
-        if(!isset($this->routes[$name])){
95
+        if (!isset($this->routes[$name])) {
96 96
             throw new \Exception('Route not found');
97 97
         }
98 98
 
99
-        if(!$this->isAuthorized($user, $name)){
99
+        if (!$this->isAuthorized($user, $name)) {
100 100
             throw new \Exception('Action not allowed');
101 101
         }
102 102
 
Please login to merge, or discard this patch.