MXS-1354: Take refactored users into use
The refactored interface is now in use. The only module that used it directly was the CDC protocol module. This should probably be changed so that it uses the adminusers interface instead of the users interface directly.
This commit is contained in:
@ -34,20 +34,12 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <maxscale/users.h>
|
||||
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
/**
|
||||
* test1 Allocate table of users and mess around with it
|
||||
*
|
||||
*/
|
||||
|
||||
static int
|
||||
test1()
|
||||
static int test1()
|
||||
{
|
||||
USERS *users;
|
||||
const char *authdata;
|
||||
int result, count;
|
||||
USERS* users;
|
||||
bool rv;
|
||||
|
||||
/* Poll tests */
|
||||
ss_dfprintf(stderr,
|
||||
@ -56,33 +48,24 @@ test1()
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(NULL != users, "Allocating user table should not return NULL.");
|
||||
ss_dfprintf(stderr, "\t..done\nAdd a user");
|
||||
count = users_add(users, "username", "authorisation");
|
||||
rv = users_add(users, "username", "authorisation");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(1 == count, "Should add one user");
|
||||
authdata = users_fetch(users, "username");
|
||||
ss_info_dassert(rv, "Should add one user");
|
||||
rv = users_auth(users, "username", "authorisation");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
|
||||
ss_info_dassert(0 == strcmp("authorisation", authdata), "User authorisation should be correct");
|
||||
ss_dfprintf(stderr, "\t..done\nPrint users");
|
||||
usersPrint(users);
|
||||
ss_info_dassert(rv, "Fetch valid user must not return NULL");
|
||||
rv = users_auth(users, "username", "newauth");
|
||||
mxs_log_flush_sync();
|
||||
ss_dfprintf(stderr, "\t..done\nUpdate a user");
|
||||
count = users_update(users, "username", "newauth");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(1 == count, "Should update just one user");
|
||||
authdata = users_fetch(users, "username");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
|
||||
ss_info_dassert(0 == strcmp("newauth", authdata), "User authorisation should be correctly updated");
|
||||
ss_info_dassert(rv, "Fetch valid user must not return NULL");
|
||||
|
||||
ss_dfprintf(stderr, "\t..done\nAdd another user");
|
||||
count = users_add(users, "username2", "authorisation2");
|
||||
rv = users_add(users, "username2", "authorisation2");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(1 == count, "Should add one user");
|
||||
ss_info_dassert(rv, "Should add one user");
|
||||
ss_dfprintf(stderr, "\t..done\nDelete a user.");
|
||||
count = users_delete(users, "username");
|
||||
rv = users_delete(users, "username");
|
||||
mxs_log_flush_sync();
|
||||
ss_info_dassert(1 == count, "Should delete just one user");
|
||||
ss_info_dassert(rv, "Should delete just one user");
|
||||
ss_dfprintf(stderr, "\t..done\nFree user table.");
|
||||
users_free(users);
|
||||
mxs_log_flush_sync();
|
||||
|
Reference in New Issue
Block a user