Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Ability model generator #5

Open
melvinsembrano opened this issue Feb 26, 2014 · 3 comments
Open

Create Ability model generator #5

melvinsembrano opened this issue Feb 26, 2014 · 3 comments
Assignees

Comments

@melvinsembrano
Copy link
Owner

Create ability model generator.

@andywenk
Copy link
Collaborator

could you outline this feature a bit? Maybe I can find a slot to work on this ...

@melvinsembrano
Copy link
Owner Author

If app/models/ability.rb exist cms-fortress will use that instead of the built-in CmsAbility.
The feature will generate a model {Rails.root}/app/models/ability.rb that code will look like below:

class Ability < CmsAbility

  def setup_role(role_detail, user)
    if role_detail.command.eql?('blog.form')
      can :manage, BlogModel
   elsif role_detail.command.eql?('contacts.list')
      can :manage, Contacts
    else
      warn "#{ role_detail.command } is not yet handled."
    end
  end
end

@LyriD
Copy link

LyriD commented Apr 29, 2015

Hi, my dear friends. My question maybe stupid, but.. how it works? ability model doesn't work for me. rules inside this class, like:

if role_detail.command.eql?('contents.blog')
can :manage, Blog
...

take no effect. :(

please help, i just want to add some manage rules to ComfyBlog
sorry for bad english

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants