MXS-1354: Add user account types to REST API
The user accounts can now be created with a specific account type. This allows read-only users to be created for the REST API.
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
#include <maxscale/dcb.h>
|
||||
#include <maxscale/users.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
@ -73,13 +74,11 @@ typedef struct admin_session
|
||||
|
||||
void admin_users_init();
|
||||
|
||||
const char* admin_enable_linux_account(const char *uname);
|
||||
const char *admin_enable_linux_admin_account(const char *uname);
|
||||
const char* admin_enable_linux_account(const char *uname, enum account_type type);
|
||||
const char* admin_disable_linux_account(const char *uname);
|
||||
bool admin_linux_account_enabled(const char *uname);
|
||||
|
||||
const char* admin_add_inet_user(const char *uname, const char *password);
|
||||
const char *admin_add_inet_admin_user(const char *uname, const char* password);
|
||||
const char* admin_add_inet_user(const char *uname, const char *password, enum account_type type);
|
||||
const char* admin_remove_inet_user(const char* uname);
|
||||
bool admin_inet_user_exists(const char *uname);
|
||||
bool admin_verify_inet_user(const char *uname, const char *password);
|
||||
|
@ -65,8 +65,9 @@ MXS_BEGIN_DECLS
|
||||
#define MXS_JSON_PTR_PARAM_SSL_CERT_VERIFY_DEPTH MXS_JSON_PTR_PARAMETERS "/ssl_cert_verify_depth"
|
||||
|
||||
/** Non-parameter JSON pointers */
|
||||
#define MXS_JSON_PTR_MODULE "/data/attributes/module"
|
||||
#define MXS_JSON_PTR_MODULE "/data/attributes/module"
|
||||
#define MXS_JSON_PTR_PASSWORD "/data/attributes/password"
|
||||
#define MXS_JSON_PTR_ACCOUNT "/data/attributes/account"
|
||||
|
||||
/**
|
||||
* Common configuration parameters names
|
||||
@ -75,6 +76,7 @@ MXS_BEGIN_DECLS
|
||||
* For example CN_PASSWORD resolves to the static string "password". This means
|
||||
* that the sizeof(CN_<name>) returns the actual size of that string.
|
||||
*/
|
||||
extern const char CN_ACCOUNT[];
|
||||
extern const char CN_ADDRESS[];
|
||||
extern const char CN_ARG_MAX[];
|
||||
extern const char CN_ARG_MIN[];
|
||||
|
@ -179,4 +179,22 @@ void users_diagnostic(DCB* dcb, USERS* users);
|
||||
*/
|
||||
json_t* users_diagnostic_json(USERS* users);
|
||||
|
||||
/**
|
||||
* Convert account_type to a string
|
||||
*
|
||||
* @param type Enum value
|
||||
*
|
||||
* @return String representation of @c type
|
||||
*/
|
||||
const char* account_type_to_str(enum account_type type);
|
||||
|
||||
/**
|
||||
* Convert JSON value to account_type value
|
||||
*
|
||||
* @param json JSON value to convert
|
||||
*
|
||||
* @return Enum value of @c json
|
||||
*/
|
||||
enum account_type json_to_account_type(json_t* json);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
Reference in New Issue
Block a user