[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Re: Re: Re: Stealing/Breaking Locks

From: Simon Large <simon.tortoisesvn_at_googlemail.com>
Date: Tue, 28 Apr 2009 14:59:53 +0100

2009/4/28 <webpost_at_tigris.org>:
> Thanks Simon for ur replying.
>
> 1>But,I wanna to ask u whther it is possible or not?

Yes. Read the reply. I said it needs a very simple change to the
template hook script. The template only allows the lock owner to
unlock, which prevents stealing and breaking of locks. You need to
change that so that the admin user can also break locks.

> 2>Is there any other way to restrict users other than hook-scripts?

Not that I know of.

> 3>Can u please give us the hint so that we can atleast start?

How many more hints do you need? You want me to write the script for you?

You could try something like this. It is not the most efficient and it
is not tested, but it is a starting point.

pre-unlock.bat
--------------------------------------------------------------------------
@echo off
setlocal
set REPOS=%1
set PATH=%2
set USER=%3

:: Admin user can always unlock
if "%USER%" == "AdminUserName" exit 0

:: If no lock present return success
svnlook lock "%REPOS%" "%PATH%" | findstr /C:"^Owner:" > nul
if %errorlevel% gtr 0 exit 0

:: If lock is present but not owned by this user, deny unlock
svnlook lock "%REPOS%" "%PATH%" | findstr /C:"^Owner: %USER%" > nul
if %errorlevel% gtr 0 goto err

:: Own lock can be released OK.
exit 0

:err
echo Breaking locks is not allowed. 1>&2
exit 1
--------------------------------------------------------------------------

Simon

-- 
:       ___
:  oo  // \\      "De Chelonian Mobile"
: (_,\/ \_/ \     TortoiseSVN
:   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
:   /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=1963863
To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2009-04-28 16:00:09 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.