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

Feature #862: Restore the MINE_GROUP filter flag for poolinfo calls. Change the default flag to 'ALL' in CLI and Sunstone

This commit is contained in:
Carlos Martín 2012-01-05 18:56:37 +01:00
parent 2f080668d8
commit 230252f0b4
4 changed files with 22 additions and 24 deletions

View File

@ -40,12 +40,15 @@ protected:
/* -------------------------------------------------------------------- */
/** Specify all objects the user has right to view (-2) */
/** Specify all objects the user has right to USE (-2) */
static const int ALL;
/** Specify user's objects in the pool (-3) */
static const int MINE;
/** Specify user's + group objects (-1) */
static const int MINE_GROUP;
/* -------------------------------------------------------------------- */
virtual void request_execute(

View File

@ -88,7 +88,7 @@ EOT
end
def list_pool(options, top=false, filter_flag=nil)
filter_flag ||= OpenNebula::Pool::INFO_GROUP
filter_flag ||= OpenNebula::Pool::INFO_ALL
pool = factory_pool(filter_flag)
@ -312,14 +312,8 @@ EOT
rc = pool.info
if OpenNebula.is_error?(rc)
user_flag = OpenNebula::Pool::INFO_GROUP
pool = factory_pool(user_flag)
rc = pool.info
if OpenNebula.is_error?(rc)
return -1, "OpenNebula #{self.class.rname} name not " <<
"found, use the ID instead"
end
return -1, "OpenNebula #{self.class.rname} name not " <<
"found, use the ID instead"
end
return 0, pool

View File

@ -25,6 +25,8 @@ const int RequestManagerPoolInfoFilter::ALL = -2;
const int RequestManagerPoolInfoFilter::MINE = -3;
const int RequestManagerPoolInfoFilter::MINE_GROUP = -1;
/* ------------------------------------------------------------------------- */
const int VirtualMachinePoolInfo::ALL_VM = -2;
@ -170,20 +172,19 @@ void RequestManagerPoolInfoFilter::dump(
AuthRequest::USE, all, oids, gids);
}
if ( filter_flag != ALL )
switch ( filter_flag )
{
int uid;
if ( filter_flag == MINE )
{
uid = att.uid;
}
else
{
uid = filter_flag;
}
uid_filter << "uid = " << uid;
case MINE:
uid_filter << "uid = " << att.uid;
break;
case MINE_GROUP:
uid_filter << "uid = " << att.uid << " OR gid = " << att.gid;
break;
case ALL:
break;
default:
uid_filter << "uid = " << filter_flag;
break;
}
if ( !all ) // If all == true, there is not a uid or gid restriction

View File

@ -21,7 +21,7 @@ require 'acct/watch_client'
class SunstoneServer
# FLAG that will filter the elements retrieved from the Pools
POOL_FILTER = Pool::INFO_GROUP
POOL_FILTER = Pool::INFO_ALL
def initialize(client)
@client = client