More on Impersonation

This commit is contained in:
Rick Falkvinge
2017-01-20 20:11:09 +01:00
parent 773a8553f2
commit 289bbcb1f4
8 changed files with 154 additions and 7 deletions
+18
View File
@@ -1185,6 +1185,15 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Ok.
/// </summary>
internal static string Global_Ok {
get {
return ResourceManager.GetString("Global_Ok", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to On.
/// </summary>
@@ -1257,6 +1266,15 @@ namespace Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Proceed.
/// </summary>
internal static string Global_Proceed {
get {
return ResourceManager.GetString("Global_Proceed", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Processing File....
/// </summary>
+8
View File
@@ -894,6 +894,14 @@
<value>Go</value>
<comment>As in "execute", "run requested procedure"</comment>
</data>
<data name="Global_Ok" xml:space="preserve">
<value>Ok</value>
<comment>Shown on confirmation dialogs</comment>
</data>
<data name="Global_Proceed" xml:space="preserve">
<value>Proceed</value>
<comment>Shown as "Ok" on some "Are you sure?" dialogs</comment>
</data>
<data name="Swarm_TypePartialName" xml:space="preserve">
<value>Type a partial name...</value>
</data>
+45
View File
@@ -150,6 +150,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;IMPERSONATE PERSON?&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;This is not to be taken lightly and may even be illegal depending on local laws.&lt;br/&gt;&lt;br/&gt;The purpose of this tool is to fix technical malfunctions. Everything is logged.&lt;br/&gt;&lt;br/&gt;Proceed?.
/// </summary>
internal static string CommenceImpersonation_Confirm {
get {
return ResourceManager.GetString("CommenceImpersonation_Confirm", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;IMPERSONATION TERMINATED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Impersonation terminated at {0:HH:mm} UTC. You are acting as yourself again..
/// </summary>
@@ -159,6 +168,42 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You may not impersonate somebody who is your direct manager..
/// </summary>
internal static string CommenceImpersonation_Error_Authority_Report {
get {
return ResourceManager.GetString("CommenceImpersonation_Error_Authority_Report", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You may not impersonate somebody else with system level access..
/// </summary>
internal static string CommenceImpersonation_Error_Authority_System {
get {
return ResourceManager.GetString("CommenceImpersonation_Error_Authority_System", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You need to select a person to impersonate..
/// </summary>
internal static string CommenceImpersonation_Error_SelectPerson {
get {
return ResourceManager.GetString("CommenceImpersonation_Error_SelectPerson", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to If you need to impersonate yourself, we suggest you log off Swarmops and seek other kind of assistance..
/// </summary>
internal static string CommenceImpersonation_Error_Self {
get {
return ResourceManager.GetString("CommenceImpersonation_Error_Self", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to &lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You do not seem to have sufficient privileges to impersonate somebody else..
/// </summary>
+15
View File
@@ -322,10 +322,25 @@
<value>You have an active impersonation session as {0}. &lt;a href="javascript:terminateImpersonation();"&gt;End impersonation.&lt;/a&gt;</value>
<comment>Visible on Dashboard. {0} is the impersonated name.</comment>
</data>
<data name="CommenceImpersonation_Confirm" xml:space="preserve">
<value>&lt;strong&gt;IMPERSONATE PERSON?&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;This is not to be taken lightly and may even be illegal depending on local laws.&lt;br/&gt;&lt;br/&gt;The purpose of this tool is to fix technical malfunctions. Everything is logged.&lt;br/&gt;&lt;br/&gt;Proceed?</value>
</data>
<data name="CommenceImpersonation_Ended" xml:space="preserve">
<value>&lt;strong&gt;IMPERSONATION TERMINATED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Impersonation terminated at {0:HH:mm} UTC. You are acting as yourself again.</value>
<comment>{0} will be fed with a DateTime. The colon is rewritten automatically into the current DateTimeFormatInfo.TimeSeparator.</comment>
</data>
<data name="CommenceImpersonation_Error_Authority_Report" xml:space="preserve">
<value>&lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You may not impersonate somebody who is your direct manager.</value>
</data>
<data name="CommenceImpersonation_Error_Authority_System" xml:space="preserve">
<value>&lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You may not impersonate somebody else with system level access.</value>
</data>
<data name="CommenceImpersonation_Error_SelectPerson" xml:space="preserve">
<value>You need to select a person to impersonate.</value>
</data>
<data name="CommenceImpersonation_Error_Self" xml:space="preserve">
<value>If you need to impersonate yourself, we suggest you log off Swarmops and seek other kind of assistance.</value>
</data>
<data name="CommenceImpersonation_Failed" xml:space="preserve">
<value>&lt;strong&gt;IMPERSONATION DENIED&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You do not seem to have sufficient privileges to impersonate somebody else.</value>
</data>
+16 -2
View File
@@ -46,16 +46,30 @@ namespace Swarmops.Frontend
// ReSharper disable once InconsistentNaming
// ReSharper disable InconsistentNaming
public string Localized_AjaxCallException
{
get { return JavascriptEscape (Resources.Global.Error_AjaxCallException); }
}
// ReSharper disable once InconsistentNaming
public string Localized_AjaxGeneralErrorSettingValue
{
get { return JavascriptEscape (Resources.Global.Error_UnspecifiedAjaxSetValue); }
}
public string Localized_ConfirmDialog_Ok
{
get { return JavascriptEscape(Resources.Global.Global_Ok); }
}
public string Localized_ConfirmDialog_Proceed
{
get { return JavascriptEscape(Resources.Global.Global_Proceed); }
}
public string Localized_ConfirmDialog_Cancel
{
get { return JavascriptEscape(Resources.Global.Global_Cancel); }
}
}
}
+15
View File
@@ -189,6 +189,21 @@ namespace Swarmops.Frontend
get { return JavascriptEscape(Resources.Global.Global_Off.ToUpperInvariant()); }
}
public string Localized_ConfirmDialog_Ok
{
get { return JavascriptEscape(Resources.Global.Global_Ok); }
}
public string Localized_ConfirmDialog_Proceed
{
get { return JavascriptEscape(Resources.Global.Global_Proceed); }
}
public string Localized_ConfirmDialog_Cancel
{
get { return JavascriptEscape(Resources.Global.Global_Cancel); }
}
}
+32 -1
View File
@@ -9,9 +9,40 @@
$(document).ready(function () {
});
function dialogBeginImpersonation() {
alertify.set({
labels: {
ok: SwarmopsJS.unescape('<%=this.Localized_ConfirmDialog_Proceed%>'),
cancel: SwarmopsJS.unescape('<%=this.Localized_ConfirmDialog_Cancel%>')
},
buttonFocus: 'cancel'
});
alertify.confirm(SwarmopsJS.unescape('<%=this.Localized_ConfirmDialog_Text%>'),
$.proxy(function (response) {
if (response) {
var selectedPersonId = <%=this.ComboPeople.ClientID%>_selectedPersonId();
SwarmopsJS.ajaxCall("/Pages/v5/Admin/CommenceImpersonation.aspx/Commence",
{ personId: selectedPersonId },
function(result) {
// if Success is true, we have a new auth cookie and should redir to Dashboard,
// otherwise, we should dialog the returned DisplayMessage
if (result.Success) {
document.location = "/"; // redirect
} else {
alert.dialog(result.DisplayMessage);
}
});
} else {
// Do nothing on cancel
}
}, this));
}
</script>
</asp:Content>
@@ -37,7 +37,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
[WebMethod]
public static AjaxCallResult BeginImpersonation (int personId)
public static AjaxCallResult Commence (int personId)
{
AuthenticationData authData = GetAuthenticationDataAndCulture();
@@ -80,11 +80,12 @@ namespace Swarmops.Frontend.Pages.v5.Admin
// ReSharper disable InconsistentNaming
public string Localized_ValidationError_MissingTag
public string Localized_ConfirmDialog_Text
{
get { return JavascriptEscape(Resources.Pages.Financial.FileExpenseClaim_ValidationError_MissingTag); }
get { return JavascriptEscape(Resources.Pages.Admin.CommenceImpersonation_Confirm); }
}
/*
public string Localized_ValidationError_BankAccount
{
get { return JavascriptEscape(Resources.Pages.Financial.RequestCashAdvance_ValidationError_BankAccount); }
@@ -118,7 +119,7 @@ namespace Swarmops.Frontend.Pages.v5.Admin
public string Localized_ValidationError_Documents
{
get { return JavascriptEscape(Resources.Pages.Financial.FileExpenseClaim_ValidationError_Documents); }
}
}*/
}
}