User.current.allowed_to for admin

Added by macus leung about 5 years ago

I am writing a plugin to manage some data. I have setup roles and permission for admin in redmine, but it seems doesn't work

it always return false in index.html.erb with the code below.

<% edit_allowed = User.current.allowed_to?(:edit_participant, @project) %>

init.rb

  project_module :accounts do
    permission :view_only, {:participant => [:index]}
    permission :manage_account, {:participant => [:new, :edit, :destroy]}, :require => :member
  end

So I would like to check what is assigned permission for admin in console.

How to check assigned permission to admin in rails console?
I want to check what is assigned to admin.

Thanks

Replies (2)

RE: User.current.allowed_to for admin - Added by Jean-Philippe Lang about 5 years ago

You did not define the :edit_participant permission (only :view_only, :manage_account). So allowed_to? returns false.

(1-2/2)