From 4ffa06ae07a1fde8ed0e0ccdb5d072ea05607c34 Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Thu, 2 Feb 2012 09:52:34 +0100 Subject: [PATCH] More reliable preview perm checks --- indra/newview/llpreviewanim.cpp | 19 ++----------------- indra/newview/llpreviewsound.cpp | 9 ++++++++- indra/newview/llpreviewsound.h | 3 ++- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 6a9033866..6ee6445d0 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -73,29 +73,14 @@ LLPreviewAnim::LLPreviewAnim(const std::string& name, const LLRect& rect, const translate(rect.mLeft - curRect.mLeft, rect.mTop - curRect.mTop); } + mIsCopyable = false; // preload the animation if(item) { gAgentAvatarp->createMotion(item->getAssetUUID()); const LLPermissions& perm = item->getPermissions(); - U32 mask = PERM_NONE; - if(perm.getOwner() == gAgent.getID()) - { - mask = perm.getMaskBase(); - } - else if(gAgent.isInGroup(perm.getGroup())) - { - mask = perm.getMaskGroup(); - } - else - { - mask = perm.getMaskEveryone(); - } - if((mask & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) - { - mIsCopyable = true; - } + mIsCopyable = (perm.getCreator() == gAgent.getID()); } switch ( activate ) diff --git a/indra/newview/llpreviewsound.cpp b/indra/newview/llpreviewsound.cpp index a537990fd..1f2850d37 100644 --- a/indra/newview/llpreviewsound.cpp +++ b/indra/newview/llpreviewsound.cpp @@ -78,6 +78,13 @@ LLPreviewSound::LLPreviewSound(const std::string& name, const LLRect& rect, cons button->setSoundFlags(LLView::SILENT); const LLInventoryItem* item = getItem(); + + mIsCopyable = false; + if(item) + { + const LLPermissions& perm = item->getPermissions(); + mIsCopyable = (perm.getCreator() == gAgent.getID()); + } childSetCommitCallback("desc", LLPreview::onText, this); childSetText("desc", item->getDescription()); @@ -293,7 +300,7 @@ void LLPreviewSound::copyUUID( void *userdata ) // virtual BOOL LLPreviewSound::canSaveAs() const { - return TRUE; + return mIsCopyable; } // virtual diff --git a/indra/newview/llpreviewsound.h b/indra/newview/llpreviewsound.h index bd8b9c0f0..6d8928c97 100644 --- a/indra/newview/llpreviewsound.h +++ b/indra/newview/llpreviewsound.h @@ -71,7 +71,8 @@ protected: virtual void saveAs(); virtual LLUUID getItemID(); // - +private: + bool mIsCopyable; }; #endif // LL_LLPREVIEWSOUND_H