summaryrefslogtreecommitdiffstats
path: root/eurephiadm
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2008-12-06 21:36:12 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2008-12-06 21:36:12 +0100
commit2d9f3b0687431e8b75ee37641e25987edf3f6cdc (patch)
tree0d237f083641a3b9d4f1205d5f6393a09ed0d0ff /eurephiadm
parentd919ea0f5d4d8e6241beaf936d598f4ee2e0adb0 (diff)
downloadeurephia-2d9f3b0687431e8b75ee37641e25987edf3f6cdc.tar.gz
eurephia-2d9f3b0687431e8b75ee37641e25987edf3f6cdc.tar.xz
eurephia-2d9f3b0687431e8b75ee37641e25987edf3f6cdc.zip
users command: Added forgotten mode (show account details)
Diffstat (limited to 'eurephiadm')
-rw-r--r--eurephiadm/commands/users.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/eurephiadm/commands/users.c b/eurephiadm/commands/users.c
index bb9ef76..6fa842d 100644
--- a/eurephiadm/commands/users.c
+++ b/eurephiadm/commands/users.c
@@ -46,6 +46,13 @@ void display_users_help(int page) {
"Available sort keys are: id, username, activated, deactivated and lastaccess\n\n");
break;
+ case 's':
+ printf("The show mode shows more information about a user account.\n"
+ "The needed arguments are one of the following arguments:\n\n"
+ " -i | --uid Numeric user ID\n"
+ " -n | --username User name\n\n");
+ break;
+
case 'a':
printf("The activate mode activates an account which not activated or deactivated.\n"
"The needed arguments are one of the following arguments:\n\n"
@@ -75,6 +82,7 @@ void display_users_help(int page) {
default:
printf("Available modes:\n"
" -l | --list List all user accounts\n"
+ " -s | --show Show user account details\n"
" -a | --activate Activate a user account\n"
" -d | --deactivate Deactivate a user account\n"
" -A | --add Add a new user account\n"
@@ -163,8 +171,8 @@ int list_users(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
}
-// This function handles both activation and deactivation of an account
-int activate_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) {
+// This function handles showing info, activation and deactivation of an account
+int useraccount(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int argc, char **argv) {
char *uname = NULL;
int i, uid = 0, actmode = 0;
@@ -177,7 +185,13 @@ int activate_user(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg,
assert((ctx != NULL) && (ctx->dbc != NULL) && (ctx->dbc->config != NULL));
- actmode = ((strcmp(argv[0], "--activate") == 0) || (strcmp(argv[0], "-a") == 0)) ? 'a' : 'd';
+ if( (strcmp(argv[0], "--activate") == 0) || (strcmp(argv[0], "-a") == 0) ) {
+ actmode = 'a';
+ } else if( (strcmp(argv[0], "--deactivate") == 0) || (strcmp(argv[0], "-d") == 0) ) {
+ actmode = 'd';
+ } else if( (strcmp(argv[0], "--show") == 0) || (strcmp(argv[0], "-s") == 0) ) {
+ actmode = 's';
+ }
for( i = 1; i < argc; i++ ) {
switch( eurephia_getopt(&i, argc, argv, activargs) ) {
@@ -231,6 +245,7 @@ int cmd_Users(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
e_options modeargs[] = {
{"--list", "-l", 0},
+ {"--show", "-s", 0},
{"--activate", "-a", 0},
{"--deactivate", "-d", 0},
{"--add", "-A", 0},
@@ -248,12 +263,16 @@ int cmd_Users(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *cfg, int
mode_fnc = list_users;
break;
+ case 's':
+ mode_fnc = useraccount;
+ break;
+
case 'a':
- mode_fnc = activate_user;
+ mode_fnc = useraccount;
break;
case 'd':
- mode_fnc = activate_user;
+ mode_fnc = useraccount;
break;
case 'h':