Results 1 to 3 of 3

Thread: Check if user has administrator privileges

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Check if user has administrator privileges

    Sorry if this is a double post, but I don't see my previous post.
    Anyway, I get the user name on an app via API. I'd like to check if the user has administrator privileges (besides checking if username = administrator) so that in case the db location changes, an administrator can change the location in the app, w/o recompiling and redistributing the app. This app will be installed locally on about 20 machines, but connect to a server.
    Right now the server address is hardcoded, but if the address changes, I want the administrator to be able to reset it (even though this means doing so on twenty computers). I can't have an app on the server for 20 machines to connect to because it's an Access 97 db and I don't want data errors because Access can't handle that many connections. Thanks, and Merry Christmas/Happy Holidays to all.

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Something like:

    Context.User.IsInRole("Domain Admin")

    There is more to it, just can't remember right now...hold on.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Code:
    Dim wsClientPrincipal As WindowsPrincipal = CType(Thread.CurrentPrincipal, WindowsPrincipal)
    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
    
    'Replace the 'Domain Admins' below to whatever your network is.
    If wsClientPrincipal.IsInRole("Domain Admins") Then
         'Stuff here.
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width