Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

If the authenticated user is the same user running the RavenDB Proces…

…s - treat him as admin
  • Loading branch information...
commit 810be44cc06ed4468c0107bff2902d69c924400f 1 parent 270dbf6
@ayende ayende authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 Raven.Database/Extensions/HttpExtensions.cs
View
14 Raven.Database/Extensions/HttpExtensions.cs
@@ -455,7 +455,19 @@ public static bool IsAdministrator(this IPrincipal principal)
var windowsPrincipal = principal as WindowsPrincipal;
if (windowsPrincipal != null)
- return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
+ {
+ if (windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
+ return true;
+
+ var applicationIdentity = WindowsIdentity.GetCurrent();
+
+ if (applicationIdentity != null)
+ {
+ // if the auth user and the app are the same, consider him an admin
+ if (applicationIdentity.User == ((WindowsIdentity) windowsPrincipal.Identity).User)
+ return true;
+ }
+ }
return principal.IsInRole("Administrators");
}
Please sign in to comment.
Something went wrong with that request. Please try again.