[pkg-perl-tools] 01/01: dpt-salsa: add changeuser method (changes access level)

gregor herrmann gregoa at debian.org
Sun Jan 28 18:11:10 UTC 2018


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository pkg-perl-tools.

commit cbf73c8359650ddb9859d3116b377e6038bcf14a
Author: gregor herrmann <gregoa at debian.org>
Date:   Sun Jan 28 19:10:34 2018 +0100

    dpt-salsa: add changeuser method (changes access level)
    
    Gbp-Dch: Ignore
---
 scripts/salsa | 41 +++++++++++++++++++++++++++++++++++++++++
 t/spelling.st |  1 +
 2 files changed, 42 insertions(+)

diff --git a/scripts/salsa b/scripts/salsa
index 5fb5517..ca2b85d 100755
--- a/scripts/salsa
+++ b/scripts/salsa
@@ -91,6 +91,8 @@ if ( $command eq 'version' ) {
     or $command eq 'deluser' )
 {
     removeuser();
+} elsif ( $command eq 'changeuser' ) {
+    changeuser();
 } elsif ( $command eq 'listmembers'
     or $command eq 'listmember'
     or $command eq 'lsmembers'
@@ -157,6 +159,23 @@ sub adduser {
         { user_id => $user_id, access_level => $access_level } );
 }
 
+## changeuser()
+sub changeuser {
+    my ( $user, $level ) = @args;
+    die 'Required parameter username|userid missing.' unless $user;
+    die 'Required parameter "access level" missing.'  unless $level;
+
+    my $user_id = user2userid($user);
+
+    my $access_level = $levels_name{ lc($level) };
+    die "Unknown access level '$level'." unless $access_level;
+
+    $api->update_group_member(
+        $config{perl_team_modules_id},
+        $user_id, { access_level => $access_level },
+    );
+}
+
 ## removeuser()
 sub removeuser {
     my ($user) = @args;
@@ -452,6 +471,28 @@ Required.
 
 =back
 
+=head3 I<changeuser> I<username|userid> I<access_level>
+
+Change the access level of a user in the I<modules> subgroup of the
+I<perl-team> group.
+
+Parameters:
+
+=over
+
+=item username|userid
+
+The user whose access level is to be changed. Either their id (\d+) or their
+username (\w+).
+Required.
+
+=item access_level
+
+One of I<GitLab>'s access levels: guest, reporter, developer, master, owner.
+Required.
+
+=back
+
 =head3 I<listmembers>
 
 Show all members of the I<modules> subgroup of the I<perl-team> group.
diff --git a/t/spelling.st b/t/spelling.st
index 69b9553..aa024fd 100644
--- a/t/spelling.st
+++ b/t/spelling.st
@@ -54,6 +54,7 @@ anonscm
 bts
 bzip
 changerepo
+changeuser
 conf
 configurerepo
 createrepo

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/pkg-perl-tools.git



More information about the Pkg-perl-cvs-commits mailing list