Exemple #1
0
VError removeGroupFromGroup(VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup, const VString& s)
{
	VError err = VE_OK;
	CUAGDirectory* dir = inGroup->GetDirectory();
	CUAGGroup* group;
	{
		StErrorContextInstaller errs(false);
		group = dir->RetainGroup(s);
		if (group == nil)
		{
			VUUID id;
			id.FromString(s);
			group = dir->RetainGroup(id);
		}
	}
	if (group != nil)
	{
		err = inGroup->RemoveFromGroup(group);
	}
	else
	{
		err = ThrowError(VE_UAG_GROUPNAME_DOES_NOT_EXIST, s);
	}
	QuickReleaseRefCountable(group);
	return err;
}
Exemple #2
0
CUAGGroup* RetainParamGroup(CUAGDirectory* directory, VJSParms_callStaticFunction& ioParms, sLONG paramNum)
{
	CUAGGroup* result = nil;
	if (paramNum <= ioParms.CountParams())
	{
		if (ioParms.IsStringParam(paramNum))
		{
			StErrorContextInstaller errs(false);
			VString s;
			ioParms.GetStringParam(paramNum, s);
			result = directory->RetainGroup(s);
			if (result == nil)
			{
				VUUID xid;
				xid.FromString(s);
				result = directory->RetainGroup(xid);
			}
		}
		else
		{
			result = ioParms.GetParamObjectPrivateData<VJSGroup>(paramNum);
			if (result != nil)
				result->Retain();
		}
	}
	return result;
}
Exemple #3
0
void VJSDirectory::_getUser(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
	StErrorContextInstaller errs(false, true);
	VString s;
	ioParms.GetStringParam(1, s);
	CUAGUser* user = inDirectory->RetainUser(s);
	if (user == nil)
	{
		VUUID id;
		id.FromString(s);
		user = inDirectory->RetainUser(id);
	}
	if (user == nil)
		ioParms.ReturnNullValue();
	else
	{
		ioParms.ReturnValue(VJSUser::CreateInstance(ioParms.GetContext(), user));
		user->Release();
	}
}
Exemple #4
0
void VJSDirectory::_getGroup(VJSParms_callStaticFunction& ioParms, CUAGDirectory* inDirectory)
{
	StErrorContextInstaller errs(false, true);
	VString s;
	ioParms.GetStringParam(1, s);
	CUAGGroup* group = inDirectory->RetainGroup(s);
	if (group == nil)
	{
		VUUID id;
		id.FromString(s);
		group = inDirectory->RetainGroup(id);
	}
	if (group == nil)
		ioParms.ReturnNullValue();
	else
	{
		ioParms.ReturnValue(VJSGroup::CreateInstance(ioParms.GetContext(), group));
		group->Release();
	}
}
VError removeGroupFromGroup(VJSParms_callStaticFunction& ioParms, CUAGGroup* inGroup, const VString& s)
{
	VError err = VE_OK;
	CUAGDirectory* dir = inGroup->GetDirectory();
	CUAGGroup* group = dir->RetainGroup(s);
	if (group == nil)
	{
		VUUID id;
		id.FromString(s);
		group = dir->RetainGroup(id);
	}
	if (group != nil)
	{
		err = inGroup->RemoveFromGroup(group);
	}
	else
	{
		err = ThrowError(VE_UAG_GROUPNAME_DOES_NOT_EXIST, s);
	}
	return err;
}