Commit 94bd6acd9f3372e3faa5c212da42e69a9763b737
1 parent
7e9edf1d
Segurança e ajustes nos pacotes
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
demoiselle-security/src/main/java/org/demoiselle/jee/security/impl/SecurityContextImpl.java
... | ... | @@ -51,9 +51,9 @@ public class SecurityContextImpl implements SecurityContext { |
51 | 51 | @Override |
52 | 52 | public boolean hasRole(String role) { |
53 | 53 | if (tm.getUser().getRoles().parallelStream().filter(p -> p.equals(role)).count() <= 0) { |
54 | - return true; | |
54 | + return false; | |
55 | 55 | } |
56 | - return false; | |
56 | + return true; | |
57 | 57 | } |
58 | 58 | |
59 | 59 | /** | ... | ... |
demoiselle-security/src/main/java/org/demoiselle/jee/security/interceptor/RequiredPermissionInterceptor.java
... | ... | @@ -77,7 +77,7 @@ public class RequiredPermissionInterceptor implements Serializable { |
77 | 77 | logger.finest(bundle.accessCheckingPermission(username, operation, resource)); |
78 | 78 | } |
79 | 79 | |
80 | - if (securityContext.hasPermission(resource, operation)) { | |
80 | + if (!securityContext.hasPermission(resource, operation)) { | |
81 | 81 | logger.severe(bundle.doesNotHavePermission(username, operation, resource)); |
82 | 82 | throw new DemoiselleSecurityException(bundle.doesNotHavePermission(username, operation, resource), Response.Status.UNAUTHORIZED.getStatusCode()); |
83 | 83 | } | ... | ... |