summaryrefslogtreecommitdiffstats
path: root/database
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-25 13:23:57 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-25 13:23:57 +0200
commite02152930f53d69c9ef1a4bb3dc5e8dacc961062 (patch)
tree43774f07b7f7f607ec2d283925ef822f7cd457ee /database
parentf1ad96ffe75beb6e7441d4a23a0f29e4e7f2e05a (diff)
downloadeurephia-e02152930f53d69c9ef1a4bb3dc5e8dacc961062.tar.gz
eurephia-e02152930f53d69c9ef1a4bb3dc5e8dacc961062.tar.xz
eurephia-e02152930f53d69c9ef1a4bb3dc5e8dacc961062.zip
Made the sortkeys work in eDBadminUserAccount() view mode
Diffstat (limited to 'database')
-rw-r--r--database/sqlite/administration/useraccount.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/database/sqlite/administration/useraccount.c b/database/sqlite/administration/useraccount.c
index 574e196..ac4634c 100644
--- a/database/sqlite/administration/useraccount.c
+++ b/database/sqlite/administration/useraccount.c
@@ -107,21 +107,22 @@ static xmlDoc *useracc_view(eurephiaCTX *ctx, unsigned int infoType,
// Query the database, find the user defined in the user map
uinf = sqlite_query_mapped(ctx, SQL_SELECT,
- "SELECT u.username, u.activated, u.deactivated, u.last_accessed, u.uid,"
+ "SELECT users.username, users.activated, users.deactivated,"
+ " users.last_accessed, users.uid,"
" (bl.username IS NOT NULL), opensess, logincount,"
" (at.attempts > 0)"
- " FROM openvpn_users u"
+ " FROM openvpn_users users"
" LEFT JOIN openvpn_blacklist bl USING(username)"
- " LEFT JOIN openvpn_attempts at ON(at.username = u.username)"
+ " LEFT JOIN openvpn_attempts at ON(at.username = users.username)"
" LEFT JOIN (SELECT uid, count(*) AS logincount "
" FROM openvpn_lastlog"
" GROUP BY uid) lc"
- " ON (lc.uid = u.uid)"
+ " ON (lc.uid = users.uid)"
" LEFT JOIN (SELECT uid, count(*) > 0 AS opensess"
" FROM openvpn_lastlog"
" WHERE sessionstatus = 2"
" GROUP BY uid) os"
- " ON (os.uid = u.uid)",
+ " ON (os.uid = users.uid)",
NULL, uinfo_map, sortkeys);
if( uinf == NULL ) {
@@ -533,7 +534,7 @@ xmlDoc *eDBadminUserAccount(eurephiaCTX *ctx, xmlDoc *qryxml) {
eurephia_log(ctx, LOG_ERROR, 0, "Invalid user account request (2).");
return NULL;
}
- fmap_m = eDBxmlMapping(ctx, tbl_sqlite_users, NULL, fmap_n);
+ fmap_m = eDBxmlMapping(ctx, tbl_sqlite_users, "users", fmap_n);
assert(fmap_m != NULL);
// Extract the value of the uid attribute in the UserAccount tag. If not found, set value to -1.
@@ -542,7 +543,7 @@ xmlDoc *eDBadminUserAccount(eurephiaCTX *ctx, xmlDoc *qryxml) {
if( strcmp(mode, "view") == 0 ) {
unsigned int flags = atoi_nullsafe(defaultValue(xmlGetNodeContent(qry_n,"extractFlags"),"0"));
const char *sortkeys = xmlGetNodeContent(qry_n, "sortkeys");
- res_d = useracc_view(ctx, flags, fmap_m, sortkeys);
+ res_d = useracc_view(ctx, flags, fmap_m, eDBmkSortKeyString(fmap_m, sortkeys));
} else if( strcmp(mode, "add") == 0 ) {
res_d = useracc_add(ctx, fmap_m);
} else if( strcmp(mode, "update") == 0 ) {