Subversion Repositories DevTools

Rev

Rev 1291 | Rev 4918 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1291 Rev 4226
Line -... Line 1...
-
 
1
REM Maintained in package SubversionServerSupport
-
 
2
REM
-
 
3
REM Limit the property chnages that a user can make to:
-
 
4
REM     svn:log (commit comment)
-
 
5
REM     Made by themselves only
-
 
6
REM     On the same day    
-
 
7
REM
-
 
8
REM Args %1 - Repo Path
-
 
9
REM      %2 - Rev to be changed
-
 
10
REM      %3 - Authenticated user name
-
 
11
REM      %4 - Name of property to be changed
-
 
12
REM      %5 - Change Type. A,D or M
-
 
13
 
-
 
14
REM     These users can do anything
1
if %3==dpurdie goto OK
15
if %3==xdpurdie goto OK
2
if %3==buildadm goto OK
16
if %3==buildadm goto OK
-
 
17
 
-
 
18
REM
-
 
19
REM     The rest of this code allows a user to modify his own svn:log (comment) created
-
 
20
REM     today. The date test is brute force.
-
 
21
 
-
 
22
REM     Allow log comments to be modified
-
 
23
if NOT %4==svn:log goto BAD
-
 
24
if NOT %5==M goto BAD
-
 
25
 
-
 
26
set SVNLOOK="C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe"
-
 
27
 
-
 
28
REM     User can only modify his own comments
-
 
29
set muser=error
-
 
30
for /f "delims=" %%a in ('%SVNLOOK%  author -r %2 %1 ') do @set muser=%%a
-
 
31
if NOT %muser%==%3 goto BADUSER
-
 
32
 
-
 
33
REM     User can only modify comments made on the same day
-
 
34
set datestamp=error
-
 
35
set today=error
-
 
36
 
-
 
37
for /f "delims=" %%a in ('%SVNLOOK%  date -r %2 %1 ') do @set datestamp=%%a
-
 
38
set datestamp=%datestamp:~0,10%
-
 
39
 
-
 
40
for /F "tokens=1-4 delims=/ " %%a in ("%date%") do (
-
 
41
 set YEAR=%%d
-
 
42
 set MONTH=%%c
-
 
43
 set DAY=%%b )
-
 
44
set today=%YEAR%-%MONTH%-%DAY%
-
 
45
if NOT %today%==%datestamp% goto BADDAY
-
 
46
 
-
 
47
REM     User is allowed to modify comment
-
 
48
goto OK
-
 
49
 
-
 
50
:BADDAY
-
 
51
echo User %3 is only allowed to modify svn:log created on the same day >&2
-
 
52
echo Info. Change User: %muser%. Change Date: %datestamp%. Today: %today%. %date% >&2
-
 
53
exit 1
-
 
54
 
-
 
55
:BADUSER
-
 
56
echo User %3 is not allowed to modify svn:log created by another user (%muser%) on %1 >&2
-
 
57
exit 1
-
 
58
 
-
 
59
:BAD
3
echo User %3 is not allowed to modify repository properties on %1 >&2
60
echo User %3 is not allowed to modify repository properties %4(%5) on %1 >&2
4
exit 1
61
exit 1
5
 
62
 
6
:OK
63
:OK
7
exit 0
64
exit 0