From 2bb66ef115b0930685c3e1a84209248ec96f1d4e Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Thu, 19 Jan 2017 00:34:33 +0100 Subject: [PATCH] Work on Impersonation, removed some debug elements --- Site/App_GlobalResources/Global.designer.cs | 9 +++++ Site/App_GlobalResources/Global.resx | 3 ++ Site/App_GlobalResources/Menu5.designer.cs | 18 +++++++++ Site/App_GlobalResources/Menu5.resx | 6 +++ .../Pages.Admin.designer.cs | 38 +++++++++++++++++++ Site/App_GlobalResources/Pages.Admin.resx | 14 +++++++ Site/Controls/v5/Swarm/ComboPeople.ascx.cs | 4 ++ Site/MainMenu-v5.xml | 27 +++++++++++++ Site/Scripts/Swarmops-v5.js | 10 ++--- Site/Site.csproj | 8 ++++ 10 files changed, 130 insertions(+), 7 deletions(-) diff --git a/Site/App_GlobalResources/Global.designer.cs b/Site/App_GlobalResources/Global.designer.cs index de996e89..a5dd04df 100644 --- a/Site/App_GlobalResources/Global.designer.cs +++ b/Site/App_GlobalResources/Global.designer.cs @@ -1946,6 +1946,15 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to Type a partial name.... + /// + internal static string Swarm_TypePartialName { + get { + return ResourceManager.GetString("Swarm_TypePartialName", resourceCulture); + } + } + /// /// Looks up a localized string similar to five-year. /// diff --git a/Site/App_GlobalResources/Global.resx b/Site/App_GlobalResources/Global.resx index 87214459..b45820d2 100644 --- a/Site/App_GlobalResources/Global.resx +++ b/Site/App_GlobalResources/Global.resx @@ -890,4 +890,7 @@ Volunteers + + Type a partial name... + \ No newline at end of file diff --git a/Site/App_GlobalResources/Menu5.designer.cs b/Site/App_GlobalResources/Menu5.designer.cs index 3ac4e8d6..27a9dae9 100644 --- a/Site/App_GlobalResources/Menu5.designer.cs +++ b/Site/App_GlobalResources/Menu5.designer.cs @@ -87,6 +87,24 @@ namespace Resources { } } + /// + /// Looks up a localized string similar to Debug. + /// + internal static string Menu5_Administration_Debug { + get { + return ResourceManager.GetString("Menu5_Administration_Debug", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Impersonate. + /// + internal static string Menu5_Administration_Debug_Impersonate { + get { + return ResourceManager.GetString("Menu5_Administration_Debug_Impersonate", resourceCulture); + } + } + /// /// Looks up a localized string similar to Geography Tree. /// diff --git a/Site/App_GlobalResources/Menu5.resx b/Site/App_GlobalResources/Menu5.resx index b76131cc..b5bacf21 100644 --- a/Site/App_GlobalResources/Menu5.resx +++ b/Site/App_GlobalResources/Menu5.resx @@ -433,4 +433,10 @@ Report a Swarmops Bug (on Github) + + Debug + + + Impersonate + \ No newline at end of file diff --git a/Site/App_GlobalResources/Pages.Admin.designer.cs b/Site/App_GlobalResources/Pages.Admin.designer.cs index 3f2d72f8..fc3d2c3d 100644 --- a/Site/App_GlobalResources/Pages.Admin.designer.cs +++ b/Site/App_GlobalResources/Pages.Admin.designer.cs @@ -132,6 +132,44 @@ namespace Resources.Pages { } } + /// + /// Looks up a localized string similar to Impersonate another user. + /// + internal static string CommenceImpersonation_Header { + get { + return ResourceManager.GetString("CommenceImpersonation_Header", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Impersonate. + /// + internal static string CommenceImpersonation_Impersonate { + get { + return ResourceManager.GetString("CommenceImpersonation_Impersonate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Person to impersonate. + /// + internal static string CommenceImpersonation_Person { + get { + return ResourceManager.GetString("CommenceImpersonation_Person", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <p>This debugging tool allows you to impersonate another user to see and experience Swarmops as they do when logged in.</p> + ///<p><strong>WARNING:</strong> This is a highly intrusive tool that should only be used for technical development and for requested support. Using this should not be taken lightly.</p> + ///<p>All impersonations are permanently logged, all and any actions taken while impersonated are traceable as such, and the impersonated user will be informed of the intrusion.</p>. + /// + internal static string CommenceImpersonation_Warning { + get { + return ResourceManager.GetString("CommenceImpersonation_Warning", resourceCulture); + } + } + /// /// Looks up a localized string similar to Activists will be called. /// diff --git a/Site/App_GlobalResources/Pages.Admin.resx b/Site/App_GlobalResources/Pages.Admin.resx index 6bef93c8..ae59864c 100644 --- a/Site/App_GlobalResources/Pages.Admin.resx +++ b/Site/App_GlobalResources/Pages.Admin.resx @@ -314,4 +314,18 @@ WebSocket Port (Backend) + + Impersonate another user + + + Impersonate + + + Person to impersonate + + + <p>This debugging tool allows you to impersonate another user to see and experience Swarmops as they do when logged in.</p> +<p><strong>WARNING:</strong> This is a highly intrusive tool that should only be used for technical development and for requested support. Using this should not be taken lightly.</p> +<p>All impersonations are permanently logged, all and any actions taken while impersonated are traceable as such, and the impersonated user will be informed of the intrusion.</p> + \ No newline at end of file diff --git a/Site/Controls/v5/Swarm/ComboPeople.ascx.cs b/Site/Controls/v5/Swarm/ComboPeople.ascx.cs index 726660ac..ea6756b3 100644 --- a/Site/Controls/v5/Swarm/ComboPeople.ascx.cs +++ b/Site/Controls/v5/Swarm/ComboPeople.ascx.cs @@ -15,6 +15,10 @@ namespace Swarmops.Controls.Swarm protected void Page_Load (object sender, EventArgs e) { + if (String.IsNullOrEmpty(Placeholder)) + { + Placeholder = Resources.Global.Swarm_TypePartialName; + } } } } \ No newline at end of file diff --git a/Site/MainMenu-v5.xml b/Site/MainMenu-v5.xml index 978e4e8f..d5b4720f 100644 --- a/Site/MainMenu-v5.xml +++ b/Site/MainMenu-v5.xml @@ -518,6 +518,33 @@ + + 4 + Separator + + + + + Administration_Debug + 4 + + iconshock-battery-drill + Submenu + + + + Administration_Debug_Impersonate + 4 + + iconshock-battery-drill + /Pages/v5/Admin/CommenceImpersonation.aspx + Link + + + + + + 1 Separator diff --git a/Site/Scripts/Swarmops-v5.js b/Site/Scripts/Swarmops-v5.js index c66ff704..e346989d 100644 --- a/Site/Scripts/Swarmops-v5.js +++ b/Site/Scripts/Swarmops-v5.js @@ -10,25 +10,21 @@ function _masterInitializeSocket(authenticationTicket) { _masterSocket = null; } - alertify.log("DEBUG: Opening socket " + getMasterSocketAddress() + "..."); - var socketUrl = getMasterSocketAddress() + "?Auth=" + authenticationTicket; _masterSocket = new WebSocket(socketUrl); _masterSocket.onopen = function(data) { - alertify.success('Socket Connected!'); - if (_masterSocketHeartbeatsLost) { // Reload all edits and the edit pool. If there are discrepancies, we can probably live with them. (Detect editing?) - alertify.log("Backend connection restored without interruption."); + //alertify.log("Backend connection restored without interruption."); _masterSocketHeartbeatsLost = false; } //watchHeartbeat(); }; - _masterSocket.onclose = function(data) { alertify.log("Connection Lost"); }; - _masterSocket.onerror = function(data) { alertify.log("Connection Error"); }; + _masterSocket.onclose = function(data) { /* TODO: try reconnecting */ }; + _masterSocket.onerror = function(data) { alertify.error("WARNING: Socket connection error - realtime updates will not be available"); }; _masterSocket.onmessage = function(data) { console.log(data.data); diff --git a/Site/Site.csproj b/Site/Site.csproj index c8a454a3..671d7d67 100644 --- a/Site/Site.csproj +++ b/Site/Site.csproj @@ -106,6 +106,13 @@ CreateOrganization.aspx + + CommenceImpersonation.aspx + ASPXCodeBehind + + + CommenceImpersonation.aspx + PopulateCountry1.aspx ASPXCodeBehind @@ -967,6 +974,7 @@ +