Functions for user account management. More...
#include <string.h>#include <unistd.h>#include <assert.h>#include <libxml/tree.h>#include <sqlite3.h>#include <eurephia_nullsafe.h>#include <eurephia_context.h>#include <eurephia_log.h>#include <eurephia_xml.h>#include <eurephia_values.h>#include <eurephiadb_session_struct.h>#include <eurephiadb_mapping.h>#include <passwd.h>#include <eurephiadb_driver.h>#include "../sqlite.h"#include "../fieldmapping.h"
Include dependency graph for useraccount.c:Go to the source code of this file.
Defines | |
| #define | FMAP_USERS |
| #define | FMAP_ADMINACCESS |
Functions | |
| static int | xml_set_flag (xmlNode *node, char *flagname, int flagged) |
| static xmlDoc * | useracc_view (eurephiaCTX *ctx, unsigned int infoType, eDBfieldMap *uinfo_map, const char *sortkeys) |
| static xmlDoc * | useracc_add (eurephiaCTX *ctx, eDBfieldMap *usrinf_map) |
| static xmlDoc * | useracc_update (eurephiaCTX *ctx, const int uid, eDBfieldMap *value_map) |
| static xmlDoc * | useracc_delete (eurephiaCTX *ctx, const unsigned int uid) |
| xmlDoc * | eDBadminUserAccount (eurephiaCTX *ctx, xmlDoc *qryxml) |
| xmlDoc * | adminacclvl_Get (eurephiaCTX *ctx, eDBfieldMap *fmap) |
| xmlDoc * | eDBadminAccessLevel (eurephiaCTX *ctx, xmlDoc *qryxml) |
Functions for user account management.
Definition in file useraccount.c.
| #define FMAP_ADMINACCESS |
fieldmapping.h: Include declaration of tbl_sqlite_eurephiaadmacc
Definition at line 56 of file useraccount.c.
| #define FMAP_USERS |
fieldmapping.h: Include declaration of tbl_sqlite_users
Definition at line 55 of file useraccount.c.
| xmlDoc* adminacclvl_Get | ( | eurephiaCTX * | ctx, | |
| eDBfieldMap * | fmap | |||
| ) |
Internal function. Retrieves all administrator access levels granted.
| ctx | eurephiaCTX | |
| fmap | eDBfieldMap with field values to narrow the SQL query |
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
Definition at line 587 of file useraccount.c.
Here is the call graph for this function:
Here is the caller graph for this function:| xmlDoc* eDBadminAccessLevel | ( | eurephiaCTX * | ctx, | |
| xmlDoc * | qryxml | |||
| ) |
List, grant or revoke access to the administration utilities
| ctx | eurephiaCTX | |
| qryxml | XML document with the operation and information. |
XML format skeleton for grant_xml
<eurephia format="1"> <admin_access mode="{list|grant|revoke}"> <fieldMapping table="eurephia_adminaccess"> <uid>{user id}</uid> <interface>{C|W}</uid> <accesslevel>{access level string}</accesslevel> </fieldMapping> </admin_access> </eurephia>
To grant or revoke access, all fields are needed. For list mode, any given fields will narrow the database query. If no fields are given to list mode, all registered records will be returned. The interface tag can have two valid values, C for console interface and W for web interface.
XML format used for list mode:
<eurephia format="1"> <admin_access_list> <user_access> <username uid="{uid}">{username}</username> <access_levels> <access interface="{interface}">{access level string}</access> ... (more access tags) ... </access_levels> </user_access> ... (another user_access tag) </admin_access_list> </eurephia>
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
Definition at line 639 of file useraccount.c.
Here is the call graph for this function:| xmlDoc* eDBadminUserAccount | ( | eurephiaCTX * | ctx, | |
| xmlDoc * | qryxml | |||
| ) |
Function for view, add, update or delete user accounts
| ctx | eurephiaCTX | |
| qryxml | XML document with information about the operation |
<eurephia format="1"> <UserAccount mode="{view|add|update|delete}" [uid="{uid}"]> <fieldMapping table="users"> <{field name}>{field value}</{field name}> ... <{field name}>{field value}</{field name}> </fieldMapping> [<sortkeys>{field name}[, {field name}...]</sortkeys>] [<extractFlags>{extract value (int)}</extractFlags>] </UserAccount> </eurephia>
Valid field names are: uid, username, password, activated, deactivated, lastaccess
If no field names and values are given in "view" mode, all user accounts will be returned. Adding field name tags will narrow down the query.
For "add" mode, username and password tag is required. For the password tag, the attribute "pwhash" can be given to indicate what kind of hashing the value provided is using. If this is not set, the password value is expected to come in clear text and will be hashed automatically with a SHA512 algorithm.
For the "update" mode, the uid attribute in the UserAccount tag is required. This will be the key for which record to update. The values being updated need to be set in the fieldMapping tags.
For "delete" mode, the "uid" attribute in the UserAccount tag is required. This mode will also ignore any fieldMapping tags.
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
Definition at line 510 of file useraccount.c.
Here is the call graph for this function:| static xmlDoc* useracc_add | ( | eurephiaCTX * | ctx, | |
| eDBfieldMap * | usrinf_map | |||
| ) | [static] |
Internal function. Creates a new user account in the database.
| ctx | eurephiaCTX | |
| usrinf_map | eDBfieldMap containing information needed for the new user account |
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_FATAL
< Operation failed and cannot continue. Log level always < 2
< Informational messages. Log level should be < 5
Definition at line 368 of file useraccount.c.
Here is the call graph for this function:
Here is the caller graph for this function:| static xmlDoc* useracc_delete | ( | eurephiaCTX * | ctx, | |
| const unsigned int | uid | |||
| ) | [static] |
Internal function. Deletes a user account from the users table
| ctx | eurephiaCTX | |
| uid | Numeric user id of user to be deleted. |
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_FATAL
< Operation failed and cannot continue. Log level always < 2
Definition at line 476 of file useraccount.c.
Here is the call graph for this function:
Here is the caller graph for this function:| static xmlDoc* useracc_update | ( | eurephiaCTX * | ctx, | |
| const int | uid, | |||
| eDBfieldMap * | value_map | |||
| ) | [static] |
Internal function. Updates a user account
| ctx | eurephiaCTX | |
| uid | Numeric user id to be updated | |
| value_map | eDBfieldMap containing new values |
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
Definition at line 420 of file useraccount.c.
Here is the call graph for this function:
Here is the caller graph for this function:| static xmlDoc* useracc_view | ( | eurephiaCTX * | ctx, | |
| unsigned int | infoType, | |||
| eDBfieldMap * | uinfo_map, | |||
| const char * | sortkeys | |||
| ) | [static] |
Internal function. Retrieves information about user accounts
| ctx | eurephiaCTX | |
| infoType | Flags defining which information to be included in the result | |
| uinfo_map | eDBfieldMap containing information needed for the new user account | |
| sortkeys | String containing list of fields defining data sorting |
< Messages intended when debugging. Only for log level > 10
< The context is used via the eurephiadm console utility
< The context is used via a web based utility
< Alias for LOG_CRITICAL
< Operation failed and might have been aborted. Log level always 0
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< flag for extracting user account information
< flag for extracting certificate information
< flag for extracting lastlog information
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< flag for extracting information from attempts log
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
< flag for extracting information from blacklist log
< Alias for LOG_ERROR, in case it is not defined
< API errors but not sever, program can continue to run
Definition at line 88 of file useraccount.c.
Here is the call graph for this function:
Here is the caller graph for this function:| static int xml_set_flag | ( | xmlNode * | node, | |
| char * | flagname, | |||
| int | flagged | |||
| ) | [inline, static] |
Internal function. Adds a child node named <flag> to an xmlNode containing a flag value
| node | xmlNode pointer where to add the new flag | |
| flagname | String containing a name of the flag | |
| flagged | Is the flag set or not. The tag will only be added if the flag is set |
flagged value Definition at line 69 of file useraccount.c.
Here is the caller graph for this function:
1.7.1