]> source.dussan.org Git - gitblit.git/commitdiff
Finish user and team administration commands
authorJames Moger <james.moger@gitblit.com>
Fri, 28 Mar 2014 15:39:23 +0000 (11:39 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 10 Apr 2014 23:00:52 +0000 (19:00 -0400)
src/main/java/com/gitblit/transport/ssh/gitblit/TeamsDispatcher.java
src/main/java/com/gitblit/transport/ssh/gitblit/UsersDispatcher.java

index 710ec4eb35b2d2c90c5fb1a11bae258e19687d20..d0ec58f00fc8d30d7f91bbd9b15168969e222dd2 100644 (file)
@@ -72,7 +72,7 @@ public class TeamsDispatcher extends DispatchCommand {
                }
        }
 
-       @CommandMetaData(name = "new", description = "Create a new team")
+       @CommandMetaData(name = "new", aliases = { "add" }, description = "Create a new team")
        @UsageExample(syntax = "${cmd} contributors --canFork --canCreate")
        public static class NewTeam extends TeamCommand {
 
@@ -148,7 +148,7 @@ public class TeamsDispatcher extends DispatchCommand {
                protected List<String> fieldValues = new ArrayList<String>();
 
                protected enum Field {
-                       mailingList, canAdmin, canFork, canCreate;
+                       mailingList, preReceive, postReceive, canAdmin, canFork, canCreate;
 
                        static Field fromString(String name) {
                                for (Field field : values()) {
@@ -185,6 +185,14 @@ public class TeamsDispatcher extends DispatchCommand {
                                team.mailingLists.clear();
                                team.mailingLists.addAll(fieldValues);
                                break;
+                       case preReceive:
+                               team.preReceiveScripts.clear();
+                               team.preReceiveScripts.addAll(fieldValues);
+                               break;
+                       case postReceive:
+                               team.postReceiveScripts.clear();
+                               team.postReceiveScripts.addAll(fieldValues);
+                               break;
                        case canAdmin:
                                team.canAdmin = toBool(value);
                                break;
index 4f604a2fca26589172a91347ea3a0e7c4b383d51..1a6dee4652c39604585b3fd2bee724ba2e33a3b9 100644 (file)
@@ -74,7 +74,7 @@ public class UsersDispatcher extends DispatchCommand {
                }
        }
 
-       @CommandMetaData(name = "new", description = "Create a new user account")
+       @CommandMetaData(name = "new", aliases = { "add" }, description = "Create a new user account")
        @UsageExample(syntax = "${cmd} john 12345 --email john@smith.com --canFork --canCreate")
        public static class NewUser extends UserCommand {
 
@@ -165,7 +165,7 @@ public class UsersDispatcher extends DispatchCommand {
                protected List<String> fieldValues = new ArrayList<String>();
 
                protected enum Field {
-                       name, displayName, email, password, canAdmin, canFork, canCreate;
+                       name, displayName, email, password, canAdmin, canFork, canCreate, disabled;
 
                        static Field fromString(String name) {
                                for (Field field : values()) {
@@ -253,6 +253,9 @@ public class UsersDispatcher extends DispatchCommand {
                        case canCreate:
                                user.canCreate = toBool(value);
                                break;
+                       case disabled:
+                               user.disabled = toBool(value);
+                               break;
                        default:
                                throw new UnloggedFailure(1,  String.format("Field %s was not properly handled by the set command.", fieldName));
                        }