[dev] Share locking

Jan Schneider jan at horde.org
Thu Oct 23 23:05:32 UTC 2008


Zitat von Chuck Hagenbuch <chuck at horde.org>:

> Quoting Alfonso Marí­n Marí­n <almarin at um.es>:
>
>> As a previous step to start with CalDAV implementation, it is  
>> necessary to implement Kronolith locking capabilities, to have a  
>> way to lock calendars and/or events. I discussed with Jan an Ben  
>> the best way to do it and we come to the conclusion that share  
>> library would be a nice place to implement it to don't duplicate  
>> effort, because others application could use it.
>
> Sounds good to me.
>
>> I have done it and i would like to know your opinion. I attach the  
>> Horde_Share class modification and the Kronolith's api modification  
>> to expose locking capabilities to other applications/entities.
>
> Looks generally good. I would remove "share" from the names of  
> methods that are on the share class, and the patch for  
> kronolith/lib/api.php repeats _kronolith_unlock instead of  
> implementing _kronolith_checklocks. And _unlock doesn't seem to use  
> its parameters correctly. Oh, and there's no permissions checking.

One thing that I noticed: you seem to use the $locktype variable  
incorrectly in checkShareLocks(). You set it to 'item' before you use  
in the getLocks() call. Better use different variable names for the  
lock type passed to the Lock library, and the lock type (share/item)  
returned by the share's method.

>> Some things to comment:
>> - I have implemented the methods in Horde_Share. I had some doubts  
>> if it would be better in Horde_Share_Object.
>
> I think that would be better; most individual actions are on the  
> share objects now.
>
>> - A lock can be placed for an entire share or for an item_uid  
>> associated to it.
>> - For share locks i use the $_app var as the scope and share_id as  
>> the principal
>> - For item locks, i use the $_app:share_id as the scope and  
>> item_uid as  the principal. to give to a share a way to know which  
>> associated items are locked.
>> - It is not necessary at all use $_app information, but i thought  
>> that would be good idea to have that information somewhere in the  
>> lock information.
>
> I agree.
>
> Thanks,
> -chuck
>
> --
> Horde developers mailing list - Join the hunt: http://horde.org/bounties/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>



Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list