/// <summary> /// Checks if the attributes of a determinate class are visible according to the agent connected /// </summary> /// <param name="typeInstance">Type fo the class to check the visibility</param> /// <param name="attributeVisibility">Attribute to be checked, it is not owned to the class that is being checked</param> /// <param name="onContext">Request context </param> public static bool IsVisibleInv(Type typeInstance, ONPath attributeVisibility, ONContext onContext) { if (attributeVisibility.Count == 0) { return(true); } ONPath lAttributeVisibility = new ONPath(attributeVisibility); string lRol = lAttributeVisibility.RemoveHead(); // Attributes if (lAttributeVisibility.Count == 0) { ONAttributeAttribute lAttributeAttribute = ONContext.GetAttributeInProperty(typeInstance, typeof(ONAttributeAttribute), "<Attribute>" + lRol + "</Attribute>") as ONAttributeAttribute; if (lAttributeAttribute != null) { return(lAttributeAttribute.IsVisible(onContext)); } } // Roles ONRoleAttribute lRoleAttribute = ONContext.GetAttributeInProperty(typeInstance, typeof(ONRoleAttribute), "<Role>" + lRol + "</Role>") as ONRoleAttribute; if (lRoleAttribute != null) { Type lTypeInstanceInv = ONContext.GetType_Instance(lRoleAttribute.Domain); return(IsVisible(lTypeInstanceInv, lRoleAttribute.RoleInv, onContext) && IsVisibleInv(lTypeInstanceInv, lAttributeVisibility, onContext)); } return(false); }