aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/networks_controller.rb
diff options
context:
space:
mode:
authorXinhui2016-10-10 11:25:10 +0200
committerXinhui2016-10-10 11:25:10 +0200
commit1cd01cc22e45710adf2efa080662d919daaaeed3 (patch)
treedfa168b12c5306141f47bed40ecfc501694a4ecf /app/controllers/networks_controller.rb
parentfc25c675b21524d722f3e0e2ae34db43392f1651 (diff)
downloadchouette-core-1cd01cc22e45710adf2efa080662d919daaaeed3.tar.bz2
GroupOfLine policy
Diffstat (limited to 'app/controllers/networks_controller.rb')
-rw-r--r--app/controllers/networks_controller.rb15
1 files changed, 13 insertions, 2 deletions
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