diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp index d2e503473401a6063679c4ea0dfff1ecac5040ed..9683252dc44e5aff21c99ddd9f5031570bd96521 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 d5a0881c8f2ab684ed52f526c3e29dc26c3154de..fa20d5c21454eaabd1e980f633cd8ace3142fedd 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 afd9d7b3f935d4e1bce121189873070a12629cbb..1da7d450c967b66712819b06b48f3236e4505a48 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 1573fd7131939a2bcda6acbb7358f55200916bf8..f2df1992e7e8c3b5fff1ae9ece087ebfe04e242d 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 eb978eb6c1a26cbc1867d295c0d52701e171620a..915dabb93540f1ba3dc53922d9a0c2a3b8e40e00 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 93d2f0a37154a22fe376aafd0e939181f2ef7e34..49da5f44ccad4dc33e3bf3f00c9d61649ede63c4 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 d0513c35ce33ef814583e508450056a1eec67cca..c4cf76fde1871f7db6bfae3aad03a2c6348f965d 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 b69eaa4853b36444563b769364d540c07a3cfdec..f02e854db6e20141b019a43b4fde75e65258d8e7 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 c24f76c87a13cf060b9643b2611163365618a924..3d3f80b9b5752fe3d2ecf9cf3eca0b9c5acdef1c 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 4347dec8054927ac4bf29a74db460fc958e0e4be..4e90b63cc3d987272ded9e7f5a0c5a8ab56ed649 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;