From c67563dfe4b713e0f0534b5839af527ab416d90e Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 16 Feb 2013 04:05:58 -0500 Subject: [PATCH] Bits and pieces Disable next owner perms boxes when PERM_EXPORT Added checks disabling the export toggle conditionally. All cases covered except textures, couldn't figure that one out... Mind the TODO's in the diff.. --- indra/newview/llfloaterproperties.cpp | 12 +++--- indra/newview/llpanelpermissions.cpp | 57 ++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 4d313b3c9..d8438a355 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -524,7 +524,8 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("CheckEveryoneCopy",false); childSetEnabled("CheckEveryoneMove",false); } - childSetEnabled("CheckExport", gAgent.getID() == item->getCreatorUUID()); + childSetEnabled("CheckExport", /*simSupportsExport() &&*/ item->getType() != LLAssetType::AT_OBJECT && gAgent.getID() == item->getCreatorUUID() //TODO: Implement Simulator Feature for Export. + && !(base_mask & PERM_EXPORT && owner_mask & PERM_EXPORT && next_owner_mask & PERM_ITEM_UNRESTRICTED)); // Set values. BOOL is_group_copy = (group_mask & PERM_COPY) ? TRUE : FALSE; @@ -552,10 +553,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item) childSetEnabled("SaleLabel",is_complete); childSetEnabled("CheckPurchase",is_complete); - childSetEnabled("NextOwnerLabel",TRUE); - childSetEnabled("CheckNextOwnerModify",base_mask & PERM_MODIFY); - childSetEnabled("CheckNextOwnerCopy",base_mask & PERM_COPY); - childSetEnabled("CheckNextOwnerTransfer",next_owner_mask & PERM_COPY); + bool no_export = !(everyone_mask & PERM_EXPORT); // Next owner perms can't be changed if set + childSetEnabled("NextOwnerLabel", no_export); + childSetEnabled("CheckNextOwnerModify", no_export && base_mask & PERM_MODIFY); + childSetEnabled("CheckNextOwnerCopy", no_export && base_mask & PERM_COPY); + childSetEnabled("CheckNextOwnerTransfer", no_export && next_owner_mask & PERM_COPY); childSetEnabled("RadioSaleType",is_complete && is_for_sale); childSetEnabled("TextPrice",is_complete && is_for_sale); diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp index 86c874b2a..4815017da 100644 --- a/indra/newview/llpanelpermissions.cpp +++ b/indra/newview/llpanelpermissions.cpp @@ -706,7 +706,53 @@ void LLPanelPermissions::refresh() childSetEnabled("checkbox allow everyone move", FALSE); childSetEnabled("checkbox allow everyone copy", FALSE); } - childSetEnabled("checkbox allow export", mCreatorID == gAgent.getID()); + + // Is this user allowed to toggle export on this object? + { + bool can_export = self_owned && mCreatorID == mOwnerID; + if (can_export) + { + if (can_export = (base_mask_on & PERM_EXPORT && owner_mask_on & PERM_EXPORT && everyone_mask_on & PERM_ITEM_UNRESTRICTED)) //Base & Owner must have EXPORT, Everyone must be UNRESTRICTED + { + //if (can_export = simSupportsExport()) //TODO: Implement Simulator Feature for Export. + { + LLInventoryObject::object_list_t objects; + objectp->getInventoryContents(objects); + for (LLInventoryObject::object_list_t::iterator i = objects.begin(); i != objects.end(); ++i) //The object's inventory must have EXPORT. + { + LLViewerInventoryItem* item = static_cast(i->get()); //getInventoryContents() filters out categories, static_cast. + //if (item->getCreatorUUID() == gAgent.getID()) continue; //TODO: Find out if we can bypass the perms check if the creator is the agent. + const LLPermissions& perm = item->getPermissions(); + if (!(perm.getMaskBase() & PERM_EXPORT && perm.getMaskOwner() & PERM_EXPORT && perm.getMaskEveryone() & PERM_EXPORT)) + { + can_export = false; + break; + } + } + + /*if (can_export) // Can the textures be exported? + { + //TODO: iterate through faces... I can't quite figure this out, so I've left in some placeholders. + LLTexture::texture_list_t textures = objectp->getTextures(); //NOTE: Fake code + for(LLTexture::texture_list_t::iterator i = textures.begin(); i != textures.end(); ++i) //NOTE: Fake code + { + LLTexture* texture = i->get(); //NOTE: Fake code + //TODO: Do they were they uploaded by the user? + if (texture->getCreatorID == gAgent.getID()) continue; //NOTE: Fake code + //TODO: Or else have they not PERM_EXPORT? + const LLPermissions& perm = texture->getPermissions(); //NOTE: Fake code + if (!(perm.getMaskBase & PERM_EXPORT)) + { + can_export = false; + break; + } + } + }*/ + } + } + } + childSetEnabled("checkbox allow export", can_export); + } if (has_change_sale_ability && (owner_mask_on & PERM_TRANSFER)) { @@ -716,10 +762,11 @@ void LLPanelPermissions::refresh() childSetTentative("checkbox for sale", is_for_sale_mixed); childSetEnabled("sale type",num_for_sale && can_transfer && !is_sale_price_mixed); - childSetEnabled("Next owner can:", TRUE); - childSetEnabled("checkbox next owner can modify",base_mask_on & PERM_MODIFY); - childSetEnabled("checkbox next owner can copy",base_mask_on & PERM_COPY); - childSetEnabled("checkbox next owner can transfer",next_owner_mask_on & PERM_COPY); + bool no_export = everyone_mask_off & PERM_EXPORT; // Next owner perms can't be changed if set + childSetEnabled("Next owner can:", no_export); + childSetEnabled("checkbox next owner can modify", no_export && base_mask_on & PERM_MODIFY); + childSetEnabled("checkbox next owner can copy", no_export && base_mask_on & PERM_COPY); + childSetEnabled("checkbox next owner can transfer", no_export && next_owner_mask_on & PERM_COPY); } else {