Sub CreateACL(user as string,dbpath as string,acc as integer)
On Error Goto ErrorHasOccurred
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim entry As NotesACLEntry
Dim entry2 As NotesACLEntry
Set db=session.getDatabase("ServerName",dbpath)
Set acl = db.ACL
Set entry=acl.GetEntry(user)
Set entry2 = acl.CreateACLEntry (user, acc )
Call acl.Save
Exit Sub
ErrorHasOccurred:
msgbox Cstr(Now()) & " ~ Error in CreateACL Agent ~ " & Cstr(Error())+" ~ "+ Cstr(Erl())
Resume Next
End Sub
Saturday, March 27, 2010
Monday, December 8, 2008
LotusScript equivalents for the @Contains(@UserRoles;"ADMIN")
Function IsInRole (RoleName As String) As Integer
IsInRole = False
Dim userRoles As Variant
userRoles = Evaluate("@UserRoles")
Forall role In userRoles
If Ucase(role) = Ucase(RoleName) Then
IsInRole = True
Exit Forall
End If
End Forall
End Function
IsInRole = False
Dim userRoles As Variant
userRoles = Evaluate("@UserRoles")
Forall role In userRoles
If Ucase(role) = Ucase(RoleName) Then
IsInRole = True
Exit Forall
End If
End Forall
End Function
Monday, November 17, 2008
LotusScript equivalents for the @URLDecode
Function urlDecode(s As String) As String
If Len(s) = 0 Then Exit Function
Dim i As Integer
Dim tmp As String
Dim c As String
For i = 1 To Len(s)
c = Mid$(s, i, 1)
If c = "+" Then c = " "
If c = "%" Then
c = Chr$("&H" + Mid$(s, i + 1, 2))
i = i + 2
End If
tmp = tmp + c
Next i
urlDecode = tmp
End Function
If Len(s) = 0 Then Exit Function
Dim i As Integer
Dim tmp As String
Dim c As String
For i = 1 To Len(s)
c = Mid$(s, i, 1)
If c = "+" Then c = " "
If c = "%" Then
c = Chr$("&H" + Mid$(s, i + 1, 2))
i = i + 2
End If
tmp = tmp + c
Next i
urlDecode = tmp
End Function
LotusScript equivalents for the @URLEncode
Function urlEncode(s As String) As String
If Len(s) = 0 Then Exit Function
Dim tmp As String
Dim c As String
Dim i As Integer
For i = 1 To Len(s)
c = Mid(s, i, 1)
If (Asc(c) >= 65 And Asc(c) <= 90) _
Or (Asc(c) >= 97 And Asc(c) <= 122) _
Or (Asc(c) >= 48 And Asc(c) <= 58) _
Or Asc(c) = 38 _
Or (Asc(c) >= 45 And Asc(c) <= 47) _
Or Asc(c) = 58 Or Asc(c) = 61 _
Or Asc(c) = 63 Or Asc(c) = 126 Then
tmp = tmp + c
Else
tmp = tmp + "%" + Hex(Asc(c))
End If
Next i
urlEncode = tmp
End Function
If Len(s) = 0 Then Exit Function
Dim tmp As String
Dim c As String
Dim i As Integer
For i = 1 To Len(s)
c = Mid(s, i, 1)
If (Asc(c) >= 65 And Asc(c) <= 90) _
Or (Asc(c) >= 97 And Asc(c) <= 122) _
Or (Asc(c) >= 48 And Asc(c) <= 58) _
Or Asc(c) = 38 _
Or (Asc(c) >= 45 And Asc(c) <= 47) _
Or Asc(c) = 58 Or Asc(c) = 61 _
Or Asc(c) = 63 Or Asc(c) = 126 Then
tmp = tmp + c
Else
tmp = tmp + "%" + Hex(Asc(c))
End If
Next i
urlEncode = tmp
End Function
Saturday, November 15, 2008
LotusScript equivalents for the @ProperCase
Function properCase(Byval txtIn As String) As String
properCase = Strconv(txtIn, 3)
End Function
properCase = Strconv(txtIn, 3)
End Function
LotusScript equivalents for the @ReplaceSubstring
Function ReplaceSubstringEvaluate (Byval fullString As String, oldString As String,
newString As String) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim var As Variant
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
Call doc.ReplaceItemValue("FullString", fullString)
Call doc.ReplaceItemValue("OldString", oldString)
Call doc.ReplaceItemValue("NewString", newString)
var = Evaluate("@ReplaceSubstring(fullString; oldString; newString)", doc)
ReplaceSubstringEvaluate = var(0)
'** clean up the memory we used
Set doc = Nothing
Set db = Nothing
End Function
newString As String) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim var As Variant
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
Call doc.ReplaceItemValue("FullString", fullString)
Call doc.ReplaceItemValue("OldString", oldString)
Call doc.ReplaceItemValue("NewString", newString)
var = Evaluate("@ReplaceSubstring(fullString; oldString; newString)", doc)
ReplaceSubstringEvaluate = var(0)
'** clean up the memory we used
Set doc = Nothing
Set db = Nothing
End Function
Wednesday, November 12, 2008
LotusScript equivalents for the @Elements
Function Elements(anArray as Variant) as Integer
i = 0
Forall values in anArray
i = i + 1
End Forall
Elements = i
End Function
i = 0
Forall values in anArray
i = i + 1
End Forall
Elements = i
End Function
Subscribe to:
Posts (Atom)