mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
remove role link from user
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.commafeed.frontend.auth;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -46,7 +47,8 @@ public class SecurityCheckFactory extends AbstractContainerRequestValueFactory<U
|
||||
}
|
||||
|
||||
if (user.isPresent()) {
|
||||
if (user.get().hasRole(role)) {
|
||||
Set<Role> roles = userService.getRoles(user.get());
|
||||
if (roles.contains(role)) {
|
||||
return user.get();
|
||||
} else {
|
||||
throw new WebApplicationException(Response.status(Response.Status.FORBIDDEN)
|
||||
|
||||
Reference in New Issue
Block a user