Add Role resource 💛#5
Open
betoharres wants to merge 14 commits into
Open
Conversation
Because companies_controller outputs only records based from current_user, we need to create a bridge between the tests and the logged user by creating their relationship
Also refactor assign_credentials that was not creating Roles properly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User(n) x (n)Role, whereCredentialis the sum of aUserhaving aRoleand being related to aCompanyRolehave a json field calledpermissionswhere will contain the schema that the authorization classes will based if user can or cannot do certain action usingpundit gem(WIP).After
Userregister, he will be able to create aCompany, in the creation of the company rails will create 2 Roles:AdministratorandGuest, these 2 names will be reserved and are unique along with it'scompany_id.Then after all this is done, after
@company.save, rails will createUserCompanyrecord to bound theUserrelationship with the just createdCompany.When that's done,
UserCompanywill run it's callbackassign_credentialsto createCredentials, which, as described above, is the final bound to refer the User's role inside atenant.Test are green, but there're some pending tests that should be included in the Credential and Role model specs, which turns our heart to 💛 .