Hi Team,
I have requirement to restrict from creation of exe file.
User is creating plain text file from share UI and entering name like test.exe.
I have created rule that checks if file name ends with exe, it throws exception. But rule is not executing somehow.
Then i have created behaviour that executes on node creation, I am getting parentref using below code.
public void init() {
policyComponent.bindClassBehaviour(NodeServicePolicies.BeforeCreateNodePolicy.QNAME,
ContentModel.TYPE_CONTENT,
new JavaBehaviour(this, "beforeCreateNode", Behaviour.NotificationFrequency.EVERY_EVENT));
}
@Override
public void beforeCreateNode(NodeRef parentRef, QName assocTypeQName, QName assocQName, QName nodeTypeQName) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Started executing FileCreationRestrictionBehaviour ..");
LOGGER.debug("parentref --> "+parentRef);
LOGGER.debug("parentref NAME --> "+nodeService.getProperty(parentRef, ContentModel.PROP_NAME));
System.out.println("parentref --> "+parentRef +
"parentref NAME --> "+nodeService.getProperty(parentRef, ContentModel.PROP_NAME));
}
}So,my requirement is to restrict file creation, if users enters .exe in file name, how can i get the noderef/filename of that file, so, i can throw exception.
Thanks,
Hardik