aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorRobert2017-07-07 15:45:36 +0200
committerRobert2017-07-07 15:45:36 +0200
commite4133cee19db0aef55318296b2746be5be4b5896 (patch)
treeece0c701f4dfc969a39762b895353fbc0df24877 /app
parentb31b713f84cab31870aab48fa739883df8fbf0c3 (diff)
downloadchouette-core-e4133cee19db0aef55318296b2746be5be4b5896.tar.bz2
Hotfix user_permission computation in journey_patterns and vehicle_journey controllers
Diffstat (limited to 'app')
-rw-r--r--app/controllers/journey_patterns_collections_controller.rb3
-rw-r--r--app/controllers/vehicle_journeys_controller.rb1
-rw-r--r--app/models/user.rb2
3 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb
index 837ac65e7..e8924b7ad 100644
--- a/app/controllers/journey_patterns_collections_controller.rb
+++ b/app/controllers/journey_patterns_collections_controller.rb
@@ -49,8 +49,9 @@ class JourneyPatternsCollectionsController < ChouetteController
end
def user_permissions
+ policy = policy(:journey_pattern)
@perms =
- %w{create destroy edit}.inject({}) do | permissions, action |
+ %w{create destroy update}.inject({}) do | permissions, action |
permissions.merge( "journey_patterns.#{action}" => policy.authorizes_action?(action) )
end.to_json
end
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index f7e2fcdc1..70cca15ed 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -159,6 +159,7 @@ class VehicleJourneysController < ChouetteController
end
def user_permissions
+ policy = policy(:vehicle_journey)
@perms =
%w{create destroy update}.inject({}) do | permissions, action |
permissions.merge( "vehicle_journeys.#{action}" => policy.authorizes_action?(action) )
diff --git a/app/models/user.rb b/app/models/user.rb
index 1d9e435d5..14ab478a8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -41,7 +41,7 @@ class User < ActiveRecord::Base
routing_constraint_zones
time_tables
vehicle_journeys
- ]) << 'boiv:edit-offer'
+ ])
mattr_reader :edit_offer_permissions