private boolean isAuthorized(ApplicationUser applicationUser,String namespace,NamespacePermissionEnum... permissions){
  if (applicationUser != null && applicationUser.getNamespaceAuthorizations() != null) {
    for (    NamespaceAuthorization currentUserAuthorization : applicationUser.getNamespaceAuthorizations()) {
      List<NamespacePermissionEnum> currentUserNamespacePermissions=currentUserAuthorization.getNamespacePermissions();
      if (currentUserNamespacePermissions == null) {
        currentUserNamespacePermissions=Collections.emptyList();
      }
      if (StringUtils.equalsIgnoreCase(currentUserAuthorization.getNamespace(),namespace) && currentUserNamespacePermissions.containsAll(Arrays.asList(permissions))) {
        return true;
      }
    }
  }
  return false;
}

private boolean isAuthorized ( ApplicationUser applicationUser , String namespace , NamespacePermissionEnum ... permissions ) { if ( applicationUser != null && applicationUser . getNamespaceAuthorizations ( ) != null ) { for ( NamespaceAuthorization currentUserAuthorization : applicationUser . getNamespaceAuthorizations ( ) ) { List < NamespacePermissionEnum > currentUserNamespacePermissions = currentUserAuthorization . getNamespacePermissions ( ) ; if ( currentUserNamespacePermissions == null ) { currentUserNamespacePermissions = Collections . emptyList ( ) ; } if ( StringUtils . equalsIgnoreCase ( currentUserAuthorization . getNamespace ( ) , namespace ) && currentUserNamespacePermissions . containsAll ( Arrays . asList ( permissions ) ) ) { return true ; } } } return false ; }
returns true if the application user is authorized to the given namespace and has the given permissions .
