1. Kelly Washington
  2. viewer-beta

Commits

Kelly Washington  committed b6c0eb7

MAINT-2646 Viewer should neither grant nor display prompts for unimplemented LSL permissions
* Add the newer run time permissions to the viewer
* Filter requested permissions by those the viewer knows about
* Show a dialog indicating unknown permissions were requested and a new viewer
will be needed to grant them.
reviewed with Simon and Soft

  • Participants
  • Parent commits 13149a5
  • Branches default

Comments (0)

Files changed (5)

File indra/lscript/lscript_byteformat.h

View file
  • Ignore whitespace
 	SCRIPT_PERMISSION_TRACK_CAMERA,
 	SCRIPT_PERMISSION_CONTROL_CAMERA,
 	SCRIPT_PERMISSION_TELEPORT,
+	SCRIPT_PERMISSION_EXPERIENCE,
+	SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT,
+	SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS,
+	SCRIPT_PERMISSION_RETURN_OBJECTS,
 	SCRIPT_PERMISSION_EOF
 } LSCRIPTRunTimePermissions;
 
 	(0x1 << 10),//	SCRIPT_PERMISSION_TRACK_CAMERA
 	(0x1 << 11),//	SCRIPT_PERMISSION_CONTROL_CAMERA
 	(0x1 << 12),//	SCRIPT_PERMISSION_TELEPORT
+	(0x1 << 13),//	SCRIPT_PERMISSION_EXPERIENCE,
+	(0x1 << 14),//	SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT,
+	(0x1 << 15),//	SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS,
+	(0x1 << 16),//	SCRIPT_PERMISSION_RETURN_OBJECTS,
 };
 
 // http_request string constants

File indra/newview/app_settings/keywords.ini

View file
  • Ignore whitespace
 PERMISSION_TRACK_CAMERA			Passed to llRequestPermissions library function to request permission to track agent's camera
 PERMISSION_CONTROL_CAMERA		Passed to llRequestPermissions library function to request permission to change agent's camera
 PERMISSION_TELEPORT				Passed to llRequestPermissions library function to request permission to teleport agent
+SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT	Passed to llRequestPermissions library function to request permission to silently modify estate access lists
+PERMISSION_OVERRIDE_ANIMATIONS	Passed to llRequestPermissions library function to request permission to override animations on agent
+PERMISSION_RETURN_OBJECTS		Passed to llRequestPermissions library function to request permission to return objects
 
 DEBUG_CHANNEL		Chat channel reserved for debug and error messages from scripts
 PUBLIC_CHANNEL		Chat channel that broadcasts to all nearby users

File indra/newview/llviewermessage.cpp

View file
  • Ignore whitespace
 		"ChangePermissions",
 		"TrackYourCamera",
 		"ControlYourCamera",
-		"TeleportYourAgent"
+		"TeleportYourAgent",
+		"JoinAnExperience",
+		"SilentlyManageEstateAccess",
+		"OverrideYourAnimations",
+		"ScriptReturnObjects"
 	};
 
 const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = 
 	FALSE,	// ChangePermissions
 	FALSE,	// TrackYourCamera,
 	FALSE,	// ControlYourCamera
-	FALSE	// TeleportYourAgent
+	FALSE,	// TeleportYourAgent
+	FALSE,	// JoinAnExperience
+	FALSE,	// SilentlyManageEstateAccess
+	FALSE,	// OverrideYourAnimations
+	FALSE,	// ScriptReturnObjects
 };
 
 bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
 		LLSD args;
 		args["OBJECTNAME"] = object_name;
 		args["NAME"] = LLCacheName::cleanFullName(owner_name);
-
+		S32 known_questions = 0;
 		BOOL has_not_only_debit = questions ^ LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_DEBIT];
 		// check the received permission flags against each permission
 		for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++)
 			if (questions & LSCRIPTRunTimePermissionBits[i])
 			{
 				count++;
-
+				known_questions |= LSCRIPTRunTimePermissionBits[i];
 				// check whether permission question should cause special caution dialog
 				caution |= (SCRIPT_QUESTION_IS_CAUTION[i]);
 
 				script_question += "    " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n";
 			}
 		}
+	
 		args["QUESTIONS"] = script_question;
 
-		LLSD payload;
-		payload["task_id"] = taskid;
-		payload["item_id"] = itemid;
-		payload["sender"] = sender.getIPandPort();
-		payload["questions"] = questions;
-		payload["object_name"] = object_name;
-		payload["owner_name"] = owner_name;
-
-		// check whether cautions are even enabled or not
-		if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
-		{
-			if (caution)
+		if (known_questions != questions)
+		{	// This is in addition to the normal dialog.
+			LLNotificationsUtil::add("UnknownScriptQuestion",args);
+		}
+		
+		if (known_questions)
+		{
+			LLSD payload;
+			payload["task_id"] = taskid;
+			payload["item_id"] = itemid;
+			payload["sender"] = sender.getIPandPort();
+			payload["questions"] = known_questions;
+			payload["object_name"] = object_name;
+			payload["owner_name"] = owner_name;
+
+			// check whether cautions are even enabled or not
+			if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
 			{
-				args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
+				if (caution)
+				{
+					args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
+				}
+				// display the caution permissions prompt
+				LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
 			}
-			// display the caution permissions prompt
-			LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
-		}
-		else
-		{
-			// fall back to default behavior if cautions are entirely disabled
-			LLNotificationsUtil::add("ScriptQuestion", args, payload);
-		}
-
+			else
+			{
+				// fall back to default behavior if cautions are entirely disabled
+				LLNotificationsUtil::add("ScriptQuestion", args, payload);
+			}
+		}
 	}
 }
 

File indra/newview/skins/default/xui/en/notifications.xml

View file
  • Ignore whitespace
 [FOOTERTEXT]
     </footer>
   </notification>
-
-  <notification
+	
+	<notification
+	 icon="notify.tga"
+	 name="UnknownScriptQuestion"
+	 persist="false"
+	 type="notify">
+		&apos;&lt;nolink&gt;[OBJECTNAME]&lt;/nolink&gt;&apos;, an object owned by &apos;[NAME]&apos;, requested an unknown script runtime permission. 
+
+Please update your viewer to grant this permission.
+		<tag>confirm</tag>
+		<form name="form">
+			<button
+			 index="0"
+			 name="Ok"
+			 text="Ok"/>
+			<button
+			 index="2"
+			 name="Mute"
+			 text="Block"/>
+		</form>
+	</notification>
+
+	<notification
    icon="notify.tga"
    name="ScriptDialog"
    show_toast="false"

File indra/newview/skins/default/xui/en/strings.xml

View file
  • Ignore whitespace
 	<string name="NotConnected">Not Connected</string>
 	<string name="AgentNameSubst">(You)</string> <!-- Substitution for agent name -->
   <string name="TeleportYourAgent">Teleport you</string>
-
+	<string name="JoinAnExperience">Join an experience</string> <!-- not used -->
+	<string name="SilentlyManageEstateAccess">Suppress alerts when managing estate access lists</string>
+	<string name="OverrideYourAnimations">Replace your default animations</string>
+	<string name="ScriptReturnObjects">Return objects on your behalf</string>
+	<string name="UnknownScriptPermission">(unknown)!</string>
+	
 	<!-- Sim Access labels -->
 	<string name="SIM_ACCESS_PG">General</string>
 	<string name="SIM_ACCESS_MATURE">Moderate</string>