Esempio n. 1
0
	void permission_object_t::test<20>()
	{
		LLFILE* fp = LLFile::fopen("linden_file.dat","w+");
		if(!fp)
		{
			llerrs << "file coudnt be opened\n" << llendl;
			return;
		}
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		
		U32 base = PERM_TRANSFER | PERM_COPY;
		U32 ownerp = PERM_TRANSFER;
		U32 groupp = PERM_TRANSFER;
		U32 everyone = PERM_TRANSFER;
		U32 next = PERM_NONE;

		perm.initMasks(base, ownerp, everyone, groupp, next);

		perm.exportFile(fp);
		fclose(fp);	
		fp = LLFile::fopen("linden_file.dat","r+");
		if(!fp)
		{
			llerrs << "file coudnt be opened\n" << llendl;
			return;
		}
		perm1.importFile(fp);
		fclose(fp);
		ensure("exportFile()/importFile():failed to export and import the data ", perm1 == perm);	
}
Esempio n. 2
0
	void permission_object_t::test<19>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		ensure("2:Operator==:failed ", perm != perm1);
	}
Esempio n. 3
0
	void permission_object_t::test<22>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		LLXMLNode* xml_node = perm.exportFileXML();
		perm1.importXML(xml_node);
		ensure("exportFileXML()/importXML():failed to export and import the data ", perm1 == perm);	
	}
Esempio n. 4
0
	void permission_object_t::test<4>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm1.init(creator,owner,lastOwner,group);
		perm.set(perm1);
		ensure("set():failed to set ", (creator == perm.getCreator()) && (owner == perm.getOwner())&&
									(lastOwner == perm.getLastOwner())&& (group == perm.getGroup()));	
		}
Esempio n. 5
0
void permission_object_t::test<17>()
{
    LLPermissions perm;
    LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
    LLUUID owner;
    LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d");
    LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");
    LLUUID agent;
    ensure("1:allowMoveBy():failed ", perm.allowTransferTo(agent));

    perm.init(creator,owner,lastOwner,group);
    ensure("2:allowMoveBy():failed ", perm.allowTransferTo(agent));
}
Esempio n. 6
0
	void permission_object_t::test<2>()
	{
		LLPermissions permissions;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		permissions.init(creator, owner, lastOwner, group);

		ensure_equals("init/getCreator():failed to return the creator ", creator, permissions.getCreator());	
		ensure_equals("init/getOwner():failed to return the owner ", owner, permissions.getOwner());
		ensure_equals("init/getLastOwner():failed to return the group ", lastOwner, permissions.getLastOwner());	
		ensure_equals("init/getGroup():failed to return the group ", group, permissions.getGroup());	
	}
Esempio n. 7
0
	void permission_object_t::test<23>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		std::ostringstream stream1, stream2;
		stream1 << perm;
		perm1.init(creator,owner,lastOwner,group);
		stream2 << perm1;
		ensure("1:operator << failed",(stream1.str() == stream2.str()));	
	}
Esempio n. 8
0
	void permission_object_t::test<6>()
	{
		LLPermissions perm;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		ensure_equals("getSafeOwner:failed ", owner,perm.getSafeOwner());
		
		///NULL Owner
		perm.init(creator,LLUUID::null,lastOwner,group);
		ensure_equals("getSafeOwner:failed ", group, perm.getSafeOwner());
	}
Esempio n. 9
0
	void permission_object_t::test<13>()
	{
		LLPermissions perm;
		LLUUID agent;
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		U32 bits = 10;
		ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent,group)));

		LLUUID agent1("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		perm.init(creator,owner,lastOwner,group);
		ensure("allowOperationBy():failed ", (TRUE == perm.allowOperationBy(bits,agent1,group)));
	}
Esempio n. 10
0
	void permission_object_t::test<16>()
	{
		LLPermissions perm;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner;
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		LLUUID agent;
		ensure("1:allowMoveBy():failed ", (TRUE == perm.allowMoveBy(agent)));
		ensure("2:allowMoveBy():failed ", (TRUE == perm.allowMoveBy(agent,group)));

		U32 val1 = 0x7FFFFFFF;
		S32 sVal = 1 << 19;
		sVal = val1 & sVal;
		LLUUID agent1("9c8eca51-53d5-42a7-bb58-cef070395db8"); 
		ensure("3:allowMoveBy():failed ", (sVal == perm.allowMoveBy(agent1)));
		ensure("4:allowMoveBy():failed ", (sVal == perm.allowMoveBy(agent1,group)));
	}
