mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
Feature #687: Change Auth. unit test to report the object groups
This commit is contained in:
parent
27e04919b2
commit
90fc30f6af
@ -237,41 +237,43 @@ public:
|
||||
|
||||
void self_authorize()
|
||||
{
|
||||
set<int> empty_set;
|
||||
// Make all users belong to the USERS (1) group
|
||||
set<int> gid_set;
|
||||
gid_set.insert(1);
|
||||
|
||||
AuthRequest ar(2, empty_set);
|
||||
AuthRequest ar1(2, empty_set);
|
||||
AuthRequest ar2(3, empty_set);
|
||||
AuthRequest ar3(4, empty_set);
|
||||
AuthRequest ar4(2, empty_set);
|
||||
AuthRequest ar5(0, empty_set);
|
||||
AuthRequest ar6(0, empty_set);
|
||||
AuthRequest ar(2, gid_set);
|
||||
AuthRequest ar1(2, gid_set);
|
||||
AuthRequest ar2(3, gid_set);
|
||||
AuthRequest ar3(4, gid_set);
|
||||
AuthRequest ar4(2, gid_set);
|
||||
AuthRequest ar5(0, gid_set);
|
||||
AuthRequest ar6(0, gid_set);
|
||||
|
||||
ar.add_auth(AuthRequest::VM,"dGhpcy",0,AuthRequest::CREATE,2,false);
|
||||
ar.add_auth(AuthRequest::NET,2,0,AuthRequest::USE,2,false);
|
||||
ar.add_auth(AuthRequest::IMAGE,3,0,AuthRequest::USE,4,true);
|
||||
ar.add_auth(AuthRequest::VM,"dGhpcy",-1,AuthRequest::CREATE,2,false);
|
||||
ar.add_auth(AuthRequest::NET,2,1,AuthRequest::USE,2,false);
|
||||
ar.add_auth(AuthRequest::IMAGE,3,1,AuthRequest::USE,4,true);
|
||||
|
||||
CPPUNIT_ASSERT(ar.plain_authorize() == true);
|
||||
|
||||
ar1.add_auth(AuthRequest::VM,"dGhpcy",0,AuthRequest::CREATE,2,false);
|
||||
ar1.add_auth(AuthRequest::NET,2,0,AuthRequest::USE,2,false);
|
||||
ar1.add_auth(AuthRequest::IMAGE,3,0,AuthRequest::USE,4,false);
|
||||
ar1.add_auth(AuthRequest::VM,"dGhpcy",-1,AuthRequest::CREATE,2,false);
|
||||
ar1.add_auth(AuthRequest::NET,2,1,AuthRequest::USE,2,false);
|
||||
ar1.add_auth(AuthRequest::IMAGE,3,1,AuthRequest::USE,4,false);
|
||||
|
||||
CPPUNIT_ASSERT(ar1.plain_authorize() == false);
|
||||
|
||||
ar2.add_auth(AuthRequest::HOST,"dGhpcy",0,AuthRequest::CREATE,0,false);
|
||||
ar2.add_auth(AuthRequest::HOST,"dGhpcy",-1,AuthRequest::CREATE,0,false);
|
||||
CPPUNIT_ASSERT(ar2.plain_authorize() == false);
|
||||
|
||||
ar3.add_auth(AuthRequest::VM,5,0,AuthRequest::MANAGE,2,false);
|
||||
ar3.add_auth(AuthRequest::VM,5,1,AuthRequest::MANAGE,2,false);
|
||||
CPPUNIT_ASSERT(ar3.plain_authorize() == false);
|
||||
|
||||
ar4.add_auth(AuthRequest::VM,4,0,AuthRequest::MANAGE,2,false);
|
||||
ar4.add_auth(AuthRequest::VM,4,1,AuthRequest::MANAGE,2,false);
|
||||
CPPUNIT_ASSERT(ar4.plain_authorize() == true);
|
||||
|
||||
ar5.add_auth(AuthRequest::HOST,4,0,AuthRequest::MANAGE,0,false);
|
||||
ar5.add_auth(AuthRequest::HOST,4,-1,AuthRequest::MANAGE,0,false);
|
||||
CPPUNIT_ASSERT(ar5.plain_authorize() == true);
|
||||
|
||||
ar6.add_auth(AuthRequest::HOST,4,0,AuthRequest::CREATE,0,false);
|
||||
ar6.add_auth(AuthRequest::HOST,4,-1,AuthRequest::CREATE,0,false);
|
||||
CPPUNIT_ASSERT(ar6.plain_authorize() == true);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user