Skip to content

Commit

Permalink
writable: 'status' subcommand changes...
Browse files Browse the repository at this point in the history
-   allow users with RW to use it
-   fix bug where, when a repo's writable status is checked, the global status
    was not checked

Thanks to Michel Bourget for discussion and ideas.
  • Loading branch information
sitaramc committed Jan 25, 2015
1 parent 1c61d57 commit e79f335
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/commands/writable
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ my $op = shift; # on|off|status
if ( $repo eq '@all' ) {
_die "you are not authorized" if $ENV{GL_USER} and not is_admin();
} else {
_die "you are not authorized" if $ENV{GL_USER} and not( owns($repo) or is_admin() );
_die "you are not authorized" if $ENV{GL_USER} and not( owns($repo) or is_admin() or ( can_write($repo) and $op eq 'status' ) );
}

my $msg = join( " ", @ARGV );
Expand All @@ -46,13 +46,15 @@ if ( $repo eq '@all' ) {
target( $ENV{HOME} );
} else {
target("$rb/$repo.git");
target( $ENV{HOME} ) if $op eq 'status';
}

exit 0;

sub target {
my $repodir = shift;
if ( $op eq 'status' ) {
exit 1 if -e "$repodir/$sf";
exit 0;
} elsif ( $op eq 'on' ) {
unlink "$repodir/$sf";
} elsif ( $op eq 'off' ) {
Expand Down

0 comments on commit e79f335

Please sign in to comment.