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

Dig deeper on Domino Resources - Part 6

0 comments

Oldest 

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:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close