From 474905badef4679bbce53306c49343703be38263 Mon Sep 17 00:00:00 2001 From: Kelly Washington Date: Tue, 30 Apr 2013 16:04:41 -0700 Subject: 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 --- indra/lscript/lscript_byteformat.h | 8 +++ indra/newview/app_settings/keywords.ini | 3 + indra/newview/llviewermessage.cpp | 64 ++++++++++++++-------- .../newview/skins/default/xui/en/notifications.xml | 23 +++++++- indra/newview/skins/default/xui/en/strings.xml | 7 ++- 5 files changed, 79 insertions(+), 26 deletions(-) (limited to 'indra') diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h index a294def734..54031aaf05 100644 --- a/indra/lscript/lscript_byteformat.h +++ b/indra/lscript/lscript_byteformat.h @@ -530,6 +530,10 @@ typedef enum e_lscript_runtime_permissions 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; @@ -547,6 +551,10 @@ const U32 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_EOF] = (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 diff --git a/indra/newview/app_settings/keywords.ini b/indra/newview/app_settings/keywords.ini index 6120f22ba4..f0d8b77afd 100644 --- a/indra/newview/app_settings/keywords.ini +++ b/indra/newview/app_settings/keywords.ini @@ -92,6 +92,9 @@ PERMISSION_CHANGE_LINKS Passed to llRequestPermissions library function to req 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 diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3c0d6189ac..4efe345141 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -163,7 +163,11 @@ const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = "ChangePermissions", "TrackYourCamera", "ControlYourCamera", - "TeleportYourAgent" + "TeleportYourAgent", + "JoinAnExperience", + "SilentlyManageEstateAccess", + "OverrideYourAnimations", + "ScriptReturnObjects" }; const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = @@ -179,7 +183,11 @@ 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) @@ -6424,7 +6432,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) 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++) @@ -6432,7 +6440,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data) if (questions & LSCRIPTRunTimePermissionBits[i]) { count++; - + known_questions |= LSCRIPTRunTimePermissionBits[i]; // check whether permission question should cause special caution dialog caution |= (SCRIPT_QUESTION_IS_CAUTION[i]); @@ -6442,32 +6450,40 @@ void process_script_question(LLMessageSystem *msg, void **user_data) 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 (known_questions != questions) + { // This is in addition to the normal dialog. + LLNotificationsUtil::add("UnknownScriptQuestion",args); + } + + if (known_questions) { - if (caution) + 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); + } + else + { + // fall back to default behavior if cautions are entirely disabled + LLNotificationsUtil::add("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); } - } } diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 105bef7321..1f39ec041e 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -6863,8 +6863,29 @@ Do not allow access if you do not fully understand why it wants access to your a [FOOTERTEXT] + + + '<nolink>[OBJECTNAME]</nolink>', an object owned by '[NAME]', requested an unknown script runtime permission. + +Please update your viewer to grant this permission. + confirm +
+