Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

database specific password protection

database specific password protection

database specific password protection

I have completed some script to require users entering certain databases to reauthenticate with their password, however, when the enter password box comes up someone can circumvent it by clicking on cancel.  How do I stop this and make sure the only way to get in the database is by submitting an authorized password?  Appreciate any help!

RE: database specific password protection

Once upon a time, I found some code here that does this.  Here is my modified code that prompts for the Notes password.  Hope it helps.


Sub Click(Source As Button)
    Dim workspace As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Dim ses As New NotesSession
    Dim reg As New NotesRegistration
    Dim MyID As String
    Dim MyDir As String
    Dim charPos As Integer
    Set uidoc = workspace.currentdocument
'Build the filepath to the existing ID
    If uidoc.FieldGetText("Status") = "Pending" Then        
        If GetRank() >= 1 Then
            MyID = ses.GetEnvironmentString("KeyFilename", True)
            MyDir = ses.GetEnvironmentString("Directory", True)
            Dim nuserName As New NotesName(ses.UserName)
            NotesUserName = nuserName.Abbreviated
            charPos = Instr(1, MyID, "\")
            If charPos = 0 Then ' Not found
                build_str = MyDir + "\" + MyID
                build_str = MyID
            End If
' If the user cancels the password prompt, then an error code will be generated. The On Error statement will redirect the program execution so that the error handling code will be executed. The resume statement will then control where program execution goes when the error handling routine is completed.
' If the valid password for the current user's Notes ID is entered, then no error code will be generated and the program will continue to execute program statements in their normal sequence.
    'On Error Goto SomeErrorRoutine
            UserName = reg.SwitchToID(build_str)
            uidoc.EditMode = True
            Call uidoc.FieldSetText("Status", "Complete")
            UserName = Cstr(Left(UserName, (Instr(UserName,"/")-1)))    
            UserName = Cstr(Mid(UserName, (Instr(UserName, "=")+1)))
            Call uidoc.FieldSetText("Override", UserName)
            Call uidoc.save
            Update uidoc.FieldGetText("EventStartDate"), uidoc.FieldGetText("EventStartTime"), uidoc.FieldGetText("Judge")
            Call uidoc.close
            messagetext = "Your personal ranking does not allow for supervisor overrides." + Chr(10) +  "Please contact Info Sys for correction."
            Messagebox messagetext, 0 + 64, "Override Error"
        End If
    End If
End Sub

RE: database specific password protection

Thanks for the help!  I'll try it and see. I still intend to use Notes security in the background, however, because of part 11 (electronic signatures) I have been asked to build this re-authentication function.  Again, thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close