Page 1 of 1

eventNode.canAddMixin always returns false for non-admin?

PostPosted:Mon Feb 13, 2012 8:01 pm
by AlexBeaudoin
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.
Code: Select all
...
if(eventNode.canAddMixin("okg:prop"))
{
    eventNode.addMixin("okg:prop");
    print("EVENT_NODE_CAN_ADDMIXIN!!");
}
else
{
    print("EVENT_NODE_CAN_NOT_ADDMIXIN!!");
}
...
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.

Re: eventNode.canAddMixin always returns false for non-admin

PostPosted:Tue Feb 14, 2012 7:34 am
by jllort
You should get document path and then use OKMPropertyGroup.getInstance().addGroup(null, path, grpName);