AnsweredAssumed Answered

lockStore in RunAs context

Question asked by vincent-kali on Aug 4, 2014
Latest reply on Aug 6, 2014 by vincent-kali
I'm trying to develop a Web Script to lock/unlock contents on behalf
of different users. To do this, I first tried to execute LockStore methods
in 'RunAs' mode. After reading the code I discovered that LockStore methods
are using FullyAuthenticatedUser instead of RunAsUser.
Then I started to develop my own LockStore class (ks2LockStore) to make use of RunAsUser.
This class is a copy of existing LockStore class, with some minor modification.
The class is declared in core-services-context.xml as follow:
    <bean id="ks2LockStoreFactory" class="org.alfresco.repo.lock.mem.ks2.Ks2DefaultLockStoreFactory"/>

    <bean id="ks2LockStore" factory-bean="ks2LockStoreFactory" factory-method="createLockStore"/>

    <bean id="ks2LockableAspectInterceptor" class="org.alfresco.repo.lock.mem.ks2.Ks2LockableAspectInterceptor">
        <property name="nodeService" ref="mlAwareNodeService"/>
        <property name="ks2LockStore" ref="ks2LockStore"/>
        <property name="authenticationService" ref="authenticationService"/>

Then I call ks2LockStore from my webscript. Everything seems to work fine except that LockableAspectInterceptor
does not do the job: locks are set in memory, but cm:aspect isn't spoofed by LockableAspectInterceptor.
Then content is not seen as locked in share interface.

If I understand correctly, I thing that I need to modify lockService to inject ks2LockStore into it. But I'd like
to avoid modifying lockService source code as it may have unexpectable side effects.

Any suggestion is welcome,
Thanks for your help,