diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-26 19:23:42 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-02-26 19:23:42 +0000 |
commit | 213ff5a4e0fa150d91c1a68fb56bb7cb605020d6 (patch) | |
tree | 2ac41641567265dee7ccb4c36c5a7873c6b8773d /indra | |
parent | 470c05b70808f0a51090c0f50847fe614bf041e9 (diff) |
EXT-5820 I can copy asset UUID from non-FULLPERM assets turning on admin mode.
If you're reading this message, this was reviewed by Soft, Nyx or Aura. :)
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llinventory/llpermissions.cpp | 2 | ||||
-rw-r--r-- | indra/llinventory/llpermissions.h | 32 | ||||
-rw-r--r-- | indra/newview/llagent.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llagent.h | 3 | ||||
-rw-r--r-- | indra/newview/llagentaccess.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llagentaccess.h | 1 | ||||
-rw-r--r-- | indra/newview/llinventorybridge.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llviewerinventory.h | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatarself.cpp | 10 |
10 files changed, 80 insertions, 38 deletions
diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index d2e5034734..9683252dc4 100644 --- a/indra/llinventory/llpermissions.cpp +++ b/indra/llinventory/llpermissions.cpp @@ -479,7 +479,7 @@ BOOL LLPermissions::setNextOwnerBits(const LLUUID& agent, const LLUUID& group, B return ownership; } -BOOL LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const +bool LLPermissions::allowOperationBy(PermissionBit op, const LLUUID& requester, const LLUUID& group) const { if(requester.isNull()) { diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index d5a0881c8f..fa20d5c214 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -149,7 +149,7 @@ public: const LLUUID& getGroup() const { return mGroup; } // return the agent_id of the last agent owner. Only returns - // LLUUID::null if there has never been a previous owner. + // LLUUID::null if there has never been a previous owner (*note: this is apparently not true, say for textures in inventory, it may return LLUUID::null even if there was a previous owner). const LLUUID& getLastOwner() const { return mLastOwner; } U32 getMaskBase() const { return mMaskBase; } @@ -272,18 +272,18 @@ public: // They also return true if the object isn't owned, or the // requesting agent is a system agent. See llpermissionsflags.h // for bits. - BOOL allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const; + bool allowOperationBy(PermissionBit op, const LLUUID& agent, const LLUUID& group = LLUUID::null) const; - inline BOOL allowModifyBy(const LLUUID &agent_id) const; - inline BOOL allowCopyBy(const LLUUID& agent_id) const; - inline BOOL allowMoveBy(const LLUUID& agent_id) const; - 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 allowModifyBy(const LLUUID &agent_id) const; + inline bool allowCopyBy(const LLUUID& agent_id) const; + inline bool allowMoveBy(const LLUUID& agent_id) const; + 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; // This somewhat specialized function is meant for testing if the // current owner is allowed to transfer to the specified agent id. - inline BOOL allowTransferTo(const LLUUID &agent_id) const; + inline bool allowTransferTo(const LLUUID &agent_id) const; // // DEPRECATED. @@ -336,38 +336,38 @@ public: }; // Inlines -BOOL LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const +bool LLPermissions::allowModifyBy(const LLUUID& agent, const LLUUID& group) const { return allowOperationBy(PERM_MODIFY, agent, group); } -BOOL LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const +bool LLPermissions::allowCopyBy(const LLUUID& agent, const LLUUID& group) const { return allowOperationBy(PERM_COPY, agent, group); } -BOOL LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const +bool LLPermissions::allowMoveBy(const LLUUID& agent, const LLUUID& group) const { return allowOperationBy(PERM_MOVE, agent, group); } -BOOL LLPermissions::allowModifyBy(const LLUUID& agent) const +bool LLPermissions::allowModifyBy(const LLUUID& agent) const { return allowOperationBy(PERM_MODIFY, agent, LLUUID::null); } -BOOL LLPermissions::allowCopyBy(const LLUUID& agent) const +bool LLPermissions::allowCopyBy(const LLUUID& agent) const { return allowOperationBy(PERM_COPY, agent, LLUUID::null); } -BOOL LLPermissions::allowMoveBy(const LLUUID& agent) const +bool LLPermissions::allowMoveBy(const LLUUID& agent) const { return allowOperationBy(PERM_MOVE, agent, LLUUID::null); } -BOOL LLPermissions::allowTransferTo(const LLUUID &agent_id) const +bool LLPermissions::allowTransferTo(const LLUUID &agent_id) const { if (mIsGroupOwned) { diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index afd9d7b3f9..1da7d450c9 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4839,11 +4839,16 @@ void LLAgent::onAnimStop(const LLUUID& id) } } -BOOL LLAgent::isGodlike() const +bool LLAgent::isGodlike() const { return mAgentAccess.isGodlike(); } +bool LLAgent::isGodlikeWithoutAdminMenuFakery() const +{ + return mAgentAccess.isGodlikeWithoutAdminMenuFakery(); +} + U8 LLAgent::getGodLevel() const { return mAgentAccess.getGodLevel(); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 1573fd7131..f2df1992e7 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -888,7 +888,8 @@ private: // God //-------------------------------------------------------------------- public: - BOOL isGodlike() const; + bool isGodlike() const; + bool isGodlikeWithoutAdminMenuFakery() const; U8 getGodLevel() const; void setAdminOverride(BOOL b); void setGodLevel(U8 god_level); diff --git a/indra/newview/llagentaccess.cpp b/indra/newview/llagentaccess.cpp index eb978eb6c1..915dabb935 100644 --- a/indra/newview/llagentaccess.cpp +++ b/indra/newview/llagentaccess.cpp @@ -69,12 +69,21 @@ bool LLAgentAccess::isGodlike() const #endif } +bool LLAgentAccess::isGodlikeWithoutAdminMenuFakery() const +{ +#ifdef HACKED_GODLIKE_VIEWER + return true; +#else + return mGodLevel > GOD_NOT; +#endif +} + U8 LLAgentAccess::getGodLevel() const { #ifdef HACKED_GODLIKE_VIEWER return GOD_MAINTENANCE; #else - if(mAdminOverride) return GOD_FULL; + if(mAdminOverride) return GOD_FULL; // :( return mGodLevel; #endif } diff --git a/indra/newview/llagentaccess.h b/indra/newview/llagentaccess.h index 93d2f0a371..49da5f44cc 100644 --- a/indra/newview/llagentaccess.h +++ b/indra/newview/llagentaccess.h @@ -48,6 +48,7 @@ public: void setGodLevel(U8 god_level); bool isGodlike() const; + bool isGodlikeWithoutAdminMenuFakery() const; U8 getGodLevel() const; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index d0513c35ce..c4cf76fde1 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1065,9 +1065,9 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, else if ("copy_uuid" == action) { // Single item only - LLInventoryItem* item = model->getItem(mUUID); + LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem()); if(!item) return; - LLUUID asset_id = item->getAssetUUID(); + LLUUID asset_id = item->getProtectedAssetUUID(); std::string buffer; asset_id.toString(buffer); @@ -1107,7 +1107,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, void LLItemBridge::selectItem() { - LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); + LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem()); if(item && !item->isComplete()) { item->fetchFromServer(); @@ -1116,7 +1116,7 @@ void LLItemBridge::selectItem() void LLItemBridge::restoreItem() { - LLViewerInventoryItem* item = (LLViewerInventoryItem*)getItem(); + LLViewerInventoryItem* item = static_cast<LLViewerInventoryItem*>(getItem()); if(item) { LLInventoryModel* model = getInventoryModel(); @@ -1131,7 +1131,7 @@ void LLItemBridge::restoreToWorld() //Similar functionality to the drag and drop rez logic bool remove_from_inventory = false; - LLViewerInventoryItem* itemp = (LLViewerInventoryItem*)getItem(); + LLViewerInventoryItem* itemp = static_cast<LLViewerInventoryItem*>(getItem()); if (itemp) { LLMessageSystem* msg = gMessageSystem; @@ -1424,11 +1424,7 @@ BOOL LLItemBridge::isItemPermissive() const LLViewerInventoryItem* item = getItem(); if(item) { - U32 mask = item->getPermissions().getMaskBase(); - if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - return TRUE; - } + return item->getIsFullPerm(); } return FALSE; } diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index b69eaa4853..f02e854db6 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -1165,6 +1165,40 @@ const LLUUID& LLViewerInventoryItem::getAssetUUID() const return LLInventoryItem::getAssetUUID(); } +const LLUUID& LLViewerInventoryItem::getProtectedAssetUUID() const +{ + if (const LLViewerInventoryItem *linked_item = getLinkedItem()) + { + return linked_item->getProtectedAssetUUID(); + } + + // check for conditions under which we may return a visible UUID to the user + bool item_is_fullperm = getIsFullPerm(); + bool agent_is_godlike = gAgent.isGodlikeWithoutAdminMenuFakery(); + if (item_is_fullperm || agent_is_godlike) + { + return LLInventoryItem::getAssetUUID(); + } + + return LLUUID::null; +} + +const bool LLViewerInventoryItem::getIsFullPerm() const +{ + LLPermissions item_permissions = getPermissions(); + + // modify-ok & copy-ok & transfer-ok + return ( item_permissions.allowOperationBy(PERM_MODIFY, + gAgent.getID(), + gAgent.getGroupID()) && + item_permissions.allowOperationBy(PERM_COPY, + gAgent.getID(), + gAgent.getGroupID()) && + item_permissions.allowOperationBy(PERM_TRANSFER, + gAgent.getID(), + gAgent.getGroupID()) ); +} + const std::string& LLViewerInventoryItem::getName() const { if (const LLViewerInventoryItem *linked_item = getLinkedItem()) diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h index c24f76c87a..3d3f80b9b5 100644 --- a/indra/newview/llviewerinventory.h +++ b/indra/newview/llviewerinventory.h @@ -63,10 +63,12 @@ protected: public: virtual LLAssetType::EType getType() const; virtual const LLUUID& getAssetUUID() const; + virtual const LLUUID& getProtectedAssetUUID() const; // returns LLUUID::null if current agent does not have permission to expose this asset's UUID to the user virtual const std::string& getName() const; virtual S32 getSortField() const; virtual void setSortField(S32 sortField); virtual const LLPermissions& getPermissions() const; + virtual const bool getIsFullPerm() const; // 'fullperm' in the popular sense: modify-ok & copy-ok & transfer-ok, no special god rules applied virtual const LLUUID& getCreatorUUID() const; virtual const std::string& getDescription() const; virtual const LLSaleInfo& getSaleInfo() const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 4347dec805..4e90b63cc3 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1761,14 +1761,8 @@ BOOL LLVOAvatarSelf::canGrabLocalTexture(ETextureIndex type, U32 index) const // search for full permissions version for (S32 i = 0; i < items.count(); i++) { - LLInventoryItem* itemp = items[i]; - LLPermissions item_permissions = itemp->getPermissions(); - if ( item_permissions.allowOperationBy( - PERM_MODIFY, gAgent.getID(), gAgent.getGroupID()) && - item_permissions.allowOperationBy( - PERM_COPY, gAgent.getID(), gAgent.getGroupID()) && - item_permissions.allowOperationBy( - PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()) ) + LLViewerInventoryItem* itemp = items[i]; + if (itemp->getIsFullPerm()) { can_grab = TRUE; break; |