' 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