Commit 9a98b30e by Tuomas Riihimäki

Add function to permbean 'isCurrentUser' with 'login'

1 parent 3521c558
......@@ -60,6 +60,8 @@ public interface PermissionBeanLocal {
boolean hasPermission(SpecialPermission superadmin);
boolean isCurrentUser(String login);
// boolean hasPermission(String perm);
}
......@@ -156,7 +156,14 @@ public class PermissionBean implements PermissionBeanLocal {
@Override
public boolean isCurrentUser(User user) {
return (context.getCallerPrincipal() == null || user == null) ? false : context.getCallerPrincipal().getName().equals(user.getLogin());
return user != null && isCurrentUser(user.getLogin());
}
@Override
public boolean isCurrentUser(String login) {
return (context.getCallerPrincipal() == null || login == null) ? false : context.getCallerPrincipal().getName().equals(login);
}
@Override
......@@ -215,7 +222,7 @@ public class PermissionBean implements PermissionBeanLocal {
//logger.debug("Principal: {}", principal);
String principalName = principal.getName();
// logger.debug("Principal is {}", principalName);
// logger.debug("Principal is {}", principalName);
return principalName;
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!