diff options
author | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-14 18:57:07 +0100 |
---|---|---|
committer | David Sommerseth <dazo@users.sourceforge.net> | 2010-12-14 18:57:07 +0100 |
commit | e4ea19989e97fbecd1b22997cadb8fc5f54ade4a (patch) | |
tree | 3ce5255121a506c082a3665db23e338093de78fd /database | |
parent | 6440a3a4592a8c0f0f8fd50cd551b41c1e066efe (diff) | |
download | eurephia-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 'database')
-rw-r--r-- | database/sqlite/administration/useraccount.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/database/sqlite/administration/useraccount.c b/database/sqlite/administration/useraccount.c index 0571d98..a936294 100644 --- a/database/sqlite/administration/useraccount.c +++ b/database/sqlite/administration/useraccount.c @@ -686,12 +686,20 @@ xmlDoc *eDBadminAccessLevel(eurephiaCTX *ctx, xmlDoc *qryxml) { sqlres = sqlite_query_mapped(ctx, SQL_DELETE, "DELETE FROM eurephia_adminaccess", NULL, fmap_m, NULL); if( sqlres && (sqlite_get_affected_rows(sqlres) > 0) ) { - res_d = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, - "Access level %s (%s) was revoked from uid %s", - eDBmappingGetValue(fmap_m, FIELD_ACCESSLVL), - eDBmappingGetValue(fmap_m, FIELD_INTERFACE), - eDBmappingGetValue(fmap_m, FIELD_UID)); - } + const char *uid = eDBmappingGetValue(fmap_m, FIELD_UID); + const char *acclvl = eDBmappingGetValue(fmap_m, FIELD_ACCESSLVL); + + if( acclvl != NULL ) { + res_d = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, + "Access level %s (%s) was revoked from uid %s", + acclvl, eDBmappingGetValue(fmap_m, FIELD_ACCESSLVL), + uid); + } else { + res_d = eurephiaXML_ResultMsg(ctx, exmlRESULT, NULL, + "%i access levels was removed from uid %s", + sqlite_get_affected_rows(sqlres), uid); + } + } } else if( strcmp(mode, "list") == 0 ) { res_d = adminacclvl_Get(ctx, fmap_m); } |