View only role

I want to create a role that can only view not modified things, and other roles can edit. Can you tell me how to proceed on this.

You would need to set all input fields to read-only

You could do that like this

textField.setReadOnly(!securityContext.isUserInRole("WRITER");

The Method isUserInRole can be implmented like this

public boolean isUserInRole(String role) {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    return auth != null && auth.getAuthorities().stream().anyMatch(a ->   a.getAuthority().equals(role)));
}

thanks