Giter Club home page Giter Club logo

bullet_train-roles's People

Contributors

aaricpittman avatar adampal avatar andrewculver avatar coolprobn avatar dansingerman 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

Watchers

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

bullet_train-roles's Issues

Allow basic filtering.

Examples I think should be valid:

editor:
  models:
    project:
      - archive
      - where:
        - archived_at: nil

Would be like: can :archive, Project, [all the other magic], archived_at: nil

editor:
  models:
    project:
      - archive
      - where:
        - workspace:
          - archived_at: nil

Would be like: can :archive, Project, [all the other magic], workspace: {archived_at: nil}

The roles= setter should automatically save the record

When doing membership.roles = [Role.admin] we should automatically save the change to make it behave more like Rails' has_many :through association.

It will also make upgrading easier because existing Bullet Train apps that assign roles using the membership.roles = [Role.admin] syntax won't need to change any code when upgrading to the gem.

Rename Roles::User

The Roles::User module could be named better.
It will often be a User, however we're really wanting to include this module in any class that could be the end owner of the roles. Roles are applied to a Membership, however the User actually owns the roles.

I think Roles::Owner would be a better choice.

Add support for a `crud` permission.

crud should be shorthand for create, read, update, destroy. This is different than manage, because manage includes any action (e.g. approve, etc.), vs. just standard CRUD workflow stuff.

MySQL doesn't support `default` on `json` columns.

Instead, I think we'll need to remove the attempt to set a default on the column when we generated the migration, and instead do this in the model:

after_initialize :set_default_role_ids

def set_default_role_ids
  self.role_ids ||= []
end

Super Scaffolding system test fails.

When upgrading from 1.0.4 to 1.0.5, Bullet Train's Super Scaffolding system test fails. To reproduce, remove the 1.0.4 version lock in the Gemfile, bundle install, and:

test/bin/setup-super-scaffolding-system-test
rails test test/system/super_scaffolding_test.rb

Seems like in the process of adding support for team_id being denormalized onto a given child model, we broke the support for has_one :team, through: ....

`NoMethodError (undefined method 'parent_ids_for' for #<User:0x0000000114d6def8>)`

2.7.2 :006 > Ability.new(User.last).can? :create, Scaffolding::AbsolutelyAbstract::CreativeConcept
  User Load (0.6ms)  SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT $1  [["LIMIT", 1]]
  Membership Load (0.2ms)  SELECT "memberships".* FROM "memberships" WHERE "memberships"."user_id" = $1  [["user_id", 1]]
Traceback (most recent call last):
       16: from railties (6.1.3.2) lib/rails/commands/console/console_command.rb:102:in `perform'
       15: from railties (6.1.3.2) lib/rails/commands/console/console_command.rb:19:in `start'
       14: from railties (6.1.3.2) lib/rails/commands/console/console_command.rb:70:in `start'
       13: from (irb):6
       12: from (irb):6:in `new'
       11: from app/models/ability.rb:41:in `initialize'
       10: from bullet_train-roles (f5992fb490db) lib/roles/permit.rb:15:in `permit'
        9: from bullet_train-roles (f5992fb490db) lib/roles/permit.rb:15:in `each'
        8: from bullet_train-roles (f5992fb490db) lib/roles/permit.rb:19:in `block in permit'
        7: from bullet_train-roles (f5992fb490db) lib/roles/permit.rb:44:in `add_abilities_for'
        6: from bullet_train-roles (f5992fb490db) lib/models/role.rb:99:in `ability_generator'
        5: from bullet_train-roles (f5992fb490db) lib/models/role.rb:99:in `each'
        4: from bullet_train-roles (f5992fb490db) lib/models/role.rb:100:in `block in ability_generator'
        3: from bullet_train-roles (f5992fb490db) lib/models/role.rb:100:in `new'
        2: from bullet_train-roles (f5992fb490db) lib/models/role.rb:147:in `initialize'
        1: from activemodel (6.1.3.2) lib/active_model/attribute_methods.rb:469:in `method_missing'
NoMethodError (undefined method `parent_ids_for' for #<User:0x0000000114d6def8>)

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.