vaadin / full-stack-starter

Public repository for Full Stack Starter issues
https://vaadin.com/start
1 stars 0 forks source link

How to use Role class to selectively hide/show controls on various pages.. #13

Closed nitinkunni closed 6 years ago

nitinkunni commented 6 years ago

Currently in the code, the Role setup is only at Page level and handled using the @Secured() annotation in the various view classes. However, I want to use the current user role to do specific control processing. Example show or hide a particular widget in the Dashboard page. How do I do that? The Dashboard view class only seems to expose the OrderRepository and not the current logged in user and role.

Please suggest

johannesh2 commented 6 years ago

V10 version has pretty weird way to do it compared to V8 version. It exposes currentUser and you should be able autowire it. We should improve the code by bringing the ones from V8 version. V8 version has SecurityUtils methods isCurrentUserInRole, getUserRoles and getCurrentUser which work better #14

nitinkunni commented 6 years ago

Where do I download the code for v8 version?

johannesh2 commented 6 years ago

https://vaadin.com/start/v8-full-stack-spring

nitinkunni commented 6 years ago

thanks. I am still trying to understanding AutoWiring. I will download v8 and see if I can get that code integrated into my v10 copy