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. :)
master
Tofu Linden 2010-02-26 19:23:42 +00:00
parent 470c05b708
commit 213ff5a4e0
10 changed files with 80 additions and 38 deletions

View File

@ -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())
{

View File

@ -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)
{

View File

@ -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();

View File

@ -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);

View File

@ -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
}

View File

@ -48,6 +48,7 @@ public:
void setGodLevel(U8 god_level);
bool isGodlike() const;
bool isGodlikeWithoutAdminMenuFakery() const;
U8 getGodLevel() const;

View File

@ -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;
}

View File

@ -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())

View File

@ -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;

View File

@ -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;