cancel
Showing results for 
Search instead for 
Did you mean: 

check out - check in - editing

jora
Champ in-the-making
Champ in-the-making
As I am wandering through the functionalities of the software (usiong version 1.4), I came across the checking out of documents.
When a user checks out a document, a working copy of the document is created in a space (default in the same space as the original). However, another user than the user that checked out the document can check it in.

This seems very strange to me. It was my understanding that when I check out a document, I am the only person that can check it back in. Is this default behaviour and is it possble to change it somewhere in the configuration files? Thanks.
9 REPLIES 9

gavinc
Champ in-the-making
Champ in-the-making
This is the default behaviour, anyone with the CHECK_IN permission can check the file back in.

This is controlled via the CheckinDocEvaluator class, this is configured in the web-client-config-actions.xml file. So, yes, you could write your own evaluator which only returns true if the working copy owner is the current user and then override the action configuration.

ps
Champ in-the-making
Champ in-the-making
Gavin,

I need to restrict file checkIn to Coordinators only. Is there any info in the Wiki on how to do what you mentioned in your post?

I posted to the configurations Forum yesterday, but havent heard back from anyone on this.

Thanks,

Panna

gavinc
Champ in-the-making
Champ in-the-making
Yes, you can do that if you wish, again, you need to write a custom action evaluator. There are a couple of pages that may be of help on the wiki:

http://wiki.alfresco.com/wiki/Web_Client_Customisation_Guide
http://wiki.alfresco.com/wiki/Externalised_Client_Actions

aznk
Champ in-the-making
Champ in-the-making
Hi,
Is it sufficient to modify the CheckinDocEvaluator.java class as follows :
package org.alfresco.web.action.evaluator;

import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.bean.repository.Node;

/**
* UI Action Evaluator - Checkin document.
*
* @author Kevin Roast
*/
public class CheckinDocEvaluator implements ActionEvaluator
{
   /**
    * @see org.alfresco.web.action.ActionEvaluator#evaluate(org.alfresco.web.bean.repository.Node)
    */
   public boolean evaluate(Node node)
   {
      return (node.hasPermission(PermissionService.OWNER_AUTHORITY) &&
    
              node.hasAspect(ContentModel.ASPECT_WORKING_COPY) == true);
   }
}
that is to say put OWNER_AUTHORITY instead of CHECK_IN or should we create another class ?
And what do you mean by override the action configuration ?
could we just let eb-client-config-actions.xml like it is or create a new configuration file ?

gavinc
Champ in-the-making
Champ in-the-making
You can certainly change CheckinDocEvaluator if you wish but it's not very upgrade proof i.e. you'll have to re-apply your change.

It's best to create a new evaluator and override the action config for the checkin action as follows:

In web-client-config-custom.xml (a sample version of this file is shipped) add the following config:

<config>
   <actions>
      <action id="checkin_doc">
         <evaluator>your.CheckinDocEvaluator</evaluator>
         <label-id>checkin</label-id>
         <image>/images/icons/CheckIn_icon.gif</image>
         <action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
         <action>dialog:checkinFile</action>
         <params>
            <param name="id">#{actionContext.id}</param>
         </params>
      </action>
   </actions>
</config>

aznk
Champ in-the-making
Champ in-the-making
Thanks for your answer.
So I wrote my own CheckinDocEvaluator by just modifying OWNER_AUTHORITY instead of CHECK_IN in the  CheckinDocEvaluator.java as above, and made changes to the web-client-config-custom.xml  as you said.
But in the client, when I check out a document, the check in button completely disappeared, even for the owner of the document, did I put the wrong permission ? It should disappear for all non-owners of the document but should be available for the owner.

aznk
Champ in-the-making
Champ in-the-making
I got the desired behavior by putting the following line instead :
node.isWorkingCopyOwner() == true

travman
Champ in-the-making
Champ in-the-making
What about only permitting the working copy owner to "undo checkout?"


Creating an evaluator does not seem difficult, but what is the "action id" and the "label-id?"  How can we find out what the action ids are—on our own?  I tried a configuration like this, but it does not work:

<action id="cancel_checkout_doc">
   <evaluator>my.version.CancelCheckoutDocEvaluator</evaluator>
   <label-id>undocheckout</label-id>
   <image>/images/icons/undo_checkout.gif</image>
   <action-listener>#{CheckinCheckoutBean.setupContentAction}</action-listener>
   <action>dialog:undoCheckoutFile</action>
   <params>
      <param name="id">#{actionContext.id}</param>
   </params>
</action>

Thanks

kevinr
Star Contributor
Star Contributor
The action IDs can be seen in the web-client-config-actions.xml file. You definition is nearly correct, but the action is wrong, try "cancelcheckout_doc".

The "label-id" is the I18N message label in the webclient.properties (or overriden one) bundle. You can use "label" instead and just put the plain text label into the config if you prefer.

Thanks,

Kevin