cancel
Showing results for 
Search instead for 
Did you mean: 

cant use CheckOutCheckInService

mrksjs
Champ on-the-rise
Champ on-the-rise
hi folks,

i wrote a rule which does some stuff and should add a new version to an existing document in my repository.

i found out that there is a service for that:
http://dev.alfresco.com/resource/docs/java/repository/org/alfresco/service/cmr/coci/CheckOutCheckInS...
seems to be the right choice? however, i am unable to use the service, i receive an access denied exception when using the checkin(…) method.
i am logged in as administrator when triggering the rule and i have changed the permissions on Rendering Actions Space for EVERYONE to collaborator.

i cant find a snippet where this service is used, do i have to pass credentials before using the service?

help!


 2012-09-22 15:29:03,990  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction2] Failed to execute asynchronous action: Action[ id=ea9f807e-22df-4a0d-aadf-461473bf85fb, node=workspace://SpacesStore/ea9f807e-22df-4a0d-aadf-461473bf85fb ]
org.alfresco.repo.security.permissions.AccessDeniedException: 08220084 Access Denied.  You do not have the appropriate permissions to perform this operation.
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:50)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy51.checkin(Unknown Source)
        at de.rule.web.action.executer.DocuGateImporter.executeImpl(DocuGateImporter.java:301)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:790)
        at org.alfresco.repo.action.executer.CompositeActionExecuter.executeImpl(CompositeActionExecuter.java:66)
        at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:196)
        at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:790)
        at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:701)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:403)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:388)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:259)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:412)
        at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:516)
        at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:415)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: net.sf.acegisecurity.AccessDeniedException: Access is denied.
        at net.sf.acegisecurity.vote.AffirmativeBased.decide(AffirmativeBased.java:86)
        at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.beforeInvocation(AbstractSecurityInterceptor.java:398)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:77)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
        … 23 more

when im looking up the mentioned noderef in the node browser i receive this:
[img]https://dl.dropbox.com/u/42239474/noderefsmall.jpg[/img]
https://dl.dropbox.com/u/42239474/noderef.jpg


version is: enterprise 4.0.2.9
already raised a ticket in jira.
3 REPLIES 3

mrogers
Star Contributor
Star Contributor
You should be using the version service to create a new version.   Or if the node is already versionable then the new version will be created automatically, no need to do anything.

The checkin action is only allowed by the lock owner (the user that has the checked out).    If you want to check in as some sort of administrator then you need to "take ownership" first.   The checkin/out service is also a little bit odd in that it doesn't play nicely with "run as"  at least it didn't the last time I tried to use it.

mrksjs
Champ on-the-rise
Champ on-the-rise
what if i want to update document A with the content of document B?
do you have an example for that?

and how do i take ownership inside a rule?
just put
params.put(ContentModel.PROP_OWNER, owner);
to the nodes properties?


i dont really understand the problem with this. if i as an admin run the rule, there should never be an access denied exception?!

mrksjs
Champ on-the-rise
Champ on-the-rise
i used

ownableService.takeOwnership(actionedUponNodeRef);

however, i still receive the access denied exception. would you be so kind to explain how the service is supposed to be used? i really can't find any example on this.