Handle PERM_EXPORT in LLPermissions.

This moves all export test code to where it belongs:
in LLPermissions.

Added LLPermissions::allowExportBy, next to
allowModifyBy, allowCopyBy and allowMoveBy.
Then changed all code to use this call.

Because LLPermissions is part of llinventory, I had
to add a proxy for LFSimFeatureHandler.
Added a new class LFSimFeatureHandlerInterface that can be
used by LLPermissions to check simulator features by
accessing the LFSimFeatureHandler singleton.

Several parts of the code ignored the PERM_EXPORT but
and still did demand that things are full perm next
to being a creator. This has now changed the export
rules are the same for everything as they were for mesh:
you need to be the owner and the creator for every element
that is exported (not just the root prim, of course).

Export rules can now be easily made a function on
simulator features. If different rules apply for different
types (wearables, objects, mesh etc) then an extra variable
indicating the type will have to be passed though.
This commit is contained in:
Aleric Inglewood
2013-07-22 02:22:21 +02:00
parent 85ff52be30
commit 9c71afe73e
11 changed files with 58 additions and 59 deletions

View File

@@ -34,6 +34,13 @@
#include "metapropertyt.h"
#include "llsd.h"
///----------------------------------------------------------------------------
/// Class LFSimFeatureHandlerInterface
///----------------------------------------------------------------------------
//static
LFSimFeatureHandlerInterface* LFSimFeatureHandlerInterface::sInstance;
///----------------------------------------------------------------------------
/// Class LLPermissions
///----------------------------------------------------------------------------
@@ -475,6 +482,14 @@ BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, B
bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const
{
// Singu extension: Make this function work for PERM_EXPORT operation (also on grids not supporting it).
if (op == PERM_EXPORT)
{
// Requester must always be the owner; on grids supporting PERM_EXPORT, that bit
// must be set in the mMaskEveryone mask, otherwise the requester must be the creator.
return (!mIsGroupOwned && (mOwner == requester) &&
(mCreator == requester || (LFSimFeatureHandlerInterface::ifInstance()->simSupportsExport() && (mMaskEveryone & PERM_EXPORT))));
}
if(requester.isNull())
{
// ...system making request

View File

@@ -40,6 +40,23 @@ extern void mask_to_string(U32 mask, char* str);
extern std::string mask_to_string(U32 mask);
template<class T> class LLMetaClassT;
// Interface of LFSimFeatureHandler.
class LFSimFeatureHandlerInterface
{
private:
// LFSimFeatureHandler is a singleton.
static LFSimFeatureHandlerInterface* sInstance;
protected:
LFSimFeatureHandlerInterface(void) { sInstance = this; }
virtual ~LFSimFeatureHandlerInterface() { }
public:
virtual bool simSupportsExport() const = 0;
static LFSimFeatureHandlerInterface* ifInstance(void) { return sInstance; }
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPermissions
//
@@ -274,6 +291,7 @@ public:
inline bool allowModifyBy(const LLUUID &agent_id, const LLUUID& group) const;
inline bool allowCopyBy(const LLUUID& agent_id, const LLUUID& group) const;
inline bool allowMoveBy(const LLUUID &agent_id, const LLUUID &group) const;
inline bool allowExportBy(const LLUUID &agent_id) const; // Singu extension.
// This somewhat specialized function is meant for testing if the
// current owner is allowed to transfer to the specified agent id.
@@ -373,6 +391,11 @@ bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const
}
}
bool LLPermissions::allowExportBy(const LLUUID& agent) const
{
return allowOperationBy(PERM_EXPORT, agent);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLAggregatePermissions
//