More reliable preview perm checks

This commit is contained in:
Siana Gearz
2012-02-02 09:52:34 +01:00
parent f68211d83e
commit 4ffa06ae07
3 changed files with 12 additions and 19 deletions

View File

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

View File

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

View File

@@ -71,7 +71,8 @@ protected:
virtual void saveAs();
virtual LLUUID getItemID();
// </edit>
private:
bool mIsCopyable;
};
#endif // LL_LLPREVIEWSOUND_H