 Add new permission on my plugin
Add new permission on my plugin
Added by Eloise Chizat over 11 years ago
Hi!
I created a plugin and I want to add a new permission on it. 
I follow the plugin Tutorial, but even if I'am logged as an admin with full rights I have the error 403 "You are not authorized to access this page." when I try to acces my plugin.
What am I doing wrong ?
Here is my code:
init.rb
Redmine::Plugin.register :redmine_plugin do
      permission :my_permission, :redmine_plugin => :controller
end
	controller.rb
class MyController < ApplicationController unloadable before_filter :authorize def controller ... end end
Thanks ;)
Replies (1)
     RE: Add new permission on my plugin
    -
    Added by Eloise Chizat over 11 years ago
    RE: Add new permission on my plugin
    -
    Added by Eloise Chizat over 11 years ago
  
  I figure it out, I changed :authorize to a new definition :test.
I don't know if it's the good way but it works.
controller.rb
    class MyController < ApplicationController
      unloadable
      before_filter :test
      def test
        @project = Project.find(params[:project_id])
        if !User.current.allowed_to?(:my_permission, @project)
          render_404
        end
      end
      def controller
         ...
      end
    end