diff common/util.h @ 505:78959fd970b0

Add is_admin and implement it for windows
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Apr 2014 09:19:53 +0000
parents 17e1c8f37d72
children 175370634226
line wrap: on
line diff
--- a/common/util.h	Mon Apr 28 09:19:29 2014 +0000
+++ b/common/util.h	Mon Apr 28 09:19:53 2014 +0000
@@ -12,6 +12,10 @@
  */
 #include <stdbool.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**@brief Check if the current process is running with elevated privileges.
  *
  * Elevates the current process token to check if it is marked as elevated.
@@ -20,4 +24,17 @@
  * @returns true if the current process is elevated.*/
 bool is_elevated();
 
+/**@brief Check if the user is in the administrators group.
+ *
+ * The function checks if the account that startet this process
+ * belongs to a user that is a member of the Administrators group.
+ *
+ * @returns True if the user is in the admin group. False otherwise or on error.
+ */
+bool is_admin();
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif // COMMON_UTIL_H

http://wald.intevation.org/projects/trustbridge/