Re: Check Current User is a Domaingroup member

From: Tim B (tbb_at_uni.de)
Date: 05/24/04

  • Next message: Sharad: "RE: Access Denied on Event Viewer."
    Date: 24 May 2004 00:35:25 -0700
    
    

    Hello

    thx

    it works, but when i have a computer which has the same name like my
    dom an there is the same local group can i avoid the security??

    bye
    tim

    "Eric Marvets" <ericm@bangproject.com> wrote in message news:<#HH9huPQEHA.2132@TK2MSFTNGP11.phx.gbl>...
    > Here is what you do:
    >
    >
    > At the start of the application (Shared Sub Main):
    >
    > Dim ident as WindowsIdentity = WindowsIdentity.GetCurrent()
    > Dim prin As New WindowsPrincipal(ident)
    >
    > System.Threading.Thread.CurrentPrincipal = prin
    >
    > If not prin.IsInRole("dom\role") then
    > 'throw an exception
    > 'shutdown app
    > end if
    >
    > 'launch main form
    > End Sub
    >
    >
    > This also allows you to place attributes on methods to check their security
    > Level later in the application as well:
    >
    > <PrincipalPermissionAttribute(SecurityAction.Demand, Role :=
    > "dom\ProductAdministrator")> Public sub CreateProduct (....)
    >
    > End Sub
    >
    > -or-
    >
    > If
    > System.Threading.Thread.CurrentPrincipal.IsInRole("dom\ProductAdministrator"
    > ) then CreateProduct(....)
    >
    >
    > --
    > Eric Marvets
    > Principal Consultant
    >
    > the bang project
    >
    > <shameless self promotion>
    >
    > Email sales@bangproject.com for Information on Our Architecture and
    > Mentoring Services
    >
    > </shameless self promotion>


  • Next message: Sharad: "RE: Access Denied on Event Viewer."

    Relevant Pages

    • Re: Generic Password
      ... >> User-Level Security. ... >>> Dim stDocName As String ... >>> Exit Sub ... >>> Employee clicks on Login.htm and selects thier ...
      (microsoft.public.access.formscoding)
    • Re: Sheet passwording
      ... > Private Sub Worksheet_Activate ... > to change the macro security settings to get the macro to run. ... > You will also need to password protect your VBA project so no one can see ...
      (microsoft.public.excel.misc)
    • Re: Sheet passwording
      ... >> Private Sub Worksheet_Activate ... >> to change the macro security settings to get the macro to run. ... >> You will also need to password protect your VBA project so no one can ...
      (microsoft.public.excel.misc)
    • RE: Error 2501
      ... If she is getting those messages, Macro Security is set too high. ... Private Sub lstReports_DblClick ... a specific user running access ...
      (microsoft.public.access.modulesdaovba)
    • RE: VB.net WMI Win32_NtlogEvent problem, please help
      ... The access deinied is driven by trying to access the "security" logfile. ... > Set objLatestEvent = colMonitoredEvents.NextEvent ... > where a new log written into the logfiles. ... > End Sub ...
      (microsoft.public.dotnet.general)