From 339a5449fc89700ee22c53ecd60adbed6faba1a5 Mon Sep 17 00:00:00 2001
From: maxim_productengine <mnikolenko@productengine.com>
Date: Fri, 21 Sep 2018 18:24:12 +0300
Subject: [PATCH] SL-9714 [EEP] Allow changing permissions of environment
 settings using the bulk perms floater

---
 indra/newview/app_settings/settings.xml           | 11 +++++++++++
 indra/newview/llfloaterbulkpermission.cpp         | 11 ++++++++++-
 indra/newview/llfloaterbulkpermission.h           |  1 +
 .../skins/default/xui/en/floater_bulk_perms.xml   | 15 ++++++++++++++-
 4 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 123197db3be..83afa0ed8cb 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1252,6 +1252,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>BulkChangeIncludeSettings</key>
+    <map>
+      <key>Comment</key>
+      <string>Bulk permission changes affect environment settings</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>BulkChangeEveryoneCopy</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index f2040bc7608..a1a06706bc6 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -75,6 +75,7 @@ BOOL LLFloaterBulkPermission::postBuild()
 	mBulkChangeIncludeScripts = gSavedSettings.getBOOL("BulkChangeIncludeScripts");
 	mBulkChangeIncludeSounds = gSavedSettings.getBOOL("BulkChangeIncludeSounds");
 	mBulkChangeIncludeTextures = gSavedSettings.getBOOL("BulkChangeIncludeTextures");
+	mBulkChangeIncludeSettings = gSavedSettings.getBOOL("BulkChangeIncludeSettings");
 	mBulkChangeShareWithGroup = gSavedSettings.getBOOL("BulkChangeShareWithGroup");
 	mBulkChangeEveryoneCopy = gSavedSettings.getBOOL("BulkChangeEveryoneCopy");
 	mBulkChangeNextOwnerModify = gSavedSettings.getBOOL("BulkChangeNextOwnerModify");
@@ -186,6 +187,7 @@ void LLFloaterBulkPermission::onCloseBtn()
 	gSavedSettings.setBOOL("BulkChangeIncludeScripts", mBulkChangeIncludeScripts);
 	gSavedSettings.setBOOL("BulkChangeIncludeSounds", mBulkChangeIncludeSounds);
 	gSavedSettings.setBOOL("BulkChangeIncludeTextures", mBulkChangeIncludeTextures);
+	gSavedSettings.setBOOL("BulkChangeIncludeSettings", mBulkChangeIncludeSettings);
 	gSavedSettings.setBOOL("BulkChangeShareWithGroup", mBulkChangeShareWithGroup);
 	gSavedSettings.setBOOL("BulkChangeEveryoneCopy", mBulkChangeEveryoneCopy);
 	gSavedSettings.setBOOL("BulkChangeNextOwnerModify", mBulkChangeNextOwnerModify);
@@ -281,6 +283,7 @@ void LLFloaterBulkPermission::doCheckUncheckAll(BOOL check)
 	gSavedSettings.setBOOL("BulkChangeIncludeScripts"   , check);
 	gSavedSettings.setBOOL("BulkChangeIncludeSounds"    , check);
 	gSavedSettings.setBOOL("BulkChangeIncludeTextures"  , check);
+	gSavedSettings.setBOOL("BulkChangeIncludeSettings"  , check);
 }
 
 
@@ -302,6 +305,7 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInve
 			( asstype == LLAssetType::AT_OBJECT    && gSavedSettings.getBOOL("BulkChangeIncludeObjects"   )) ||
 			( asstype == LLAssetType::AT_LSL_TEXT  && gSavedSettings.getBOOL("BulkChangeIncludeScripts"   )) ||
 			( asstype == LLAssetType::AT_SOUND     && gSavedSettings.getBOOL("BulkChangeIncludeSounds"    )) ||
+			( asstype == LLAssetType::AT_SETTINGS  && gSavedSettings.getBOOL("BulkChangeIncludeSettings"  )) ||
 			( asstype == LLAssetType::AT_TEXTURE   && gSavedSettings.getBOOL("BulkChangeIncludeTextures"  )))
 		{
 			LLViewerObject* object = gObjectList.findObject(viewer_obj->getID());
@@ -333,7 +337,12 @@ void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInve
 					//|| something else // for next owner perms
 					)
 				{
-					perm.setMaskNext(LLFloaterPerms::getNextOwnerPerms("BulkChange"));
+					U32 mask_next = LLFloaterPerms::getNextOwnerPerms("BulkChange");
+					if (asstype == LLAssetType::AT_SETTINGS)
+					{
+						mask_next |= PERM_COPY;
+					}
+					perm.setMaskNext(mask_next);
 					perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("BulkChange"));
 					perm.setMaskGroup(LLFloaterPerms::getGroupPerms("BulkChange"));
 					new_item->setPermissions(perm); // here's the beef
diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h
index 0c042c3ee37..1afc876bba9 100644
--- a/indra/newview/llfloaterbulkpermission.h
+++ b/indra/newview/llfloaterbulkpermission.h
@@ -102,6 +102,7 @@ class LLFloaterBulkPermission : public LLFloater, public LLVOInventoryListener
 	bool mBulkChangeIncludeScripts;
 	bool mBulkChangeIncludeSounds;
 	bool mBulkChangeIncludeTextures;
+	bool mBulkChangeIncludeSettings;
 	bool mBulkChangeShareWithGroup;
 	bool mBulkChangeEveryoneCopy;
 	bool mBulkChangeNextOwnerModify;
diff --git a/indra/newview/skins/default/xui/en/floater_bulk_perms.xml b/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
index e7ab3cacdc4..b4577f54e61 100644
--- a/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
@@ -156,7 +156,20 @@
      name="icon_texture"
      tool_tip="Textures"
      left_pad="2" />
-
+  <check_box
+    control_name="BulkChangeIncludeSettings"
+    height="16"
+    name="check_settings"
+    left="245"
+    top="25"
+    width="16" />
+  <icon
+    height="16"
+    image_name="Inv_Settings"
+    mouse_opaque="true"
+    name="icon_setting"
+    tool_tip="Environment settings"
+    left_pad="2" />
     <button
       height="23"
     layout="topleft"
-- 
GitLab