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

Store User Roles as Bitmask, Not Relation #272

Merged
merged 3 commits into from
Feb 28, 2015
Merged

Conversation

nickbarnwell
Copy link

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) when pulling 2a748d8 on roles-bitmask into 59039a7 on master.

@nickbarnwell
Copy link
Author

Barring objections from anyone who's worked with the Role code (@mehulkar ?) I'm going to run this against my test database in dev, make sure it doesn't horrificially break anything, then deploy this weekend.

@mehulkar
Copy link
Contributor

Interesting. The point of this to cache a users roles in the users table?

@nickbarnwell
Copy link
Author

And simplify adding roles. They'll be defined in code, rather than the DB. We're not at the level where having dynamic role creation is terribly useful.

@mehulkar
Copy link
Contributor

Speeds up queries too I guess. Does this completely remove the need for the roles table?

@nickbarnwell
Copy link
Author

Yup. and makes them easier to write. No more joining on four different tables to figure out who should show up on a page!

I may have made this change primarily because I was too dumb lazy to figure out how to write some of the analytic queries I wanted

@mehulkar
Copy link
Contributor

Yeah I've had that problem before. This is cool. Wish I had found this gem 6 months ago :)

@nickbarnwell
Copy link
Author

The sad part is I wrote the code to do exactly what the gem does, then found out it existed and already had tests and was properly modularised 👎… I was so excited to finally use my knowledge of bitwise operators

@nickbarnwell nickbarnwell merged commit 2a748d8 into master Feb 28, 2015
nickbarnwell pushed a commit that referenced this pull request Feb 28, 2015
Model user roles as a bitmask on the User record, not a relation.

Incldues migration rake task that converts between the old and new formats.
@nickbarnwell nickbarnwell deleted the roles-bitmask branch March 1, 2015 20:47
nickbarnwell pushed a commit that referenced this pull request Jun 6, 2015
Model user roles as a bitmask on the User record, not a relation.

Incldues migration rake task that converts between the old and new formats.
nickbarnwell pushed a commit that referenced this pull request Jun 6, 2015
Model user roles as a bitmask on the User record, not a relation.

Incldues migration rake task that converts between the old and new formats.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants