Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Laval <jeremie.laval@gmail.com>2012-03-14 20:08:07 +0400
committerJeremie Laval <jeremie.laval@gmail.com>2012-03-14 20:09:35 +0400
commitb23bca5befbacf1ab1becd2cc259e083dfa165b7 (patch)
treef161416c9079ad59704da15dcfd807efe731959c /AppleDocWizard
parent3034b381de9ffde980f0f5633a1f9d31cbf3ab95 (diff)
[AppleDocWizard] Verify that the user running the application is root
Diffstat (limited to 'AppleDocWizard')
-rw-r--r--AppleDocWizard/AppleDocWizardController.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/AppleDocWizard/AppleDocWizardController.cs b/AppleDocWizard/AppleDocWizardController.cs
index 8cf33f3..1418c3c 100644
--- a/AppleDocWizard/AppleDocWizardController.cs
+++ b/AppleDocWizard/AppleDocWizardController.cs
@@ -14,7 +14,8 @@ namespace macdoc
NothingToDo,
Processed,
Canceled,
- Error
+ Error,
+ NotAdmin
}
CancellationTokenSource source = new CancellationTokenSource ();
@@ -35,13 +36,16 @@ namespace macdoc
Window.CancellationSource = source;
handler = new AppleDocHandler ();
handler.AppleDocProgress += HandleAppleDocProgress;
-
- VerifyFreshnessAndLaunchDocProcess ();
}
- void VerifyFreshnessAndLaunchDocProcess ()
+ public void VerifyFreshnessAndLaunchDocProcess ()
{
Task.Factory.StartNew (() => {
+ if (System.Security.Principal.WindowsIdentity.GetCurrent().Name != "root") {
+ ShowAlert (FinishState.NotAdmin);
+ return;
+ }
+
AppleDocHandler.AppleDocInformation infos;
var resourcePath = NSBundle.MainBundle.ResourcePath;
@@ -85,6 +89,10 @@ namespace macdoc
alert.MessageText = "An error occured";
alert.InformativeText = "A fatal error occured during one of the documentation installer step";
break;
+ case FinishState.NotAdmin:
+ alert.MessageText = "Not enough rights";
+ alert.InformativeText = "You need to be an administrator to use this tool";
+ break;
}
alert.RunModal ();