diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index 07aa44db3..fb5359a88 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -1099,8 +1099,11 @@ LLPermissions ll_permissions_from_sd(const LLSD& sd_perm) return rv; } -bool LLPermissions::allowExportBy(LLUUID const& requester, bool supports_export) const +bool LLPermissions::allowExportBy(LLUUID const& requester, ExportPolicy export_policy) const { - return !mIsGroupOwned && requester == mOwner && (requester == mCreator || (supports_export && (mMaskEveryone & PERM_EXPORT))); + return !mIsGroupOwned && requester == mOwner && // Must be owner. + (requester == mCreator || // Export is allowed for all export policies when creator. + (export_policy == ep_export_bit && (mMaskEveryone & PERM_EXPORT)) || // If not creator, only allow export when PERM_EXPORT bit is set. + (export_policy == ep_full_perm && (mMaskOwner & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED)); // If not creator, only allow export when item is full perm. } diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index d4f736dc3..e6284e542 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -40,6 +40,12 @@ extern void mask_to_string(U32 mask, char* str); extern std::string mask_to_string(U32 mask); template class LLMetaClassT; +enum ExportPolicy { + ep_creator_only, // Used for SecondLife: only allow export when being creator. + ep_full_perm, // Used on non-SL grids that do not support the PERM_EXPORT bit: allow exporting of full perm objects. + ep_export_bit // Used on opensim grids that support the PERM_EXPORT bit. +}; + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLPermissions // @@ -280,7 +286,7 @@ public: // has that bit set and allow exporting even when this function returns false, // or pass supports_export as true, which causes to perform that check using // these permissions. - bool allowExportBy(LLUUID const& requester, bool supports_export = false) const; + bool allowExportBy(LLUUID const& requester, ExportPolicy export_policy) const; // This somewhat specialized function is meant for testing if the // current owner is allowed to transfer to the specified agent id. diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp index 635d9b9a9..dbf68dc9a 100644 --- a/indra/newview/awavefront.cpp +++ b/indra/newview/awavefront.cpp @@ -226,7 +226,7 @@ namespace LLPermissions* perms = node->mPermissions; // Is perms ever NULL? // This tests the PERM_EXPORT bit too, which is not really necessary (just checking if it's set // on the root prim would suffice), but also isn't hurting. - return perms && perms->allowExportBy(gAgentID, LFSimFeatureHandler::instance().simSupportsExport()); + return perms && perms->allowExportBy(gAgentID, LFSimFeatureHandler::instance().exportPolicy()); } class LFSaveSelectedObjects : public view_listener_t { diff --git a/indra/newview/daeexport.cpp b/indra/newview/daeexport.cpp index 44bde7816..978e81374 100644 --- a/indra/newview/daeexport.cpp +++ b/indra/newview/daeexport.cpp @@ -123,7 +123,7 @@ namespace DAEExportUtil LLPermissions* perms = node->mPermissions; // Is perms ever NULL? // This tests the PERM_EXPORT bit too, which is not really necessary (just checking if it's set // on the root prim would suffice), but also isn't hurting. - return perms && perms->allowExportBy(gAgentID, LFSimFeatureHandler::instance().simSupportsExport()); + return perms && perms->allowExportBy(gAgentID, LFSimFeatureHandler::instance().exportPolicy()); } void saveSelectedObject() diff --git a/indra/newview/lfsimfeaturehandler.cpp b/indra/newview/lfsimfeaturehandler.cpp index 178fbb50e..5972c0f24 100644 --- a/indra/newview/lfsimfeaturehandler.cpp +++ b/indra/newview/lfsimfeaturehandler.cpp @@ -31,6 +31,11 @@ LFSimFeatureHandler::LFSimFeatureHandler() LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this)); } +ExportPolicy LFSimFeatureHandler::exportPolicy(void) const +{ + return gHippoGridManager->getCurrentGrid()->isSecondLife() ? ep_creator_only : (mSupportsExport ? ep_export_bit : ep_full_perm); +} + void LFSimFeatureHandler::handleRegionChange() { if (LLViewerRegion* region = gAgent.getRegion()) diff --git a/indra/newview/lfsimfeaturehandler.h b/indra/newview/lfsimfeaturehandler.h index 83acdd95a..addc6254b 100644 --- a/indra/newview/lfsimfeaturehandler.h +++ b/indra/newview/lfsimfeaturehandler.h @@ -19,6 +19,7 @@ #define LFSIMFEATUREHANDLER_H #include "llsingleton.h" +#include "llpermissions.h" // ExportPolicy template class SignaledType @@ -64,6 +65,7 @@ public: bool simSupportsExport() const { return mSupportsExport; } std::string mapServerURL() const { return mMapServerURL; } std::string searchURL() const { return mSearchURL; } + ExportPolicy exportPolicy() const; private: // SignaledTypes diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 81d807259..8e4f890ff 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1424,7 +1424,7 @@ bool LLPanelEditWearable::updatePermissions() // Exporting (of slider values) is allowed when the wearable is full perm, and owned by and created by the user. // Of course, only modifiable is enough for the user to write down the values and enter them else where... but why make it easy for them to break the ToS. if (is_complete && - (item->getPermissions().allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().simSupportsExport()))) + (item->getPermissions().allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().exportPolicy()))) { can_export = true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index f9d008359..f216de44c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2888,14 +2888,14 @@ class LLObjectEnableExport : public view_listener_t { LLPermissions perms; bool new_value = LLSelectMgr::getInstance()->selectGetPermissions(perms) && perms.isOwned(); // At least one object, accumulated permissions of all objects. - bool supports_export = LFSimFeatureHandler::instance().simSupportsExport(); - if (new_value && !(supports_export && (perms.getMaskEveryone() & PERM_EXPORT))) // No need to call allowExportBy if PERM_EXPORT is set on (all) root objects. + ExportPolicy export_policy = LFSimFeatureHandler::instance().exportPolicy(); + if (new_value && !(export_policy == ep_export_bit && (perms.getMaskEveryone() & PERM_EXPORT))) // No need to call allowExportBy if PERM_EXPORT is set on (all) root objects. { bool can_export_any = false; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); for (LLObjectSelection::iterator node = selection->begin(); node != selection->end(); ++node) { - if ((*node)->mPermissions->allowExportBy(gAgent.getID(), supports_export)) + if ((*node)->mPermissions->allowExportBy(gAgent.getID(), export_policy)) { can_export_any = true; break; diff --git a/indra/newview/llviewerobjectbackup.cpp b/indra/newview/llviewerobjectbackup.cpp index 795426a2d..98f08007e 100644 --- a/indra/newview/llviewerobjectbackup.cpp +++ b/indra/newview/llviewerobjectbackup.cpp @@ -399,7 +399,7 @@ void LLObjectBackup::exportObject_continued(AIFilePicker* filepicker) bool LLObjectBackup::validatePerms(const LLPermissions *item_permissions) { - return item_permissions->allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().simSupportsExport()); + return item_permissions->allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().exportPolicy()); } // So far, only Second Life forces TPVs to verify the creator for textures...