diff options
| author | Thomas Haddad | 2017-04-03 17:26:12 +0200 |
|---|---|---|
| committer | Thomas Haddad | 2017-04-03 17:26:12 +0200 |
| commit | 4ed8d66ec3025cb4e554554161a7af01307bd128 (patch) | |
| tree | 8eb6b0a9f3e1f60eb54cae12135267e5c28672f9 /app/controllers | |
| parent | eaf643b91f724a3f3b31855299b3682619cf818c (diff) | |
| download | chouette-core-4ed8d66ec3025cb4e554554161a7af01307bd128.tar.bz2 | |
Refs #3028: Add and update permissions for vj and jp
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/journey_patterns_collections_controller.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb index 51cc48c2a..2963a8ad7 100644 --- a/app/controllers/journey_patterns_collections_controller.rb +++ b/app/controllers/journey_patterns_collections_controller.rb @@ -1,6 +1,7 @@ class JourneyPatternsCollectionsController < ChouetteController respond_to :html respond_to :json + before_action :user_permissions, only: :show belongs_to :referential do belongs_to :line, :parent_class => Chouette::Line do @@ -41,6 +42,15 @@ class JourneyPatternsCollectionsController < ChouetteController @stop_points_list = @stop_points_list.sort_by {|a| a[:position] } end + def user_permissions + @perms = {}.tap do |perm| + ['journey_patterns.create', 'journey_patterns.edit', 'journey_patterns.destroy'].each do |name| + perm[name] = current_user.permissions.include?(name) + end + end + @perms = @perms.to_json + end + def update state = JSON.parse request.raw_post Chouette::JourneyPattern.state_update route, state |
