diff options
Diffstat (limited to 'indra/newview')
-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 |
8 files changed, 63 insertions, 21 deletions
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 f8b5bfc718..131c6ac1a1 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1764,14 +1764,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; |