Prevent type.properties check when accessing properties

of Java objects as skin macros.
This commit is contained in:
hns 2001-11-27 16:08:15 +00:00
parent a73255d123
commit dee820e805

View file

@ -1020,7 +1020,7 @@ public class RequestEvaluator implements Runnable {
if (func != null && func instanceof FunctionPrototype) if (func != null && func instanceof FunctionPrototype)
return true; return true;
} catch (EcmaScriptException esx) { } catch (EcmaScriptException esx) {
System.err.println ("Error in getProperty: "+esx); // System.err.println ("Error in getProperty: "+esx);
return false; return false;
} }
return false; return false;
@ -1040,12 +1040,17 @@ public class RequestEvaluator implements Runnable {
"password".equalsIgnoreCase (propname)) "password".equalsIgnoreCase (propname))
return "[macro access to password property not allowed]"; return "[macro access to password property not allowed]";
DbMapping dbm = app.getDbMapping (prototypeName); // if this is a HopObject, check if the property is defined
if (dbm != null) { // in the type.properties db-mapping.
Relation rel = dbm.propertyToRelation (propname); if (obj instanceof INode) {
if (rel == null || !rel.isPrimitive ()) DbMapping dbm = app.getDbMapping (prototypeName);
return "[property \""+propname+"\" is not defined for "+prototypeName+"]"; if (dbm != null) {
Relation rel = dbm.propertyToRelation (propname);
if (rel == null || !rel.isPrimitive ())
return "[property \""+propname+"\" is not defined for "+prototypeName+"]";
}
} }
ESObject eso = getElementWrapper (obj); ESObject eso = getElementWrapper (obj);
try { try {
ESValue prop = eso.getProperty (propname, propname.hashCode()); ESValue prop = eso.getProperty (propname, propname.hashCode());