M
M
MarkusEfr2019-06-15 22:18:05
Spring
MarkusEfr, 2019-06-15 22:18:05

How to limit the visibility of an element on the page depending on the role?

Greetings. I am writing a web application on Spring boot, Thymeleaf and faced the need to limit the visibility of some interface elements on the page. I have welcome.html, where for the admin I want to display elements for managing the CRUD entity of the software, and if the user role is not admin, then no.
5d05443ee8111592754351.jpeg
Spring security is set up. The project can be viewed here https://github.com/MarkusEfr/Market.
How is this problem solved within this framework?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-06-16
@sergey-gornostaev

From documentation :

<div sec:authorize="hasRole('ROLE_ADMIN')">
  This content is only shown to administrators.
</div>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question