mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #687: remove trailing spaces in oneacl_helper.rb
This commit is contained in:
parent
43e44040f7
commit
23928a454c
@ -43,57 +43,57 @@ private
|
||||
# TODO check that @content[:resources_str] is valid
|
||||
def self.resource_mask(str)
|
||||
resource_type=str.split("/")[0]
|
||||
|
||||
|
||||
mask = "-------"
|
||||
|
||||
|
||||
resource_type.split("+").each{|type|
|
||||
case type
|
||||
when "VM"
|
||||
mask[0] = "V"
|
||||
mask[0] = "V"
|
||||
when "HOST"
|
||||
mask[1] = "H"
|
||||
mask[1] = "H"
|
||||
when "NET"
|
||||
mask[2] = "N"
|
||||
mask[2] = "N"
|
||||
when "IMAGE"
|
||||
mask[3] = "I"
|
||||
mask[3] = "I"
|
||||
when "USER"
|
||||
mask[4] = "U"
|
||||
when "TEMPLATE"
|
||||
mask[5] = "T"
|
||||
when "GROUP"
|
||||
mask[6] = "G"
|
||||
end
|
||||
}
|
||||
mask[6] = "G"
|
||||
end
|
||||
}
|
||||
mask
|
||||
end
|
||||
|
||||
|
||||
# TODO check that @content[:resources_str] is valid
|
||||
def self.right_mask(str)
|
||||
mask = "---------"
|
||||
|
||||
mask = "---------"
|
||||
|
||||
str.split("+").each{|type|
|
||||
case type
|
||||
when "CREATE"
|
||||
mask[0] = "C"
|
||||
mask[0] = "C"
|
||||
when "DELETE"
|
||||
mask[1] = "D"
|
||||
mask[1] = "D"
|
||||
when "USE"
|
||||
mask[2] = "U"
|
||||
mask[2] = "U"
|
||||
when "MANAGE"
|
||||
mask[3] = "M"
|
||||
mask[3] = "M"
|
||||
when "INFO"
|
||||
mask[4] = "I"
|
||||
when "INFO_POOL"
|
||||
mask[5] = "P"
|
||||
when "INFO_POOL_MINE"
|
||||
mask[6] = "p"
|
||||
mask[6] = "p"
|
||||
when "INSTANTIATE"
|
||||
mask[8] = "T"
|
||||
mask[8] = "T"
|
||||
when "CHOWN"
|
||||
mask[9] = "W"
|
||||
end
|
||||
mask[9] = "W"
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
mask
|
||||
end
|
||||
|
||||
@ -101,33 +101,33 @@ private
|
||||
config_file=self.class.table_conf
|
||||
|
||||
table=CLIHelper::ShowTable.new(config_file, self) do
|
||||
column :ID, "Rule Identifier",
|
||||
:size=>5 do |d|
|
||||
column :ID, "Rule Identifier",
|
||||
:size=>5 do |d|
|
||||
d['ID']
|
||||
end
|
||||
|
||||
column :USER, "To which resource owner the rule applies to",
|
||||
:size=>8 do |d|
|
||||
|
||||
column :USER, "To which resource owner the rule applies to",
|
||||
:size=>8 do |d|
|
||||
d['STRING'].split(" ")[0]
|
||||
end
|
||||
|
||||
|
||||
column :RES_VHNIUTG, "Resource to which the rule applies" do |d|
|
||||
OneAclHelper::resource_mask d['STRING'].split(" ")[1]
|
||||
OneAclHelper::resource_mask d['STRING'].split(" ")[1]
|
||||
end
|
||||
|
||||
|
||||
column :RID, "Resource ID", :right, :size=>8 do |d|
|
||||
d['STRING'].split(" ")[1].split("/")[1]
|
||||
end
|
||||
|
||||
|
||||
column :OPE_CDUMIPpTW, "Operation to which the rule applies" do |d|
|
||||
OneAclHelper::right_mask d['STRING'].split(" ")[2]
|
||||
OneAclHelper::right_mask d['STRING'].split(" ")[2]
|
||||
end
|
||||
|
||||
default :ID, :USER, :RES_VHNIUTG, :RID, :OPE_CDUMIPpTW
|
||||
end
|
||||
|
||||
table.show(pool, options)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user