I'm trying to add the okg:prop property group automagically whenever a document is modified in the repository. This property group was manually added to the PropertyGrouups.[cnd,xml] files.
canAddMixin() seems to work fine for the okmAdmin user (false if the property group has already been added, true otherwise), but whenever a non-admin account adds a new document canAddMixin() always returns false.
However, manually calling eventNode.addMixin("okg:prop") by the non-admin account adds the mixin correctly.
Here's a snippet of the related okm:scriptCode.
canAddMixin() seems to work fine for the okmAdmin user (false if the property group has already been added, true otherwise), but whenever a non-admin account adds a new document canAddMixin() always returns false.
However, manually calling eventNode.addMixin("okg:prop") by the non-admin account adds the mixin correctly.
Here's a snippet of the related okm:scriptCode.
Code: Select all
Sure, I could check that the script was called by CREATE_DOCUMENT event, but this will not catch the case when someone removed the propertygroup manually....
if(eventNode.canAddMixin("okg:prop"))
{
eventNode.addMixin("okg:prop");
print("EVENT_NODE_CAN_ADDMIXIN!!");
}
else
{
print("EVENT_NODE_CAN_NOT_ADDMIXIN!!");
}
...