summaryrefslogtreecommitdiff
path: root/pinyadmin/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'pinyadmin/sbin')
-rwxr-xr-xpinyadmin/sbin/addaccess2
-rwxr-xr-xpinyadmin/sbin/pinyconfig15
-rwxr-xr-xpinyadmin/sbin/rmaccess2
3 files changed, 15 insertions, 4 deletions
diff --git a/pinyadmin/sbin/addaccess b/pinyadmin/sbin/addaccess
index e351114..557ed15 100755
--- a/pinyadmin/sbin/addaccess
+++ b/pinyadmin/sbin/addaccess
@@ -11,7 +11,7 @@ my ( $reponame, @users ) = @ARGV;
my $repo = Piny::Repo->new( $reponame );
-if ( $repo->owner->uid != $env->user->uid ) {
+if ( $env->user->uid != 0 and $repo->owner->uid != $env->user->uid ) {
print "You are not the owner of that repo!\n";
exit( 3 );
};
diff --git a/pinyadmin/sbin/pinyconfig b/pinyadmin/sbin/pinyconfig
index 345e53f..039d6b4 100755
--- a/pinyadmin/sbin/pinyconfig
+++ b/pinyadmin/sbin/pinyconfig
@@ -11,12 +11,15 @@ if ( not defined $reponame ) {
die "Usage: $0 reponame|--user [tweakable [value]]\n";
};
+my $repo;
my $config;
+my $env = Piny::Environment->instance( );
if ( $reponame eq "--user" ) {
- $config = Piny::Environment->instance->user->config;
+ $config = $env->user->config;
} else {
- $config = Piny::Repo->new( $reponame )->config;
+ $repo = Piny::Repo->new( $reponame );
+ $config = $repo->config;
};
if ( not defined $attr ) {
@@ -38,15 +41,22 @@ if ( not defined $attr ) {
$attr =~ s/\./_/g;
if ( defined $value ) {
+ unless ( $env->user->uid == 0 or $reponame eq "--user" or $repo->owner->uid == $env->user->uid ) {
+ print "You are not the owner of that repo!\n";
+ exit( 3 );
+ };
+
undef $@;
eval {
$config->$attr( $value );
};
if ( $@ ) {
print STDERR "$attr is not a legal tweakable, or $value is not a legal value for that tweakable.\n$@\n";
+ exit( 4 );
};
if ( $value ne $config->$attr ) {
print STDERR "Failed to set $attr (perhaps an override is in place)\n";
+ exit( 5 );
};
};
@@ -56,6 +66,7 @@ if ( not defined $attr ) {
};
if ( $@ ) {
print STDERR "$attr is not a legal tweakable, or its current value is illegal.\n$@\n";
+ exit( 6 );
};
};
diff --git a/pinyadmin/sbin/rmaccess b/pinyadmin/sbin/rmaccess
index d6c22a9..79fe334 100755
--- a/pinyadmin/sbin/rmaccess
+++ b/pinyadmin/sbin/rmaccess
@@ -11,7 +11,7 @@ my ( $reponame, @users ) = @ARGV;
my $repo = Piny::Repo->new( $reponame );
-if ( $repo->owner->uid != $env->user->uid ) {
+if ( $env->user->uid != 0 and $repo->owner->uid != $env->user->uid ) {
print "You are not the owner of that repo!\n";
exit( 3 );
};