Autor Beitrag
Metrik
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: So 23.04.06 10:27 
Hallo

Ich brauche irgend eine Möglichkeit, wie ich herausfinden kann was für Rechte der angemeldete Benutzer gerade hat.
Ob ich ein Admin, User, Guest, ... ist.

Danke im Voraus
Metrik
thkerkmann
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 20

Windows 7
Delphi 2010 Professional
BeitragVerfasst: So 23.04.06 11:12 
Google mal nach "Delphi IsAdmin"
da findest Du ne Menge....
Und dann kannst Du das sicher irgendwie ummodeln.
Metrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: So 23.04.06 11:14 
Ps: das sollte in c# sein!

Metirk
thkerkmann
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 20

Windows 7
Delphi 2010 Professional
BeitragVerfasst: So 23.04.06 11:18 
Hab noch dies hier gefunden:

----------------------------------------------------------------
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
using System.Security.Principal;

WindowsIdentity curUser = WindowsIdentity.GetCurrent();
bool allow = curUser.IsAuthenticated;

WindowsPrincipal membership = new WindowsPrincipal(curUser);
bool isAdmin = membership.IsInRole("BUILTIN\\Administrators");

----------------------------------------------------------------

Hilft das ?
Metrik Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 80

Win XP, Win Vista
C# (VS 2003, #Develop)
BeitragVerfasst: So 23.04.06 15:59 
Danke !

Ganau das habe ich gesucht, noch ein wenig anpassen und es ist perfekt.

Metrik
dirkil2
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 130



BeitragVerfasst: Mi 04.10.06 12:41 
Nur der Vollständigkeit halber für Delphi-Nutzer noch eine weitere Möglichkeit:

In den JEDI Klassen gibt es die Klasse JclSecurity. Diese hat die Funktion IsAdministrator, die genau das macht, was Du möchtest.