GithubHelp home page GithubHelp logo

simplybuilt / simonsays Goto Github PK

View Code? Open in Web Editor NEW
243.0 13.0 11.0 575 KB

๐Ÿ’‚ Simple, declarative, role-based access control system for Rails and Ruby

License: MIT License

Ruby 89.53% JavaScript 1.09% CSS 1.12% HTML 8.04% Shell 0.22%
ruby rails authorization role-based-access-control authorizer security declarative

simonsays's People

Contributors

danielwestendorf avatar mjc-gh avatar nomnomcameron avatar zires avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

simonsays's Issues

Issue with roles for different Model types

I have a Devise User model with 3 subtypes "Player", "Hero" and "Coach". Each of the subtypes have their own set of roles. However, I only seem to be able to add one set of roles to a user. If I try to add a different set of roles to a different user type the roles mask is 0 with an empty roles array.

Simplified example:

class User < ApplicationRecord
  before_create :add_roles

  include SimonSays::Roleable
  has_roles  :content_creator, :story_admin, :advertiser, :promoter, :team_admin

  private

  def add_roles
    case self.type
      when 'Player'
        self.roles = %i[content_creator story_admin]
      when 'Hero'
        self.roles = %i[content_creator story_admin]
      when 'Coach'
        self.roles = %i[promoter team_admin]
    end
  end
end

Outcome:

Player.create!({params})
Player.first.roles
# [:content_creator, :story_admin]

Hero.create!({params})
Hero.first.roles
# [:content_creator, :story_admin]

Coach.create!({params})
Coach.first.roles
# []

Every time I try to add a different set of roles to a User type the roles array comes up empty. Any advice on how to solve this issue?

1.0 Release Schedule

Hi, I work at @knotchlabs my company uses this gem in production. We love it and respect your work but I'd like to see it come out of Alpha.

Is there a 1.0 release schedule available? If you need help one of our core engineers @mjc-gh has plenty of free cycles and he would be more than happy to jump in and help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.