fixed damaged deleting slots, see #5
This commit is contained in:
@ -42,7 +42,7 @@ public abstract class CommonController {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ModelAttribute("hasDateRole")
|
||||
public Boolean hasDateRole(Principal principal) {
|
||||
OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal;
|
||||
@ -56,6 +56,21 @@ public abstract class CommonController {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ModelAttribute("hasAnyRole")
|
||||
public Boolean hasAnyRole(Principal principal) {
|
||||
OAuth2AuthenticationToken token = (OAuth2AuthenticationToken) principal;
|
||||
if (token != null) {
|
||||
OAuth2User user = token.getPrincipal();
|
||||
@SuppressWarnings("unchecked")
|
||||
List<String> roles = (List<String>) user.getAttributes().get("roles");
|
||||
return roles.size() > 0;
|
||||
} else {
|
||||
LOGGER.warn("token is null, no roles can be detected");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the theme for the current session
|
||||
*
|
||||
|
Reference in New Issue
Block a user