diff options
Diffstat (limited to 'database/sqlite/administration.c')
-rw-r--r-- | database/sqlite/administration.c | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/database/sqlite/administration.c b/database/sqlite/administration.c index 73a3bdc..04dbe6e 100644 --- a/database/sqlite/administration.c +++ b/database/sqlite/administration.c @@ -63,9 +63,6 @@ #include "sqlite.h" -#define FMAP_ADMINACCESS /**< fieldmapping.h: Include declaration of tbl_sqlite_eurephiaadmacc */ -#include "fieldmapping.h" - #if (DRIVERAPIVERSION > 1) || defined(DOXYGEN) /* * API Version 2 functions @@ -384,65 +381,4 @@ int eDBadminLogout(eurephiaCTX *ctx, const char *sessionkey) { return 1; } - - -/** - * @copydoc eDBadminEditAdminAccess() - */ -int eDBadminEditAdminAccess(eurephiaCTX *ctx, xmlDoc *grant_xml) { - dbresult *res = NULL; - xmlNode *grant_n = NULL, *fmap_n = NULL; - eDBfieldMap *grant_m = NULL; - char *mode = NULL; - int rc = 0; - - DEBUG(ctx, 20, "Function call: eDBadminEditAdminAccess(ctx, xmlDoc)"); - assert( (ctx != NULL) && (grant_xml != NULL) ); - - if( (ctx->context_type != ECTX_ADMIN_CONSOLE) && (ctx->context_type != ECTX_ADMIN_WEB) ) { - eurephia_log(ctx, LOG_CRITICAL, 0, - "eurephia admin function call attempted with wrong context type"); - return 0; - } - - grant_n = eurephiaXML_getRoot(ctx, grant_xml, "edit_admin_access", 1); - if( grant_n == NULL ) { - eurephia_log(ctx, LOG_ERROR, 0, "Could not find a valid XML for the user-certs link request"); - return 0; - } - mode = xmlGetAttrValue(grant_n->properties, "mode"); - if( mode == NULL ) { - eurephia_log(ctx, LOG_ERROR, 0, "Invalid edit admin access request (1)."); - return 0; - } - - fmap_n = xmlFindNode(grant_n, "fieldMapping"); - if( fmap_n == NULL ) { - eurephia_log(ctx, LOG_ERROR, 0, "Invalid edit admin access request (2)."); - return 0; - } - - grant_m = eDBxmlMapping(ctx, tbl_sqlite_eurephiaadmacc, NULL, fmap_n); - assert(grant_m != NULL); - - if( strcmp(mode, "grant") == 0 ) { - res = sqlite_query_mapped(ctx, SQL_INSERT, "INSERT INTO eurephia_adminaccess", - grant_m, NULL, NULL); - rc = res->last_insert_id; - } else if( strcmp(mode, "revoke") == 0 ) { - res = sqlite_query_mapped(ctx, SQL_DELETE, "DELETE FROM eurephia_adminaccess", - NULL, grant_m, NULL); - rc = 1; - } - - if( res == NULL ) { - eurephia_log(ctx, LOG_ERROR, 0, "Failed to update admin access"); - rc = -1; - } else { - sqlite_free_results(res); - } - eDBfreeMapping(grant_m); - - return rc; -} #endif |