Finish user and team administration commands
| | |
| | | } |
| | | } |
| | | |
| | | @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 { |
| | | |
| | |
| | | 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()) { |
| | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | @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 { |
| | | |
| | |
| | | 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()) { |
| | |
| | | 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)); |
| | | } |