How to Implement New hook script for checkout

satheesh
satheesh
Hi friends, am using svn on windows. by default 9 hooks are available in hooks folder in Repository path like pre-commit,post-commit,pre-lock.... my question : Is there is any way to implement new hook script like pre-checkout and post-checkout.  I want to check whether the user has the permission to checkout the corresponding files & I need to send notification if any user checkout any file or folders in the repository...  So i need pre-checkout & post-checkout hooks  Thanks in advance.........

Last updated

Mand
Mand
Hi there,   Can I ask why you want a notification when people checkout? There may be a better/simpler way of achieving what you want.   If you're using Apache you can probably script something from the logs, but I'm not aware of a hook that is available for this.
satheesh
satheesh
Thanks Mand,  But, before checkout i want check the user's rights, right users only able to checkout... others are not able to checkout...   In this case how can i check
andyl
andyl
Hook scripts do not fire on checkout. Only on events which are about to or just have altered the repository.    Subversion has path-based authorization built in. Use that to stop people from accessing things they shouldn't have access to. If think you need to monitor checkouts this closely, you have major trust issues with the people you've granted access, and no software can fix that. You have a people problem, not a technical one.
satheesh
satheesh
Thanks andyl,  I going to use path based authentication.... to fix this problem  tha
vinnyjames
vinnyjames
I think you're looking for path based authorization. You can do this with open source Subversion via the authz file (see http://svnbook.red-bean.com/en/1.7/svn.ref.mod_authz_svn.conf.html) or use the web interface provided by uberSVN (see http://www.wandisco.com/ubersvn) or with commercial products such as WANdisco's Subversion Access control (see http://www.wandisco.com/subversion/accesscontrol).
Thenmozhi
Thenmozhi
Hi,  We want to know is there any way in SVNServer to introduce new hooks apart from the existing 9 types of hooks. So that we can use it for any set of operation that we are doing with the SVN repository. For example, we would like to introduce hook to invoke before opening the repository, or while getting the file from repository, something like that.  Any help will be greatly apprecaited. Thanks in advance.
andyl
andyl
Thenmozhi;120610Hi,    We want to know is there any way in SVNServer to introduce new hooks apart from the existing 9 types of hooks. So that we can use it for any set of operation that we are doing with the SVN repository. For example, we would like to introduce hook to invoke before opening the repository, or while getting the file from repository, something like that.    Any help will be greatly apprecaited. Thanks in advance.
   Subversion has no concept of "opening the repository", so you're at a loss there.    If you serve with Apache, you can try this. It watches your Apache log & can perform actions on particular events.    But as noted above, you really have to consider why you think you need this in the first place. Because it will probably not solve whatever problem you think you have.
satheesh
satheesh
Hi andyl,  you have mentioned abt svnhookdispatcher. i have 2 questions,  1. whether it is working under svnserve or not.  2. If its working, can i use this(svnhookdispatcher) for some other events like "pre-checkout" , "log in to repository"(while connection establishment... that is opening the repository with user credential)
Mand
Mand
Satheesh,   The link that andyl provided uses the Apache module, so you'd only be able to use that if you're using Apache to serve the repository (not svnserve).
satheesh
satheesh
Thanks Mand,  Is any other way is there to implement this in svnserve.  I mean before login and before checkout it is possible to call any hooks script..
Mand
Mand
There are *no* pre-defined hooks that report on read actions. As andyl said, I'd consider why you really need this, address the people problem if there is one, or failing that use Apache and tailor something from the log.
andyl
andyl
satheesh;120627Hi andyl,    you have mentioned abt svnhookdispatcher. i have 2 questions,    1. whether it is working under svnserve or not.[/quote]As the link and my post clearly state, it only works if you serve via Apache.    [QUOTE=satheesh;120627]2. If its working, can i use this(svnhookdispatcher) for some other events like "pre-checkout" , "log in to repository"(while connection establishment... that is opening the repository with user credential)
 If those actions are captured by the Apache log, but I don't think they are. Even so, that script only triggers after the event is written to the log - it cannot interrupt an activity.    You really need to stop and consider why you think you need this level of monitoring and control in the first place. If it's purely to restrict access, Subversion has methods of controlling access built in (or with 3rd party products). If it's to know who has a working copy and when they're updating it, you can't get this information reliably in any way, as there are ways around it (especially checkout). It sounds like you have a trust issue, or an inability to follow procedures, with the people who you have granted access - and NO software can take care of that.

1-13 of 13

Reply to this discussion

You cannot edit posts or make replies: You should be logged in before you can post.