MXS-1354: Allow creation of basic users

The type of the user being created is defined at creation time. This
allows the creation of basic users.

Although the users can be created internally, they cannot yet be created
via maxadmin or the REST API.
This commit is contained in:
Markus Mäkelä
2017-08-15 14:15:59 +03:00
parent 829d8a1224
commit 253d6d211f
5 changed files with 37 additions and 28 deletions

View File

@ -25,6 +25,13 @@
MXS_BEGIN_DECLS
/** User account types */
enum account_type
{
ACCOUNT_BASIC, /**< Allows read-only access */
ACCOUNT_ADMIN /**< Allows complete access */
};
/**
* An opaque users object
*/
@ -52,10 +59,11 @@ void users_free(USERS* users);
* @param users The users table
* @param user The user name
* @param password The password for the user
* @param type The type of account to create
*
* @return True if user was added
*/
bool users_add(USERS *users, const char *user, const char *password);
bool users_add(USERS *users, const char *user, const char *password, enum account_type type);
/**
* Delete a user from the user table.