Allow export full perm item on opensim if it doesn't support the export bit.
This addresses https://code.google.com/p/singularity-viewer/issues/detail?id=1003
This commit is contained in:
@@ -1099,8 +1099,11 @@ LLPermissions ll_permissions_from_sd(const LLSD& sd_perm)
|
|||||||
return rv;
|
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.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ extern void mask_to_string(U32 mask, char* str);
|
|||||||
extern std::string mask_to_string(U32 mask);
|
extern std::string mask_to_string(U32 mask);
|
||||||
template<class T> class LLMetaClassT;
|
template<class T> 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
|
// Class LLPermissions
|
||||||
//
|
//
|
||||||
@@ -280,7 +286,7 @@ public:
|
|||||||
// has that bit set and allow exporting even when this function returns false,
|
// 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
|
// or pass supports_export as true, which causes to perform that check using
|
||||||
// these permissions.
|
// 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
|
// This somewhat specialized function is meant for testing if the
|
||||||
// current owner is allowed to transfer to the specified agent id.
|
// current owner is allowed to transfer to the specified agent id.
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ namespace
|
|||||||
LLPermissions* perms = node->mPermissions; // Is perms ever NULL?
|
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
|
// 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.
|
// 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
|
class LFSaveSelectedObjects : public view_listener_t
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace DAEExportUtil
|
|||||||
LLPermissions* perms = node->mPermissions; // Is perms ever NULL?
|
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
|
// 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.
|
// 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()
|
void saveSelectedObject()
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ LFSimFeatureHandler::LFSimFeatureHandler()
|
|||||||
LLEnvManagerNew::instance().setRegionChangeCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this));
|
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()
|
void LFSimFeatureHandler::handleRegionChange()
|
||||||
{
|
{
|
||||||
if (LLViewerRegion* region = gAgent.getRegion())
|
if (LLViewerRegion* region = gAgent.getRegion())
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#define LFSIMFEATUREHANDLER_H
|
#define LFSIMFEATUREHANDLER_H
|
||||||
|
|
||||||
#include "llsingleton.h"
|
#include "llsingleton.h"
|
||||||
|
#include "llpermissions.h" // ExportPolicy
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
class SignaledType
|
class SignaledType
|
||||||
@@ -64,6 +65,7 @@ public:
|
|||||||
bool simSupportsExport() const { return mSupportsExport; }
|
bool simSupportsExport() const { return mSupportsExport; }
|
||||||
std::string mapServerURL() const { return mMapServerURL; }
|
std::string mapServerURL() const { return mMapServerURL; }
|
||||||
std::string searchURL() const { return mSearchURL; }
|
std::string searchURL() const { return mSearchURL; }
|
||||||
|
ExportPolicy exportPolicy() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// SignaledTypes
|
// SignaledTypes
|
||||||
|
|||||||
@@ -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.
|
// 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.
|
// 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 &&
|
if (is_complete &&
|
||||||
(item->getPermissions().allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().simSupportsExport())))
|
(item->getPermissions().allowExportBy(gAgent.getID(), LFSimFeatureHandler::instance().exportPolicy())))
|
||||||
{
|
{
|
||||||
can_export = true;
|
can_export = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2888,14 +2888,14 @@ class LLObjectEnableExport : public view_listener_t
|
|||||||
{
|
{
|
||||||
LLPermissions perms;
|
LLPermissions perms;
|
||||||
bool new_value = LLSelectMgr::getInstance()->selectGetPermissions(perms) && perms.isOwned(); // At least one object, accumulated permissions of all objects.
|
bool new_value = LLSelectMgr::getInstance()->selectGetPermissions(perms) && perms.isOwned(); // At least one object, accumulated permissions of all objects.
|
||||||
bool supports_export = LFSimFeatureHandler::instance().simSupportsExport();
|
ExportPolicy export_policy = LFSimFeatureHandler::instance().exportPolicy();
|
||||||
if (new_value && !(supports_export && (perms.getMaskEveryone() & PERM_EXPORT))) // No need to call allowExportBy if PERM_EXPORT is set on (all) root objects.
|
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;
|
bool can_export_any = false;
|
||||||
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
|
LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
|
||||||
for (LLObjectSelection::iterator node = selection->begin(); node != selection->end(); ++node)
|
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;
|
can_export_any = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ void LLObjectBackup::exportObject_continued(AIFilePicker* filepicker)
|
|||||||
|
|
||||||
bool LLObjectBackup::validatePerms(const LLPermissions *item_permissions)
|
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...
|
// So far, only Second Life forces TPVs to verify the creator for textures...
|
||||||
|
|||||||
Reference in New Issue
Block a user