-
Notifications
You must be signed in to change notification settings - Fork 2
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
Only show the edit buttons if the user has the required permissions #228
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly not a big fan of the current implementation. It works, but it doesn't really scale when the application becomes more complex and different users start using the app.
I think https://github.com/Bagaar/ember-permissions would be a nicer way to set this up. It was made for this use case and it's easier to set up more fine grained permissions in the future. I didn't know this was planned this sprint or else I would have documented it in the issue.
The roles can be mapped to a list of permissions (for now only edit
I guess) and the helpers can be used instead of the <SecuredArea>
component.
The repeated code in the before model hooks would be replaced by setting the route permissions and handling the route-access-denied
event.
Now, I assume everything works so it might not be worth redoing everything since we can still refactor it in the future. It would have been nice if you pinged me before starting the implementation though.
app/routes/administrative-units/administrative-unit/core-data/edit.js
Outdated
Show resolved
Hide resolved
Well, I set 8 story points for the ticket and did implement it in 1 hour lol. I knew it will take more time than that after the PR would be open. to me it was easier to implement it the way I would, open the discussion through PR and then refactor accordingly. I know you are busy with the change events so didn't want to interrupt. I still have time to try out ember permission tbf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some final minor things!
app/routes/administrative-units/administrative-unit/core-data/edit.js
Outdated
Show resolved
Hide resolved
app/routes/administrative-units/administrative-unit/core-data/edit.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also did a quick test locally and everything seems to work as expected. Nice!
No description provided.