summaryrefslogtreecommitdiffstats
path: root/eurephiadm
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-12-14 18:57:07 +0100
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-12-14 18:57:07 +0100
commite4ea19989e97fbecd1b22997cadb8fc5f54ade4a (patch)
tree3ce5255121a506c082a3665db23e338093de78fd /eurephiadm
parent6440a3a4592a8c0f0f8fd50cd551b41c1e066efe (diff)
downloadeurephia-e4ea19989e97fbecd1b22997cadb8fc5f54ade4a.tar.gz
eurephia-e4ea19989e97fbecd1b22997cadb8fc5f54ade4a.tar.xz
eurephia-e4ea19989e97fbecd1b22997cadb8fc5f54ade4a.zip
eurephiadm users: Revoke all admin access privileges when deleting a user account
Matthew Gyurgyik noticed that when deleting a user account, the users granted access levels was still present. This resulted in a rather odd looking list when showing granted access levels. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Diffstat (limited to 'eurephiadm')
-rw-r--r--eurephiadm/commands/users.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/eurephiadm/commands/users.c b/eurephiadm/commands/users.c
index 07051ba..7d514ba 100644
--- a/eurephiadm/commands/users.c
+++ b/eurephiadm/commands/users.c
@@ -682,6 +682,7 @@ int account_activation(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *
// No ResultMsg document was returned, which is also wrong.
break;
}
+
// Delete links between certificates associated to this user account
xmlFreeDoc(update_xml);
eurephiaXML_CreateDoc(ctx, 1, "usercerts", &update_xml, &update_n);
@@ -700,10 +701,37 @@ int account_activation(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *
rc = 0;
} else if( res->resultType == exmlERROR ) {
fprintf(stderr, "%s: %s\n", MODULE, res->message);
+ rc = 0;
} else {
fprintf(stdout, "%s: %s\n", MODULE, res->message);
rc = 1;
}
+
+ // Remove all user access levels for the user.
+ {
+ xmlDoc *acclvl_d = NULL, *acclvl_res_xml = NULL;
+ xmlNode *acclvl_n = NULL, *acclvl_fm = NULL;
+ eurephiaRESULT *acclvl_res = NULL;
+
+ eurephiaXML_CreateDoc(ctx, 1, "admin_access", &acclvl_d, &acclvl_n);
+ xmlNewProp(acclvl_n, (xmlChar *) "mode", (xmlChar *) "revoke");
+ acclvl_fm = xmlNewChild(acclvl_n, NULL, (xmlChar *) "fieldMapping", NULL);
+ xmlNewProp(acclvl_fm, (xmlChar *) "table", (xmlChar *) "eurephia_adminaccess");
+ xmlNewChild(acclvl_fm, NULL, (xmlChar *) "uid", (xmlChar *) uid_str);
+
+ acclvl_res_xml = eDBadminAccessLevel(ctx, acclvl_d);
+ acclvl_res = eurephiaXML_ParseResultMsg(ctx, acclvl_res_xml);
+ if( acclvl_res->resultType == exmlERROR ) {
+ fprintf(stderr, "%s: %s\n", MODULE, acclvl_res->message);
+ rc = 0;
+ } else {
+ fprintf(stdout, "%s: %s\n", MODULE, acclvl_res->message);
+ rc = rc ? 1 : 0;
+ }
+ free_nullsafe(ctx, res);
+ xmlFreeDoc(acclvl_res_xml);
+ xmlFreeDoc(acclvl_d);
+ }
free_nullsafe(ctx, res);
xmlFreeDoc(tmp_xml);
break;
@@ -716,7 +744,7 @@ int account_activation(eurephiaCTX *ctx, eurephiaSESSION *sess, eurephiaVALUES *
rc = 0;
} else {
fprintf(stdout, "%s: %s\n", MODULE, res->message);
- rc = 1;
+ rc = rc ? 1 : 0;
}
free_nullsafe(ctx, res);
} else {