Our application has listeners deployed on the Deployment.ManagedObjectCreate and Deployment.ManagedObjectUpdate events that perform specific actions once a Content Instance has been published and are working fine.
I've added code to these listeners to create a new Version of the Content Instance every time it is published, code highlighted below:
//Get the managed object type reference
ManagedObjectVCMRef ctManObjRef = ci.getManagedObjectRef().asManagedObjectVCMRef()
//Create Version
int versionID = ContentManagementOps.createVersion(ctManObjRef, "New Version");
However, on publish, the following error is returned:
Error 18 (AuthorizationError), Message 026-111-0001: Authorization failure. Capabilities required: VCM:MEDIA_TYPE_WRITE
I have since added login code to log in as the Administrator before creating the version (code below) but I am still receiving the same error.
AuthnBundle authBundle = new AuthnBundle();
authBundle.setUsername(username);
authBundle.setPassword(password);
authBundle.setHost(host);
authBundle.setPort(port);
LoginMgr login = new LoginMgr();
login.login(authBundle);
I am running Vignette 7.6