mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
Feature #1112: Store oneadmin's ID and name in UserPool
This commit is contained in:
parent
6d360310f4
commit
a4426b6824
@ -176,6 +176,16 @@ public:
|
||||
*/
|
||||
static const char * SERVER_NAME;
|
||||
|
||||
/**
|
||||
* Name of the oneadmin user
|
||||
*/
|
||||
static string oneadmin_name;
|
||||
|
||||
/**
|
||||
* Identifier for the oneadmin user
|
||||
*/
|
||||
static const int ONEADMIN_ID;
|
||||
|
||||
private:
|
||||
//--------------------------------------------------------------------------
|
||||
// Configuration Attributes for Users
|
||||
|
@ -40,11 +40,15 @@ const char * UserPool::DEFAULT_AUTH = "default";
|
||||
|
||||
const char * UserPool::SERVER_NAME = "serveradmin";
|
||||
|
||||
const int UserPool::ONEADMIN_ID = 0;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
time_t UserPool::_session_expiration_time;
|
||||
|
||||
string UserPool::oneadmin_name;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@ -74,8 +78,13 @@ UserPool::UserPool(SqlDB * db,
|
||||
|
||||
_session_expiration_time = __session_expiration_time;
|
||||
|
||||
if (get(0,false) != 0)
|
||||
User * oneadmin_user = get(0, true);
|
||||
|
||||
if (oneadmin_user != 0)
|
||||
{
|
||||
oneadmin_name = oneadmin_user->get_name();
|
||||
oneadmin_user->unlock();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -122,6 +131,8 @@ UserPool::UserPool(SqlDB * db,
|
||||
goto error_token;
|
||||
}
|
||||
|
||||
oneadmin_name = one_name;
|
||||
|
||||
if ( one_name == SERVER_NAME )
|
||||
{
|
||||
goto error_one_name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user