public void checkPermission(String namespace,NamespacePermissionEnum[] permissions){
  if (!isAuthenticated() || StringUtils.isBlank(namespace)) {
    return;
  }
  String namespaceTrimmed=namespace.trim();
  ApplicationUser applicationUser=getApplicationUser();
  if (!isAuthorized(applicationUser,namespaceTrimmed,permissions)) {
    LOGGER.warn(String.format("User does not have permission(s) to the namespace. %s namespace=\"%s\" permissions=\"%s\"",applicationUser,namespaceTrimmed,Arrays.asList(permissions)));
    if (applicationUser != null) {
      throw new AccessDeniedException(String.format("User \"%s\" does not have \"%s\" permission(s) to the namespace \"%s\"",applicationUser.getUserId(),Arrays.asList(permissions),namespaceTrimmed));
    }
 else {
      throw new AccessDeniedException(String.format("Current user does not have \"%s\" permission(s) to the namespace \"%s\"",Arrays.asList(permissions),namespaceTrimmed));
    }
  }
}

public void checkPermission ( String namespace , NamespacePermissionEnum [ ] permissions ) { if ( ! isAuthenticated ( ) || StringUtils . isBlank ( namespace ) ) { return ; } String namespaceTrimmed = namespace . trim ( ) ; ApplicationUser applicationUser = getApplicationUser ( ) ; if ( ! isAuthorized ( applicationUser , namespaceTrimmed , permissions ) ) { LOGGER . warn ( String . format ( "User does not have permission(s) to the namespace. %s namespace=\"%s\" permissions=\"%s\"" , applicationUser , namespaceTrimmed , Arrays . asList ( permissions ) ) ) ; if ( applicationUser != null ) { throw new AccessDeniedException ( String . format ( "User \"%s\" does not have \"%s\" permission(s) to the namespace \"%s\"" , applicationUser . getUserId ( ) , Arrays . asList ( permissions ) , namespaceTrimmed ) ) ; } else { throw new AccessDeniedException ( String . format ( "Current user does not have \"%s\" permission(s) to the namespace \"%s\"" , Arrays . asList ( permissions ) , namespaceTrimmed ) ) ; } } }
checks the current user ' s permissions against the given namespace .
