From fbb4e5fb0f7bba935ec9d0d466be12a346a6b149 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 8 Jun 2012 13:49:02 -0400 Subject: STORM-68 As a Builder, I want that ability to set default permissions on creation of objects, clothing, scripts, notecards, etc. First pass at implementation, debuggins lines still need to be removed and there is one known bug to be resolved. --- indra/newview/llfloaterperms.cpp | 153 +++++++++++++++++++++++++-------------- 1 file changed, 98 insertions(+), 55 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 80b55c3cbb..3853dd0ef6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -37,96 +37,139 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) : LLFloater(seed) { - mCommitCallbackRegistrar.add("Perms.Copy", boost::bind(&LLFloaterPerms::onCommitCopy, this)); - mCommitCallbackRegistrar.add("Perms.OK", boost::bind(&LLFloaterPerms::onClickOK, this)); - mCommitCallbackRegistrar.add("Perms.Cancel", boost::bind(&LLFloaterPerms::onClickCancel, this)); - } BOOL LLFloaterPerms::postBuild() { - mCloseSignal.connect(boost::bind(&LLFloaterPerms::cancel, this)); - - refresh(); - - return TRUE; + return true; } -void LLFloaterPerms::onClickOK() -{ - ok(); - closeFloater(); +//static +U32 LLFloaterPerms::getGroupPerms(std::string prefix) +{ + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; } -void LLFloaterPerms::onClickCancel() +//static +U32 LLFloaterPerms::getEveryonePerms(std::string prefix) { - cancel(); - closeFloater(); + return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; } -void LLFloaterPerms::onCommitCopy() +//static +U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { - // Implements fair use - BOOL copyable = gSavedSettings.getBOOL("NextOwnerCopy"); - if(!copyable) + U32 flags = PERM_MOVE; + if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { - gSavedSettings.setBOOL("NextOwnerTransfer", TRUE); + flags |= PERM_COPY; } - LLCheckBoxCtrl* xfer = getChild("next_owner_transfer"); - xfer->setEnabled(copyable); + if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; } -void LLFloaterPerms::ok() +//static +U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) { - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. + // Sets bits for permissions that are off + U32 flags = PERM_MOVE; + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + { + flags |= PERM_COPY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + { + flags |= PERM_MODIFY; + } + if ( !gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) + { + flags |= PERM_TRANSFER; + } + return flags; } -void LLFloaterPerms::cancel() +LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) +: LLFloater(seed) { - gSavedSettings.setBOOL("ShareWithGroup", mShareWithGroup); - gSavedSettings.setBOOL("EveryoneCopy", mEveryoneCopy); - gSavedSettings.setBOOL("NextOwnerCopy", mNextOwnerCopy); - gSavedSettings.setBOOL("NextOwnerModify", mNextOwnerModify); - gSavedSettings.setBOOL("NextOwnerTransfer", mNextOwnerTransfer); + mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); + mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); + mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } -void LLFloaterPerms::refresh() +BOOL LLFloaterPermsDefault::postBuild() { - mShareWithGroup = gSavedSettings.getBOOL("ShareWithGroup"); - mEveryoneCopy = gSavedSettings.getBOOL("EveryoneCopy"); - mNextOwnerCopy = gSavedSettings.getBOOL("NextOwnerCopy"); - mNextOwnerModify = gSavedSettings.getBOOL("NextOwnerModify"); - mNextOwnerTransfer = gSavedSettings.getBOOL("NextOwnerTransfer"); + mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); + + category_names[CAT_OBJECTS] = "Objects"; + category_names[CAT_UPLOADS] = "Uploads"; + category_names[CAT_SCRIPTS] = "Scripts"; + category_names[CAT_NOTECARDS] = "Notecards"; + category_names[CAT_GESTURES] = "Gestures"; + category_names[CAT_WEARABLES] = "Wearables"; + + refresh(); + + return true; } -//static -U32 LLFloaterPerms::getGroupPerms(std::string prefix) -{ - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; +void LLFloaterPermsDefault::onClickOK() +{ + ok(); + closeFloater(); } -//static -U32 LLFloaterPerms::getEveryonePerms(std::string prefix) +void LLFloaterPermsDefault::onClickCancel() { - return gSavedSettings.getBOOL(prefix+"EveryoneCopy") ? PERM_COPY : PERM_NONE; + cancel(); + closeFloater(); } -//static -U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) +void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) { - U32 flags = PERM_MOVE; - if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) + // Implements fair use + std::string prefix = user_data.asString(); + + BOOL copyable = gSavedSettings.getBOOL(prefix+"NextOwnerCopy"); + if(!copyable) { - flags |= PERM_COPY; + gSavedSettings.setBOOL(prefix+"NextOwnerTransfer", TRUE); } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerModify") ) + LLCheckBoxCtrl* xfer = getChild(prefix+"_transfer"); + xfer->setEnabled(copyable); +} + +void LLFloaterPermsDefault::ok() +{ + refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. +} + +void LLFloaterPermsDefault::cancel() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_MODIFY; + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } - if ( gSavedSettings.getBOOL(prefix+"NextOwnerTransfer") ) +} + +void LLFloaterPermsDefault::refresh() +{ + for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - flags |= PERM_TRANSFER; + mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer"); } - return flags; } - -- cgit v1.2.3 From d61a5f743c5d3bde0146b036508485bfdc9c3cb5 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 9 Jun 2012 10:05:54 -0400 Subject: STORM-68 Removed debugging PERM_ALL that was causing upload trouble and removed 3 obsolete debug settings --- indra/newview/llfloaterperms.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 3853dd0ef6..ede17d937e 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -59,6 +59,8 @@ U32 LLFloaterPerms::getEveryonePerms(std::string prefix) //static U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { +llwarns << "DBG prefix=" << prefix << llendl; + U32 flags = PERM_MOVE; if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { -- cgit v1.2.3 From b6df9b6d56108bcf4b3e8dfd875ef76a9b6f448b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sat, 9 Jun 2012 11:43:39 -0400 Subject: STORM-68 Fiddling with debugging for New Script case --- indra/newview/llfloaterperms.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index ede17d937e..3853dd0ef6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -59,8 +59,6 @@ U32 LLFloaterPerms::getEveryonePerms(std::string prefix) //static U32 LLFloaterPerms::getNextOwnerPerms(std::string prefix) { -llwarns << "DBG prefix=" << prefix << llendl; - U32 flags = PERM_MOVE; if ( gSavedSettings.getBOOL(prefix+"NextOwnerCopy") ) { -- cgit v1.2.3 From 052dc3982056d822a523394954c277d9eb7c7ab9 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 12 Jun 2012 14:26:53 -0400 Subject: STORM-68 Fix for group perms not being defined correctly and fix for group and everyone perms failing to copy and paste --- indra/newview/llfloaterperms.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 3853dd0ef6..4e9acfc780 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -47,7 +47,7 @@ BOOL LLFloaterPerms::postBuild() //static U32 LLFloaterPerms::getGroupPerms(std::string prefix) { - return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY : PERM_NONE; + return gSavedSettings.getBOOL(prefix+"ShareWithGroup") ? PERM_COPY | PERM_MOVE | PERM_MODIFY : PERM_NONE; } //static -- cgit v1.2.3 From e988fffbca2199156ed656a091409394246f929d Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 7 Nov 2013 16:27:38 -0500 Subject: STORM-68 Add initial support to use a capability for setting default object permissions on the server. --- indra/newview/llfloaterperms.cpp | 45 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 4e9acfc780..c167c03c30 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -32,7 +32,9 @@ #include "llviewerwindow.h" #include "lluictrlfactory.h" #include "llpermissions.h" - +#include "llagent.h" +#include "llviewerregion.h" +#include "llnotificationsutil.h" LLFloaterPerms::LLFloaterPerms(const LLSD& seed) : LLFloater(seed) @@ -96,7 +98,7 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) } LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) -: LLFloater(seed) + : LLFloater(seed) { mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); @@ -145,9 +147,46 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) xfer->setEnabled(copyable); } +class LLFloaterPermsResponder : public LLHTTPClient::Responder +{ +public: + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} + + void error(U32 status, const std::string& reason) + { + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } + void result(const LLSD& content) + { + LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL; + } +}; + +void LLFloaterPermsDefault::updateCap() +{ + std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); + + if(!object_url.empty()) + { + LLSD report = LLSD::emptyMap(); + report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms("Objects"); + report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms("Objects"); + report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms("Objects"); + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); + } +} + void LLFloaterPermsDefault::ok() { - refresh(); // Changes were already applied to saved settings. Refreshing internal values makes it official. +// Changes were already applied automatically to saved settings. +// Refreshing internal values makes it official. + refresh(); + +// We know some setting has changed but not which one. Just in case it was a setting for +// object permissions tell the server what the values are. + updateCap(); } void LLFloaterPermsDefault::cancel() -- cgit v1.2.3 From 56b1b35a18c21f6dad4147df35ba4594f31b67e3 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 11 Nov 2013 13:21:12 -0500 Subject: STORM-68 Send default permissions to simulator just once after logging in --- indra/newview/llfloaterperms.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index c167c03c30..f5a9bc7bb5 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -97,6 +97,8 @@ U32 LLFloaterPerms::getNextOwnerPermsInverted(std::string prefix) return flags; } +static bool mCapSent = false; + LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { @@ -160,12 +162,18 @@ public: } void result(const LLSD& content) { - LL_INFOS("FloaterPermsResponder") << "Set new values" << LL_ENDL; + LLFloaterPermsDefault::setCapSent(true); + LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap() +void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { + if(!alwaysUpdate && mCapSent) + { + return; + } + std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) @@ -178,6 +186,11 @@ void LLFloaterPermsDefault::updateCap() } } +void LLFloaterPermsDefault::setCapSent(bool cap_sent) +{ + mCapSent = cap_sent; +} + void LLFloaterPermsDefault::ok() { // Changes were already applied automatically to saved settings. @@ -186,7 +199,7 @@ void LLFloaterPermsDefault::ok() // We know some setting has changed but not which one. Just in case it was a setting for // object permissions tell the server what the values are. - updateCap(); + updateCap(true); } void LLFloaterPermsDefault::cancel() -- cgit v1.2.3 From b7edc965bc77ab21e9a1e3f6b424299a50053529 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 19 Nov 2013 16:32:41 -0500 Subject: STORM-68 Place initial call to send cap in new, better location. Make processing of debug setting names a little more elegant. --- indra/newview/llfloaterperms.cpp | 50 ++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 22 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index f5a9bc7bb5..dc4969f5e6 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -1,7 +1,7 @@ /** * @file llfloaterperms.cpp * @brief Asset creation permission preferences. - * @author Coco + * @author Jonathan Yap * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code @@ -43,7 +43,7 @@ LLFloaterPerms::LLFloaterPerms(const LLSD& seed) BOOL LLFloaterPerms::postBuild() { - return true; + return TRUE; } //static @@ -107,17 +107,23 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } + +// String equivalents of enum Categories - initialization order must match enum order! +const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = +{ + "Objects", + "Uploads", + "Scripts", + "Notecards", + "Gestures", + "Wearables" +}; + + BOOL LLFloaterPermsDefault::postBuild() { mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); - category_names[CAT_OBJECTS] = "Objects"; - category_names[CAT_UPLOADS] = "Uploads"; - category_names[CAT_SCRIPTS] = "Scripts"; - category_names[CAT_NOTECARDS] = "Notecards"; - category_names[CAT_GESTURES] = "Gestures"; - category_names[CAT_WEARABLES] = "Wearables"; - refresh(); return true; @@ -179,9 +185,9 @@ void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) if(!object_url.empty()) { LLSD report = LLSD::emptyMap(); - report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms("Objects"); - report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms("Objects"); - report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms("Objects"); + report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -206,11 +212,11 @@ void LLFloaterPermsDefault::cancel() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerModify", mNextOwnerModify[iter]); - gSavedSettings.setBOOL(category_names[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); - gSavedSettings.setBOOL(category_names[iter]+"ShareWithGroup", mShareWithGroup[iter]); - gSavedSettings.setBOOL(category_names[iter]+"EveryoneCopy", mEveryoneCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerCopy", mNextOwnerCopy[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerModify", mNextOwnerModify[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"NextOwnerTransfer", mNextOwnerTransfer[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"ShareWithGroup", mShareWithGroup[iter]); + gSavedSettings.setBOOL(sCategoryNames[iter]+"EveryoneCopy", mEveryoneCopy[iter]); } } @@ -218,10 +224,10 @@ void LLFloaterPermsDefault::refresh() { for (U32 iter = CAT_OBJECTS; iter < CAT_LAST; iter++) { - mShareWithGroup[iter] = gSavedSettings.getBOOL(category_names[iter]+"ShareWithGroup"); - mEveryoneCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"EveryoneCopy"); - mNextOwnerCopy[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerCopy"); - mNextOwnerModify[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerModify"); - mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(category_names[iter]+"NextOwnerTransfer"); + mShareWithGroup[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"ShareWithGroup"); + mEveryoneCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"EveryoneCopy"); + mNextOwnerCopy[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerCopy"); + mNextOwnerModify[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerModify"); + mNextOwnerTransfer[iter] = gSavedSettings.getBOOL(sCategoryNames[iter]+"NextOwnerTransfer"); } } -- cgit v1.2.3 From 176901422f0122dad8d1e4e423d0bc19e9e4ad8a Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 20 Nov 2013 10:21:41 -0500 Subject: STORM-68 Reapply changes to inventory processing lost in the merge. Move call to updateCap back to where it was. The place it was moved to was too early in the login sequence and was causing a crash. --- indra/newview/llfloaterperms.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index dc4969f5e6..4923420a3e 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -175,15 +175,18 @@ public: void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) { +llwarns << "DBG start" << llendl; if(!alwaysUpdate && mCapSent) { return; } +llwarns << "DBG getRegion" << llendl; std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); if(!object_url.empty()) { +llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); -- cgit v1.2.3 From 9e8a7869ce4e51d5caeb46118972509a0110f766 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Tue, 3 Dec 2013 10:44:44 -0500 Subject: STORM-68 Change CAP name to AgentPreferences and adjust LLSD format to mesh with server changes --- indra/newview/llfloaterperms.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 4923420a3e..b03a4e9013 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -182,15 +182,18 @@ llwarns << "DBG start" << llendl; } llwarns << "DBG getRegion" << llendl; - std::string object_url = gAgent.getRegion()->getCapability("DefaultObjectPermissions"); + std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) { -llwarns << "DBG post" << llendl; LLSD report = LLSD::emptyMap(); - report["Group"] = (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); - report["Everyone"] = (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); - report["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Group"] = + (LLSD::Integer)LLFloaterPerms::getGroupPerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["Everyone"] = + (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); + report["default_object_perm_masks"]["NextOwner"] = + (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); +llwarns << "DBG post:" << report << llendl; LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } -- cgit v1.2.3 From 944840c8b164aa0f254d3d0eb38292a49b0dcae6 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Dec 2013 13:26:43 -0500 Subject: STORM-68 Code cleanup/function renaming --- indra/newview/llfloaterperms.cpp | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index b03a4e9013..28fb76160a 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -158,30 +158,42 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data) class LLFloaterPermsResponder : public LLHTTPClient::Responder { public: - LLFloaterPermsResponder(): LLHTTPClient::Responder() {} + LLFloaterPermsResponder(): LLHTTPClient::Responder() {} +private: + std::string mPreviousReason; void error(U32 status, const std::string& reason) { - LLSD args; - args["REASON"] = reason; - LLNotificationsUtil::add("DefaultObjectPermissions", args); +llwarns << "DBG !" << mPreviousReason << "!" << llendl; + // Do not display the same error more than once in a row + if (reason != mPreviousReason) + { + mPreviousReason = reason; + LLSD args; + args["REASON"] = reason; + LLNotificationsUtil::add("DefaultObjectPermissions", args); + } } void result(const LLSD& content) { + // Since we have had a successful POST call be sure to display the next error message + // even if it is the same as a previous one. + mPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; -void LLFloaterPermsDefault::updateCap(bool alwaysUpdate) +void LLFloaterPermsDefault::sendInitialPerms() { -llwarns << "DBG start" << llendl; - if(!alwaysUpdate && mCapSent) + if(!mCapSent) { - return; + updateCap(); } +} -llwarns << "DBG getRegion" << llendl; +void LLFloaterPermsDefault::updateCap() +{ std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences"); if(!object_url.empty()) @@ -193,7 +205,7 @@ llwarns << "DBG getRegion" << llendl; (LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]); report["default_object_perm_masks"]["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); -llwarns << "DBG post:" << report << llendl; + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } } @@ -211,7 +223,7 @@ void LLFloaterPermsDefault::ok() // We know some setting has changed but not which one. Just in case it was a setting for // object permissions tell the server what the values are. - updateCap(true); + updateCap(); } void LLFloaterPermsDefault::cancel() -- cgit v1.2.3 From 096530b7265223ade02a86977973b7e5df12e93c Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 5 Dec 2013 14:42:14 -0500 Subject: STORM-68 Get display error message once to work properly --- indra/newview/llfloaterperms.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 28fb76160a..b4ea34d5f1 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -160,15 +160,15 @@ class LLFloaterPermsResponder : public LLHTTPClient::Responder public: LLFloaterPermsResponder(): LLHTTPClient::Responder() {} private: - std::string mPreviousReason; + static std::string sPreviousReason; void error(U32 status, const std::string& reason) { -llwarns << "DBG !" << mPreviousReason << "!" << llendl; +llwarns << "DBG !" << sPreviousReason << "!" << llendl; // Do not display the same error more than once in a row - if (reason != mPreviousReason) + if (reason != sPreviousReason) { - mPreviousReason = reason; + sPreviousReason = reason; LLSD args; args["REASON"] = reason; LLNotificationsUtil::add("DefaultObjectPermissions", args); @@ -178,12 +178,14 @@ llwarns << "DBG !" << mPreviousReason << "!" << llendl; { // Since we have had a successful POST call be sure to display the next error message // even if it is the same as a previous one. - mPreviousReason = ""; + sPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; } }; + std::string LLFloaterPermsResponder::sPreviousReason; + void LLFloaterPermsDefault::sendInitialPerms() { if(!mCapSent) -- cgit v1.2.3 From 2d701456a07d37a520f436f9e83b1008e492f232 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 12 Dec 2013 08:51:15 -0500 Subject: STORM-68 Fix bug for new gestures, notecards, and scripts where a copied item did not preserve its default permissions. Add apply button. --- indra/newview/llfloaterperms.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index b4ea34d5f1..0178c0b4f1 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -103,6 +103,7 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); + mCommitCallbackRegistrar.add("PermsDefault.Apply", boost::bind(&LLFloaterPermsDefault::onClickApply, this)); mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } @@ -129,9 +130,14 @@ BOOL LLFloaterPermsDefault::postBuild() return true; } +void LLFloaterPermsDefault::onClickApply() +{ + apply(); +} + void LLFloaterPermsDefault::onClickOK() { - ok(); + apply(); closeFloater(); } @@ -164,7 +170,6 @@ private: void error(U32 status, const std::string& reason) { -llwarns << "DBG !" << sPreviousReason << "!" << llendl; // Do not display the same error more than once in a row if (reason != sPreviousReason) { @@ -217,7 +222,7 @@ void LLFloaterPermsDefault::setCapSent(bool cap_sent) mCapSent = cap_sent; } -void LLFloaterPermsDefault::ok() +void LLFloaterPermsDefault::apply() { // Changes were already applied automatically to saved settings. // Refreshing internal values makes it official. -- cgit v1.2.3 From c804c6b69e9de586225b9cc84c6e6adafba83f8f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 12 Dec 2013 14:11:28 -0500 Subject: STORM-68 Remove Apply button Add menu entry to Build->Options->Set Default Permissions... Disable Preferences->Advanced->Default Creation Permissions button when on login screen Add code for a one-time conversion from the old upload settings XML cleanup --- indra/newview/llfloaterperms.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 0178c0b4f1..cc1ff54cb4 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -103,7 +103,6 @@ LLFloaterPermsDefault::LLFloaterPermsDefault(const LLSD& seed) : LLFloater(seed) { mCommitCallbackRegistrar.add("PermsDefault.Copy", boost::bind(&LLFloaterPermsDefault::onCommitCopy, this, _2)); - mCommitCallbackRegistrar.add("PermsDefault.Apply", boost::bind(&LLFloaterPermsDefault::onClickApply, this)); mCommitCallbackRegistrar.add("PermsDefault.OK", boost::bind(&LLFloaterPermsDefault::onClickOK, this)); mCommitCallbackRegistrar.add("PermsDefault.Cancel", boost::bind(&LLFloaterPermsDefault::onClickCancel, this)); } @@ -123,6 +122,16 @@ const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = BOOL LLFloaterPermsDefault::postBuild() { + if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted")) + { + gSavedSettings.setBOOL("UploadsEveryoneCopy", gSavedSettings.getBOOL("EveryoneCopy")); + gSavedSettings.setBOOL("UploadsNextOwnerCopy", gSavedSettings.getBOOL("NextOwnerCopy")); + gSavedSettings.setBOOL("UploadsNextOwnerModify", gSavedSettings.getBOOL("NextOwnerModify")); + gSavedSettings.setBOOL("UploadsNextOwnerTransfer", gSavedSettings.getBOOL("NextOwnerTransfer")); + gSavedSettings.setBOOL("UploadsShareWithGroup", gSavedSettings.getBOOL("ShareWithGroup")); + gSavedSettings.setBOOL("DefaultUploadPermissionsConverted", true); + } + mCloseSignal.connect(boost::bind(&LLFloaterPermsDefault::cancel, this)); refresh(); @@ -130,14 +139,9 @@ BOOL LLFloaterPermsDefault::postBuild() return true; } -void LLFloaterPermsDefault::onClickApply() -{ - apply(); -} - void LLFloaterPermsDefault::onClickOK() { - apply(); + ok(); closeFloater(); } @@ -222,7 +226,7 @@ void LLFloaterPermsDefault::setCapSent(bool cap_sent) mCapSent = cap_sent; } -void LLFloaterPermsDefault::apply() +void LLFloaterPermsDefault::ok() { // Changes were already applied automatically to saved settings. // Refreshing internal values makes it official. -- cgit v1.2.3 From a4173dc81a21dfac6a8b57e8e1c354b9a37fe5ba Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 8 Jan 2014 09:30:30 -0500 Subject: STORM-68 Remove obsolete note. Refactor a few blocks of code to not have early returns --- indra/newview/llfloaterperms.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llfloaterperms.cpp') diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index cc1ff54cb4..0880a5f35a 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -119,7 +119,6 @@ const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = "Wearables" }; - BOOL LLFloaterPermsDefault::postBuild() { if(!gSavedSettings.getBOOL("DefaultUploadPermissionsConverted")) -- cgit v1.2.3