public static boolean hasPermission(Security security,GenericValue userLogin,GenericValue orderHeader){
  if (userLogin == null || orderHeader == null)   return false;
  if (security.hasEntityPermission("ORDERMGR","_VIEW",userLogin)) {
    return true;
  }
 else   if (security.hasEntityPermission("ORDERMGR","_ROLEVIEW",userLogin)) {
    List<GenericValue> orderRoles=null;
    try {
      orderRoles=orderHeader.getRelated("OrderRole",UtilMisc.toMap("partyId",userLogin.getString("partyId")),null,false);
    }
 catch (    GenericEntityException e) {
      Debug.logError(e,"Cannot get OrderRole from OrderHeader",module);
    }
    if (UtilValidate.isNotEmpty(orderRoles)) {
      return true;
    }
  }
  return false;
}

public static boolean hasPermission ( Security security , GenericValue userLogin , GenericValue orderHeader ) { if ( userLogin == null || orderHeader == null ) return false ; if ( security . hasEntityPermission ( "ORDERMGR" , "_VIEW" , userLogin ) ) { return true ; } else if ( security . hasEntityPermission ( "ORDERMGR" , "_ROLEVIEW" , userLogin ) ) { List < GenericValue > orderRoles = null ; try { orderRoles = orderHeader . getRelated ( "OrderRole" , UtilMisc . toMap ( "partyId" , userLogin . getString ( "partyId" ) ) , null , false ) ; } catch ( GenericEntityException e ) { Debug . logError ( e , "Cannot get OrderRole from OrderHeader" , module ) ; } if ( UtilValidate . isNotEmpty ( orderRoles ) ) { return true ; } } return false ; }
checks to see if this user has read permission on the specified order
