1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #662: Add a user to the default USERS group when it is allocated. This needs to be done when the user creation is done outside the RM.

This commit is contained in:
Carlos Martín 2011-06-07 17:00:14 +02:00
parent 069cd6bfb1
commit 5a0d617af0
2 changed files with 15 additions and 1 deletions

View File

@ -212,6 +212,7 @@ int UserAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
string passwd = xmlrpc_c::value_string(paramList.getString(2));
UserPool * upool = static_cast<UserPool *>(pool);
User * user;
int rc = upool->allocate(&id,GroupPool::USERS_ID,uname,passwd,true,error_str);
@ -220,9 +221,20 @@ int UserAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
return rc;
}
user = static_cast<User *>(pool->get(id,true));
if( user == 0 )
{
return -1;
}
user->add_group(GroupPool::USERS_ID);
pool->update(user);
user->unlock();
Nebula& nd = Nebula::instance();
GroupPool * gpool = nd.get_gpool();
Group * group = gpool->get(gid, true);
Group * group = gpool->get(GroupPool::USERS_ID, true);
if( group == 0 )
{

View File

@ -88,6 +88,7 @@ UserPool::UserPool(SqlDB * db):PoolSQL(db,User::table)
string error_str;
string sha1_pass = SSLTools::sha1_digest(one_pass);
// TODO: Add oneadmin to ONEADMIN Group
allocate(&one_uid,GroupPool::ONEADMIN_ID,one_name,sha1_pass,
true, error_str);
}
@ -256,6 +257,7 @@ bool UserPool::authenticate(const string& session, int& user_id, int& group_id)
if ( !is.fail() )
{
// TODO: Add new user to USERS Group
allocate(&user_id,
GroupPool::USERS_ID,
mad_name,