1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-25 23:21:29 +03:00

Feature #1112: Integrate datastores into acl rules

This commit is contained in:
Carlos Martín 2012-02-15 18:53:23 +01:00
parent 0f350b3da0
commit 2a6f5b50dc
4 changed files with 16 additions and 12 deletions

View File

@ -166,7 +166,7 @@ bool AclRule::malformed(string& error_str) const
oss << "when using the ALL bit, [resource] ID must be 0";
}
if ( (resource & 0xFF000000000LL) == 0 )
if ( (resource & 0xFFF000000000LL) == 0 )
{
if ( error )
{
@ -177,7 +177,7 @@ bool AclRule::malformed(string& error_str) const
oss << "[resource] type is missing";
}
if ( (resource & 0xFFFFF00000000000LL) != 0 )
if ( (resource & 0xFFFF000000000000LL) != 0 )
{
if ( error )
{
@ -253,12 +253,13 @@ void AclRule::build_str()
PoolObjectSQL::IMAGE,
PoolObjectSQL::USER,
PoolObjectSQL::TEMPLATE,
PoolObjectSQL::GROUP
PoolObjectSQL::GROUP,
PoolObjectSQL::DATASTORE
};
bool prefix = false;
for ( int i = 0; i < 7; i++ )
for ( int i = 0; i < 8; i++ )
{
if ( (resource & objects[i]) != 0 )
{

View File

@ -9,9 +9,9 @@
:size: 8
:right: true
:RES_VHNIUTG:
:RES_VHNIUTGD:
:desc: Which resource the rule applies to
:size: 11
:size: 12
:RID:
:desc: Resource ID
@ -26,6 +26,6 @@
:default:
- :ID
- :USER
- :RES_VHNIUTG
- :RES_VHNIUTGD
- :RID
- :OPE_UMAC

View File

@ -44,7 +44,7 @@ private
def self.resource_mask(str)
resource_type=str.split("/")[0]
mask = "-------"
mask = "--------"
resource_type.split("+").each{|type|
case type
@ -62,6 +62,8 @@ private
mask[5] = "T"
when "GROUP"
mask[6] = "G"
when "DATASTORE"
mask[7] = "D"
end
}
mask
@ -101,8 +103,8 @@ private
d['STRING'].split(" ")[0]
end
column :RES_VHNIUTG, "Resource to which the rule applies",
:size => 11 do |d|
column :RES_VHNIUTGD, "Resource to which the rule applies",
:size => 12 do |d|
OneAclHelper::resource_mask d['STRING'].split(" ")[1]
end
@ -115,7 +117,7 @@ private
OneAclHelper::right_mask d['STRING'].split(" ")[2]
end
default :ID, :USER, :RES_VHNIUTG, :RID, :OPE_UMAC
default :ID, :USER, :RES_VHNIUTGD, :RID, :OPE_UMAC
end
table

View File

@ -52,7 +52,8 @@ module OpenNebula
"IMAGE" => 0x8000000000,
"USER" => 0x10000000000,
"TEMPLATE" => 0x20000000000,
"GROUP" => 0x40000000000
"GROUP" => 0x40000000000,
"DATASTORE" => 0x100000000000
}
RIGHTS =