@Override
 public boolean hasApplicationFunction(
     Authentication authentication, String application, AppFunction fn) {
   User user = getUserToken(authentication);
   return user != null
       && (user.isAdmin() || grantService.hasAppFunction(application, user.getName(), fn));
 }
 @Override
 public boolean hasOneOfUserFunction(UserFunction... fns) {
   User user = getCurrentProfile();
   if (user != null) {
     if (user.isAdmin()) {
       return true;
     } else {
       for (UserFunction fn : fns) {
         if (grantService.hasUserFunction(user.getName(), fn)) {
           return true;
         }
       }
       return false;
     }
   } else {
     return false;
   }
 }
 @Override
 public boolean isAdmin(Authentication authentication) {
   User user = getUserToken(authentication);
   return user != null && user.isAdmin();
 }
 @Override
 public String getCurrentUserName() {
   User profile = getCurrentProfile();
   return profile != null ? profile.getName() : null;
 }