if(accessControl.isDefined() && accessControl.hasDefined(DEFAULT)) // TODO: overrides ...
{
ModelNode model = accessControl.get(DEFAULT);
Constraints c = new Constraints();
if(model.hasDefined(ADDRESS)
&& model.get(ADDRESS).asBoolean()==false)
{
c.setAddress(false);
}
else
{
c.setReadConfig(model.get(READ_CONFIG).asBoolean());
c.setWriteConfig(model.get(WRITE_CONFIG).asBoolean());
c.setReadRuntime(model.get(READ_RUNTIME).asBoolean());
c.setWriteRuntime(model.get(WRITE_RUNTIME).asBoolean());
}
// attribute constraints
if(model.hasDefined(ATTRIBUTES))
{
List<Property> attributes = model.get(ATTRIBUTES).asPropertyList();
for(Property att : attributes)
{
ModelNode attConstraintModel = att.getValue();
// config access
if(attConstraintModel.hasDefined(READ_CONFIG))
{
c.setAttributeRead(att.getName(), attConstraintModel.get(READ_CONFIG).asBoolean());
c.setAttributeWrite(att.getName(), attConstraintModel.get(WRITE_CONFIG).asBoolean());
}
// runtime access
else
{
c.setAttributeRead(att.getName(), attConstraintModel.get(READ_RUNTIME).asBoolean());
c.setAttributeWrite(att.getName(), attConstraintModel.get(WRITE_RUNTIME).asBoolean());
}
}
}
context.updateResourceConstraints(resourceAddress, c);