-
Notifications
You must be signed in to change notification settings - Fork 182
ng-admin role-based system #8
base: gh-pages
Are you sure you want to change the base?
Conversation
admin.addEntity(nga.entity('products').readOnly()); | ||
|
||
// configure entities | ||
require('./customers/userConfig')(nga, admin); |
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.
instead of duplicating the conf, I'd pass the roles as a parameter to the config function and let it decide how to configure.
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.
Are you talking about creating a provider/wrapper for handling configurations for different roles?
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 saying that you shouldn't put the if
here, but in the config files. Something like:
const roles = $window.$get().localStorage.getItem('posters_galore_roles')
admin.addEntity(nga.entity('customers'));
require('./customers/config')(nga, admin, roles);
And then, in the config files, decide what to add according to roles.
That's not a hack, that's the simple way to handle roles in ng-admin! |
Unless I'm missing something, this is certainly a hack. The problem is that you don't know that the user is an admin or not until the app is running at which point ng-admin has already been set up in the controller. So you need to reload the app after log in, and saving the state which is ugly. Same on log out. |
Can you plz help me to get the input box on my listview |
Hi. I've found the tweak for creating ability for role-based access to different parts of functionality in admin. Without any changes in admin-config or ng-admin core repository. Role-based access can be achieved using different configurations for different roles. Naive demo uses simple localStorage without any providers.