Greetings java hipsters!
I just generated a jhipster project and created some entities. I'd like to hide some entities by restricting them to only the admin user. How do I achieve this ?
Thanks!
First read Spring Security doc then look at your project source code that was generated by JHipster: it's full of such examples, pay attention to:
SecurityConfiguration.java
@Secured(AuthoritiesConstants.ADMIN)
in UserResource.java
Then for the angular part, you can add a requirement for admin role in a state's definition like in src/main/webapp/app/admin/configuration/configuration.state.js
(search for authorities: ['ROLE_ADMIN']
). So for a bank-account
entity, main state would be defined in src/main/webapp/app/entities/bank-account/bank-account.state.js
.
This is for JHipster 3.x
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With