mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-16 09:43:18 +09:00
bugfix in simple_permissions and modified test
This commit is contained in:
1 parent
430fc888e5
commit
97ab4e2426
2 files changed
+12
-6
No files matched your search
@@ -33,8 +33,6 @@ class SimplePermissions
|
||||
end
|
||||
|
||||
def auth(uid, tokens)
|
||||
STDERR.puts [uid, tokens].inspect
|
||||
|
||||
result=true
|
||||
|
||||
tokens.each do |token|
|
||||
@@ -60,7 +58,7 @@ class SimplePermissions
|
||||
|
||||
when 'USE'
|
||||
if %w{VM NET IMAGE}.include? object
|
||||
auth_result = ((owner == uid) || pub)
|
||||
auth_result = ((owner == uid) | pub)
|
||||
elsif object == 'HOST'
|
||||
auth_result=true
|
||||
end
|
||||
|
||||
@@ -19,6 +19,16 @@ require 'spec_common'
|
||||
require 'client_mock'
|
||||
require 'simple_permissions'
|
||||
|
||||
CONF=<<EOT
|
||||
:database: sqlite://auth.db
|
||||
:authentication: simple
|
||||
:quota:
|
||||
:enabled: false
|
||||
:defaults:
|
||||
:cpu: 10.0
|
||||
:memory: 1048576
|
||||
EOT
|
||||
|
||||
def gen_tokens(user_, action_, options={})
|
||||
user=user_.to_s
|
||||
action=action_.to_s.upcase
|
||||
@@ -48,8 +58,6 @@ def gen_tokens(user_, action_, options={})
|
||||
]
|
||||
tokens<<"HOST:#{id}:#{action}:#{user}:#{pub}" if options[:host]
|
||||
|
||||
#pp tokens
|
||||
|
||||
tokens
|
||||
end
|
||||
|
||||
@@ -58,7 +66,7 @@ describe SimplePermissions do
|
||||
@db=Sequel.sqlite
|
||||
mock_data=YAML::load(File.read('spec/oca_vms.yaml'))
|
||||
client=ClientMock.new(mock_data)
|
||||
@perm=SimplePermissions.new(@db, client)
|
||||
@perm=SimplePermissions.new(@db, client, YAML::load(CONF))
|
||||
end
|
||||
|
||||
it 'should let root manage everything' do
|
||||
|
||||
Reference in new issue
Block a user