Tip

Implementing a Secure /?Open

When you turn set "Allow HTTP clients to browse databases" to "no" in the Server document. You cannot browse the list of databases. You usually turn this off for security reasons, so here is an agent that gives the same functionality but in a secure way.This means you can turn of database browsing but still get the list.

' This agent must be set to "run as web user"
' to run this agent from the web use the url
http://server/dbpath/AgentName/?openAgent&Login

Declarations
' Change this to your administration group
Const AdminGroup = "NotesAdmin"

Function IsAdminUser(User As String) As Integer

'This routine determines if the current user is a Notes Administrator in the group NotesAdmin
' This routine should be changed to specify the group name of the Administrators

Dim groups As NotesView
Dim groupMainDoc As NotesDocument
Dim groupMainMembers As NotesItem
Dim NAB As NotesDatabase
Dim Inthere As Integer
Dim Search As String

Set nameUser = New NotesName(User)

Set NAB = New NotesDatabase("","names.nsf")
Set groups = NAB.GetView( "Groups" )
Set groupMainDoc = groups.GetDocumentByKey(AdminGroup)
Set groupMainMembers = groupMainDoc.GetFirstItem( "Members" )

Inthere = False

Forall Item In groupMainMembers.Values

If Lcase(nameUser.Canonical) = Lcase(Cstr(item)) Then

Inthere= True

End If

End Forall

IsAdminUser = Inthere

End Function

Function TimesinString(InString As String, Character As String) As Integer

Dim Length As Integer
Dim Num As Integer
Dim Place As Integer
Dim TotalPlace As Integer
Dim Inp As String

Num = 0
Inp = Instring

While Len(Inp) <> 0

Place = Instr(Inp, Character)

If Place = 0 Then

TimesinString = Num
Exit Function

End If

Num = Num + 1
Inp = Right(Inp, Len(Inp) - Place)

Wend

TimesinString = Num

End Function

Function DirtoDots(InString As String, Character As String) As String

Dim Length As Integer
Dim Num As Integer
Dim Place As Integer
Dim TotalPlace As Integer
Dim DotString As String
Dim Inp As String

Num = 0
TotalPlace = 0
Inp = Instring
DotString = ""

While Len(Inp) <> 0

Place = Instr(Inp, Character)

TotalPlace = TotalPlace + Place

If Place = 0 Then

DirtoDots = DotString
Exit Function

End If

DotString = DotString + ". . "
Inp = Right(Inp, Len(Inp) - Place)

Wend

DirtoDots = DotString

End Function

Function FindCharinString(InString As String, Character As String,Instance As
Integer) As Integer

Dim Length As Integer
Dim Num As Integer
Dim Place As Integer
Dim TotalPlace As Integer
Dim Inp As String

Num = 0
TotalPlace = 0
Inp = Instring

While Len(Inp) <> 0

Place = Instr(Inp, Character)

TotalPlace = TotalPlace + Place

If Place = 0 Then

FindCharinString = 0
Exit Function

End If

Num = Num + 1
Inp = Right(Inp, Len(Inp) - Place)

If Num=Instance Then
FindCharinString = TotalPlace
Exit Function
End If

Wend

FindCharinString = TotalPlace

End Function


This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.