From: František Dvořák Date: Sat, 19 Oct 2013 20:17:56 +0000 (+0200) Subject: Creating users/groups in idm client. X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=3634bbfdd700c158199ebe9c27c6474fb8f35c7c;p=dmlite-clients.git Creating users/groups in idm client. --- diff --git a/idm.cpp b/idm.cpp index 8aa885b..e6bc3ef 100644 --- a/idm.cpp +++ b/idm.cpp @@ -25,6 +25,8 @@ static void usage(const char *prg) { printf("COMMANDS are:\n"); printf(" listusers,lu ....................... list users\n"); printf(" listgroups,lg ...................... list groups\n"); + printf(" newuser,nu USER .................... create new user\n"); + printf(" newgroup,ng GROUP .................. create new group\n"); printf(" deleteuser,du USER ................. delete user\n"); printf(" deletegroup,dg GROUP ............... delete group\n"); printf(" updateuser,uu USER FIELD[,...] ..... update user\n"); @@ -183,6 +185,24 @@ int main(int argc, char *argv[]) { dumpInfo(gids[i].name, gids[i]); printf("\n"); } else if ( + strcasecmp(argv[optind], "newuser") == 0 || + strcasecmp(argv[optind], "nu") == 0 + ) { + operation = "create user"; + if (!getArgument(argc, argv, &arg)) return 1; + + authn->newUser(arg); + printf("User '%s' created.\n\n", arg.c_str()); + } else if ( + strcasecmp(argv[optind], "newgroup") == 0 || + strcasecmp(argv[optind], "ng") == 0 + ) { + operation = "create group"; + if (!getArgument(argc, argv, &arg)) return 1; + + authn->newGroup(arg); + printf("Group '%s' created.\n\n", arg.c_str()); + } else if ( strcasecmp(argv[optind], "deleteuser") == 0 || strcasecmp(argv[optind], "du") == 0 ) {