Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Access Database Recognizes users as Novell Login_Name


Message #1 by "Darron Michael" <darron.michael@h...> on Thu, 17 May 2001 19:32:13
A Neat Trick:



If you put a line in your Novell Container's login script that creates an 

env variable on the workstation containing the loginname, it is possible 

to get access to read that env variable to discover the user's identity.  

It can then look up their security level from a table of users, or create 

them a guest account if necessary.  It will also work with NT as long as 

there is an environment variable, but the login script line will change.



The Login Script Line for Novell is . . .



Dos Set HDUN = "%LOGIN_NAME" 



The Function that will identify which environment variable to use is . . .



Function FindHDUN() As Integer

Dim EnvString, Indx, Msg, PathLen   ' Declare variables.

Indx = 1    ' Initialize index to 1.

Do

    EnvString = Environ(Indx)

    If Left(EnvString, 5) = "HDUN=" Then

       FindHDUN = Indx

       Exit Do

    Else

        Indx = Indx + 1

    End If

Loop Until EnvString = ""

End Function



AND . . . 



The Function that will look up their user level based on that environment 

variable is . . .



Function getlevel()

    Dim rstUsers As Recordset

    Dim ulevel As String

    Dim errLoop As Error

    Set rstUsers = CurrentDb.OpenRecordset("SELECT username, accesslevel 

FROM users where username = Mid(Environ(FindHDUN()), 6, 99)", 

dbOpenForwardOnly)

     On Error GoTo linenext

    ulevel = rstUsers.Fields("AccessLevel")

linenext:

    rstUsers.Close

    If ulevel = "" Then

        ulevel = "Guest"

        DoCmd.OpenQuery "Addguest"

    End If

    getlevel = ulevel

End Function

  Return to Index