Esempio n. 11
0
	void permission_object_t::test<7>()
	{
		LLPermissions perm1;
		LLUUID uuid;
		BOOL is_group_owned = FALSE;
		ensure("1:getOwnership:failed ", (FALSE == perm1.getOwnership(uuid,is_group_owned)));
		
		LLPermissions perm;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		perm.getOwnership(uuid,is_group_owned);
		ensure("2:getOwnership:failed ", ((uuid == owner) && (FALSE == is_group_owned))); 

		perm.init(creator,LLUUID::null,lastOwner,group);
		perm.getOwnership(uuid,is_group_owned);
		ensure("3:getOwnership:failed ", ((uuid == group) && (TRUE == is_group_owned))); 
	}
Esempio n. 12
0
	void permission_object_t::test<5>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm1.init(creator,owner,lastOwner,group);

		U32 base = PERM_TRANSFER;
		U32 ownerp = PERM_TRANSFER;
		U32 groupp = PERM_TRANSFER;
		U32 everyone = PERM_TRANSFER;
		U32 next = PERM_NONE;

		perm1.initMasks(base, ownerp, everyone, groupp, next);

		base = PERM_ALL;
		ownerp = PERM_ITEM_UNRESTRICTED; //PERM_ITEM_UNRESTRICTED = PERM_MODIFY | PERM_COPY | PERM_TRANSFER;
		groupp = PERM_TRANSFER | PERM_COPY|PERM_MODIFY;
		everyone = PERM_TRANSFER;
		next = PERM_NONE;
		
		perm.init(creator,owner,lastOwner,group);
		perm.initMasks(base, ownerp, everyone, groupp, next); 

		// restrict permissions by accumulation
		perm.accumulate(perm1);

		U32 fixedbase = PERM_TRANSFER | PERM_MOVE;
		U32 fixedowner = PERM_TRANSFER;
		U32 fixedgroup = PERM_TRANSFER;
		U32 fixedeveryone = PERM_TRANSFER;
		U32 fixednext = PERM_NONE;

		ensure_equals("accumulate failed ", fixedbase, perm.getMaskBase());	
		ensure_equals("accumulate failed ", fixedowner, perm.getMaskOwner());	
		ensure_equals("accumulate failed ", fixedgroup, perm.getMaskGroup());	
		ensure_equals("accumulate failed ", fixedeveryone, perm.getMaskEveryone());	
		ensure_equals("accumulate failed ", fixednext, perm.getMaskNextOwner());	
	}
Esempio n. 13
0
	void permission_object_t::test<24>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);
		
		U32 base = PERM_TRANSFER | PERM_COPY;
		U32 ownerp = PERM_TRANSFER;
		U32 groupp = PERM_TRANSFER;
		U32 everyone = PERM_TRANSFER;
		U32 next = PERM_NONE;

		perm.initMasks(base, ownerp, everyone, groupp, next);

		LLSD sd = ll_create_sd_from_permissions(perm);
		perm1 = ll_permissions_from_sd(sd);
		ensure_equals("ll_permissions_from_sd() and ll_create_sd_from_permissions()functions failed", perm, perm1);
	}
Esempio n. 14
0
	void permission_object_t::test<21>()
	{
		LLPermissions perm,perm1;
		LLUUID creator("abf0d56b-82e5-47a2-a8ad-74741bb2c29e");	
		LLUUID owner("68edcf47-ccd7-45b8-9f90-1649d7f12806"); 
		LLUUID lastOwner("5e47a0dc-97bf-44e0-8b40-de06718cee9d"); 
		LLUUID group("9c8eca51-53d5-42a7-bb58-cef070395db8");		
		perm.init(creator,owner,lastOwner,group);

		U32 base = PERM_TRANSFER | PERM_COPY;
		U32 ownerp = PERM_TRANSFER;
		U32 groupp = PERM_TRANSFER;
		U32 everyone = PERM_TRANSFER;
		U32 next = PERM_NONE;

		perm.initMasks(base, ownerp, everyone, groupp, next);

		std::ostringstream ostream;
		perm.exportLegacyStream(ostream);
		std::istringstream istream(ostream.str());
		perm1.importLegacyStream(istream);

		ensure("exportLegacyStream()/importLegacyStream():failed to export and import the data ", perm1 == perm);	
	}