Clean up FSExportPermsCheck

meow-7.2.2
Ansariel 2018-02-13 23:02:03 +01:00
parent dc2efd2495
commit d6d7469503
1 changed files with 44 additions and 33 deletions

View File

@ -55,8 +55,10 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
F32 max_object_size = LLWorld::getInstance()->getRegionMaxPrimScale();
LLVector3 vec = object->getScale();
if (vec.mV[VX] > max_object_size || vec.mV[VY] > max_object_size || vec.mV[VZ] > max_object_size)
{
exportable = (creator == LLUUID("7ffd02d0-12f4-48b4-9640-695708fd4ae4") // Zwagoth Klaar
|| creator == gAgentID);
|| creator == gAgentID);
}
}
}
#ifdef OPENSIM
@ -82,20 +84,24 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
}
}
#endif // OPENSIM
// We've got perms on the object itself, let's check for sculptmaps and meshes!
if (exportable)
{
LLVOVolume *volobjp = NULL;
exportable = false;
LLVOVolume* volobjp = NULL;
if (object->getPCode() == LL_PCODE_VOLUME)
{
volobjp = (LLVOVolume *)object;
}
if (volobjp && volobjp->isSculpted())
{
const LLSculptParams *sculpt_params = (const LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
const LLSculptParams* sculpt_params = (const LLSculptParams *)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT);
if (LLGridManager::getInstance()->isInSecondLife())
{
if(volobjp->isMesh())
if (volobjp->isMesh())
{
if (dae)
{
@ -116,6 +122,7 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
{
exportable = (LLUUID(imagep->mComment["a"]) == gAgentID);
}
if (!exportable)
{
LLUUID asset_id = sculpt_params->getSculptTexture();
@ -126,14 +133,17 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
LLInventoryModel::INCLUDE_TRASH,
asset_id_matches);
for (S32 i = 0; i < items.size(); ++i)
for (S32 i = 0; i < items.size() && !exportable; ++i)
{
const LLPermissions perms = items[i]->getPermissions();
exportable = perms.getCreator() == gAgentID;
}
}
if (!exportable)
{
LL_INFOS("export") << "Sculpt map has failed permissions check." << LL_ENDL;
}
}
}
#ifdef OPENSIM
@ -149,7 +159,7 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
LLInventoryModel::INCLUDE_TRASH,
asset_id_matches);
for (S32 i = 0; i < items.size(); ++i)
for (S32 i = 0; i < items.size() && !exportable; ++i)
{
const LLPermissions perms = items[i]->getPermissions();
switch (LFSimFeatureHandler::instance().exportPolicy())
@ -166,8 +176,11 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
default:
exportable = perms.getCreator() == gAgentID;
}
if (!exportable)
LL_INFOS("export") << "Sculpt map has failed permissions check." << LL_ENDL;
}
if (!exportable)
{
LL_INFOS("export") << "Sculpt map has failed permissions check." << LL_ENDL;
}
}
else
@ -179,9 +192,11 @@ bool FSExportPermsCheck::canExportNode(LLSelectNode* node, bool dae)
}
else
{
// No sculpt or mesh
exportable = true;
}
}
return exportable;
}
@ -207,39 +222,35 @@ bool FSExportPermsCheck::canExportAsset(LLUUID asset_id, std::string* name, std:
(*name) = items[0]->getName();
(*description) = items[0]->getDescription();
for (S32 i = 0; i < items.size(); ++i)
for (S32 i = 0; i < items.size() && !exportable; ++i)
{
if (!exportable)
{
LLPermissions perms = items[i]->getPermissions();
LLPermissions perms = items[i]->getPermissions();
#ifdef OPENSIM
if (LLGridManager::getInstance()->isInOpenSim())
if (LLGridManager::getInstance()->isInOpenSim())
{
switch (LFSimFeatureHandler::instance().exportPolicy())
{
switch (LFSimFeatureHandler::instance().exportPolicy())
{
case EXPORT_ALLOWED:
exportable = (perms.getMaskOwner() & PERM_EXPORT) == PERM_EXPORT;
break;
/// TODO: Once enough grids adopt a version supporting exports, get consensus
/// on whether we should allow full perm exports anymore.
case EXPORT_UNDEFINED:
exportable = (perms.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED;
break;
case EXPORT_DENIED:
default:
exportable = perms.getCreator() == gAgentID;
break;
}
case EXPORT_ALLOWED:
exportable = (perms.getMaskOwner() & PERM_EXPORT) == PERM_EXPORT;
break;
/// TODO: Once enough grids adopt a version supporting exports, get consensus
/// on whether we should allow full perm exports anymore.
case EXPORT_UNDEFINED:
exportable = (perms.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED;
break;
case EXPORT_DENIED:
default:
exportable = perms.getCreator() == gAgentID;
break;
}
}
#endif
if (LLGridManager::getInstance()->isInSecondLife() && (perms.getCreator() == gAgentID))
{
exportable = true;
}
if (LLGridManager::getInstance()->isInSecondLife() && (perms.getCreator() == gAgentID))
{
exportable = true;
}
}
}
return exportable;
}