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
Membership types #6
Conversation
…ing Authority and Pundit
Next steps are to implement the same functionality for Mongoid and do some refactoring. The API is pretty stable but may be subject to change. See the following for some documentation of this feature: https://github.com/dwbutler/groupify/tree/membership_type#membership-types |
This is looking great! One feature I want is the ability to select the manager from the group, i.e. |
I thought about doing that as well. But there are some problems with it.
A possibly generic solution would be to use Another solution would be to document how to define the methods yourself or perhaps provide a macro to call such as |
Another solution would be to add a custom method onto the member associations which would add a new scope. For example, |
Added the implementation, so |
Awesome! Think this will get merged soon? Or should we just use your fork? |
By the way... was just reviewing the source. It's looking great. I think that |
@auser Thanks! It's going to take a while to re-implement the same functionality for Mongoid. I would recommend for now that you try out the branch, make sure it meets your needs, and look for any subtle bugs. I wanted to do some refactoring as well, but I can hold off on that since you guys are waiting for the functionality. |
This functionality is just about complete. I made some changes to the design during the process of implementing this for Mongoid. First, the Second, I decided it makes the most sense to add a member to the group generically when they are added with a membership type. So: group.add(user, as: 'employee')
user.in_group?(group) # => true
group.users.delete(user, as: 'employee')
user.in_group?(group) # => true
group.users.delete(user)
user.in_group?(group) # => false |
Released Groupify 0.6.0.rc1 to rubygems. Let me know if you have any issues. |
The membership type functionality has now been released in version 0.6.0. Enjoy! |
Implements membership types to allow members to belong to groups or named groups in a more specific way. This can be used to implement role-based authorization on groups of resources.
Fixes #3 and #4.