You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Himanshu Raina <ra...@yahoo.com> on 2008/01/11 12:37:43 UTC
Restricting access to a folder !!
HI,
Is there a way I can restrict a user from writing or checking in a specific type of file. For example, I have a repository named "Template" under which I have a trunk named Developer. Now I want all users accessing Developer to check-in only *.tpl files denying access to write any other type (.gz, .html, .php, .c ..etc).Can this be done?
regards
Himanshu Raina
---------------------------------
Now you can chat without downloading messenger. Click here to know how.
Re: Restricting access to a folder !!
Posted by Himanshu Raina <ra...@yahoo.com>.
The resultant output is pasted below
[himanshu@himanshu Development]$ pwd
/home/himanshu/Template/Development
[himanshu@himanshu Development]$ svn info
Path: .
URL: file:///usr/local/svn/Template/Development
Repository Root: file:///usr/local/svn/Template
Revision: 1
Node Kind: directory
Schedule: normal
Last Changed Author: himanshu
Last Changed Rev: 1
Last Changed Date: 2008-01-16 09:47:57 +0530 (Wed, 16 Jan 2008)
Repository Path - /usr/local/svn/Template
The hook is available under the path /usr/local/svn/Template/hooks/pre-commit
-rwxr-xr-x 1 himanshu root 358 2008-01-16 09:46 pre-commit
Regards
Himanshu
Ryan Schmidt <su...@ryandesign.com> wrote: On Jan 15, 2008, at 06:55, Himanshu Raina wrote:
> Ryan Schmidt wrote:
>
>> On Jan 15, 2008, at 04:29, Himanshu Raina wrote:
>>
>> > Ryan Schmidt wrote:
>> >
>> >> On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
>> >>
>> >> > Is there a way I can restrict a user from writing or checking
>> in a
>> >> > specific type of file. For example, I have a repository named
>> >> > "Template" under which I have a trunk named Developer. Now I
>> want
>> >> > all users accessing Developer to check-in only *.tpl files
>> denying
>> >> > access to write any other type (.gz, .html, .php, .c ..etc).Can
>> >> > this be done?
>> >>
>> >> Yes, you can write a pre-commit hook to reject commits of non-.tpl
>> >> files.
>> >
>> > Not able to write one of these pre-commit hooks..Any help in this
>> > regard will be appreciated.
>>
>> Here's a script that does this. I assume you can run bash scripts. If
>> not, you'll have to rewrite the script in a language you can run.
>
> Firslty it isn't getting invoked ? Or may be if it is i'm not able
> to track that..Have made the changes with respect to binary
> location but it doesn't work.
>
> In my working copy i.e /home/himanshu/Template/Development when i
> save a file with any extension and commit it to the repository i
> don't get any error...The script is as follows
>
> #!/bin/sh
>
> REPOS="$1"
> TXN="$2"
>
> SVNLOOK=/usr/local/subversion/bin/svnlook
> SED=/bin/sed
> GREP=/bin/grep
>
> $SVNLOOK changed -t "$TXN" "$REPOS" | $SED -n -E 's%^(A.|U.|.U)..
> (Development/.*[^/])$%\2%p' | while read FILE; do
> echo $FILE | $GREP -E '\.tpl$' > /dev/null
> if [ $? -ne 0 ]; then
> echo "Name of file $FILE does not end with .tpl" 1>&2
> exit 1
> fi
> done
>
> exit $?
Can you please go to the directory
/home/himanshu/Template/Development
and type
svn info
and show me what it says?
---------------------------------
Did you know? You can CHAT without downloading messenger. Click here
Re: Restricting access to a folder !!
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 15, 2008, at 06:55, Himanshu Raina wrote:
> Ryan Schmidt wrote:
>
>> On Jan 15, 2008, at 04:29, Himanshu Raina wrote:
>>
>> > Ryan Schmidt wrote:
>> >
>> >> On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
>> >>
>> >> > Is there a way I can restrict a user from writing or checking
>> in a
>> >> > specific type of file. For example, I have a repository named
>> >> > "Template" under which I have a trunk named Developer. Now I
>> want
>> >> > all users accessing Developer to check-in only *.tpl files
>> denying
>> >> > access to write any other type (.gz, .html, .php, .c ..etc).Can
>> >> > this be done?
>> >>
>> >> Yes, you can write a pre-commit hook to reject commits of non-.tpl
>> >> files.
>> >
>> > Not able to write one of these pre-commit hooks..Any help in this
>> > regard will be appreciated.
>>
>> Here's a script that does this. I assume you can run bash scripts. If
>> not, you'll have to rewrite the script in a language you can run.
>
> Firslty it isn't getting invoked ? Or may be if it is i'm not able
> to track that..Have made the changes with respect to binary
> location but it doesn't work.
>
> In my working copy i.e /home/himanshu/Template/Development when i
> save a file with any extension and commit it to the repository i
> don't get any error...The script is as follows
>
> #!/bin/sh
>
> REPOS="$1"
> TXN="$2"
>
> SVNLOOK=/usr/local/subversion/bin/svnlook
> SED=/bin/sed
> GREP=/bin/grep
>
> $SVNLOOK changed -t "$TXN" "$REPOS" | $SED -n -E 's%^(A.|U.|.U)..
> (Development/.*[^/])$%\2%p' | while read FILE; do
> echo $FILE | $GREP -E '\.tpl$' > /dev/null
> if [ $? -ne 0 ]; then
> echo "Name of file $FILE does not end with .tpl" 1>&2
> exit 1
> fi
> done
>
> exit $?
Can you please go to the directory
/home/himanshu/Template/Development
and type
svn info
and show me what it says?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Re: Restricting access to a folder !!
Posted by Himanshu Raina <ra...@yahoo.com>.
Firslty it isn't getting invoked ? Or may be if it is i'm not able to track that..Have made the changes with respect to binary location but it doesn't work.
In my working copy i.e /home/himanshu/Template/Development when i save a file with any extension and commit it to the repository i don't get any error...The script is as follows
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/local/subversion/bin/svnlook
SED=/bin/sed
GREP=/bin/grep
$SVNLOOK changed -t "$TXN" "$REPOS" | $SED -n -E 's%^(A.|U.|.U)..(Development/.*[^/])$%\2%p' | while read FILE; do
echo $FILE | $GREP -E '\.tpl$' > /dev/null
if [ $? -ne 0 ]; then
echo "Name of file $FILE does not end with .tpl" 1>&2
exit 1
fi
done
exit $?
regards
Himanshu Raina
Ryan Schmidt <su...@ryandesign.com> wrote: On Jan 15, 2008, at 04:29, Himanshu Raina wrote:
> Ryan Schmidt wrote:
>
>> On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
>>
>> > Is there a way I can restrict a user from writing or checking in a
>> > specific type of file. For example, I have a repository named
>> > "Template" under which I have a trunk named Developer. Now I want
>> > all users accessing Developer to check-in only *.tpl files denying
>> > access to write any other type (.gz, .html, .php, .c ..etc).Can
>> > this be done?
>>
>> Yes, you can write a pre-commit hook to reject commits of non-.tpl
>> files.
>
> Not able to write one of these pre-commit hooks..Any help in this
> regard will be appreciated.
Here's a script that does this. I assume you can run bash scripts. If
not, you'll have to rewrite the script in a language you can run.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
---------------------------------
Why delete messages? Unlimited storage is just a click away.
Re: Restricting access to a folder !!
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 15, 2008, at 04:29, Himanshu Raina wrote:
> Ryan Schmidt wrote:
>
>> On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
>>
>> > Is there a way I can restrict a user from writing or checking in a
>> > specific type of file. For example, I have a repository named
>> > "Template" under which I have a trunk named Developer. Now I want
>> > all users accessing Developer to check-in only *.tpl files denying
>> > access to write any other type (.gz, .html, .php, .c ..etc).Can
>> > this be done?
>>
>> Yes, you can write a pre-commit hook to reject commits of non-.tpl
>> files.
>
> Not able to write one of these pre-commit hooks..Any help in this
> regard will be appreciated.
Here's a script that does this. I assume you can run bash scripts. If
not, you'll have to rewrite the script in a language you can run.
Re: Restricting access to a folder !!
Posted by Himanshu Raina <ra...@yahoo.com>.
Hi,
Not able to write one of these pre-commit hooks..Any help in this regard will be appreciated.
regards
Himanshu Raina
Ryan Schmidt <su...@ryandesign.com> wrote:
On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
> Is there a way I can restrict a user from writing or checking in a
> specific type of file. For example, I have a repository named
> "Template" under which I have a trunk named Developer. Now I want
> all users accessing Developer to check-in only *.tpl files denying
> access to write any other type (.gz, .html, .php, .c ..etc).Can
> this be done?
Yes, you can write a pre-commit hook to reject commits of non-.tpl
files.
---------------------------------
Get the freedom to save as many mails as you wish. Click here to know how.
Re: Restricting access to a folder !!
Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jan 11, 2008, at 06:37, Himanshu Raina wrote:
> Is there a way I can restrict a user from writing or checking in a
> specific type of file. For example, I have a repository named
> "Template" under which I have a trunk named Developer. Now I want
> all users accessing Developer to check-in only *.tpl files denying
> access to write any other type (.gz, .html, .php, .c ..etc).Can
> this be done?
Yes, you can write a pre-commit hook to reject commits of non-.tpl
files.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org