diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/group_of_lines_controller.rb | 16 | ||||
| -rw-r--r-- | app/controllers/networks_controller.rb | 15 |
2 files changed, 28 insertions, 3 deletions
diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb index f8b5301d3..112ff2dd0 100644 --- a/app/controllers/group_of_lines_controller.rb +++ b/app/controllers/group_of_lines_controller.rb @@ -1,6 +1,6 @@ class GroupOfLinesController < BreadcrumbController include ApplicationHelper - + before_action :check_policy, :only => [:edit, :update, :destroy] defaults :resource_class => Chouette::GroupOfLine respond_to :html respond_to :xml @@ -29,6 +29,16 @@ class GroupOfLinesController < BreadcrumbController end end + def new + authorize resource_class + super + end + + def create + authorize resource_class + super + end + def name_filter respond_to do |format| format.json { render :json => filtered_group_of_lines_maps} @@ -65,6 +75,10 @@ class GroupOfLinesController < BreadcrumbController private + def check_policy + authorize resource + end + def group_of_line_params params.require(:group_of_line).permit( :objectid, :object_version, :creation_time, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens) end diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index beced7e55..85ec36769 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -1,6 +1,6 @@ class NetworksController < BreadcrumbController include ApplicationHelper - + before_action :check_policy, :only => [:edit, :update, :destroy] defaults :resource_class => Chouette::Network respond_to :html respond_to :xml @@ -17,6 +17,14 @@ class NetworksController < BreadcrumbController end end + def new + authorize resource_class + end + + def create + authorize resource_class + end + def index index! do |format| format.html { @@ -45,8 +53,11 @@ class NetworksController < BreadcrumbController alias_method :line_referential, :parent + def check_policy + authorize resource + end + def network_params params.require(:network).permit(:objectid, :object_version, :creation_time, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment ) end - end |
