Commit 553cd19c authored by Michael Vernier's avatar Michael Vernier

Added vote and view poll permissions

parent 92f03981
class PollsController < ApplicationController class PollsController < ApplicationController
unloadable unloadable
before_filter :find_project, :authorize, :only => :index
before_filter :find_project, :authorize, :only => :vote
def index def index
@project = Project.find( params[ :project_id ] ) # @project = Project.find( params[ :project_id ] )
@polls = Poll.find( :all ) # @project.polls @polls = Poll.find( :all ) # @project.polls
end end
...@@ -15,4 +18,11 @@ class PollsController < ApplicationController ...@@ -15,4 +18,11 @@ class PollsController < ApplicationController
end end
redirect_to :action => 'index' redirect_to :action => 'index'
end end
private
def find_project
# @project variable must be set before calling the authorize filter
@project = Project.find( params[ :project_id ] )
end
end end
# English strings go here for Rails i18n # English strings go here for Rails i18n
en: en:
# my_label: "My label" # my_label: "My label"
permission_view_polls: View Polls
permission_vote_polls: Vote Polls
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment