Ok, if you are like me you may want to play with new technologies within your well-known environment (like the IBM Notes/Domino database), e.g. an Angular.js app.
Now, if you are used to the well-known security model in Notes/Domino you may also have your database locked down so no un-authenticated users can access your database. And now you add an "app" to the WebContent folder (via the package explorer view). However, the first time you try to access your "app" it redirects to a login page. What is happening???
Well, you have been hit by a problem that is easily solved by "ordinary" design elements that you can mark for "public access". However, that is not possible for these types of design elements - without a little code....
So I have created the following LotusScript (!!) agent to do the trick. You may need to adjust the path of your app - but the principle should put you on the right track:
Option Public
Option DeclareSub Initialize
Const APP_DIR = "app/"
Const FN_PUBLICACCESS = "$PublicAccess"
Const FLAG_TRUE = "1"
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim nc As NotesNoteCollection
Set db = sess.currentDatabase
Set nc = db.CreateNoteCollection(False)
Call nc.SelectAllDesignElements(True)
Call nc.BuildCollection
Dim d1 As Long
Dim d2 As Long
Dim title As String
Dim flagsExt As String
Dim noteid As String
Dim nextid As String
Dim i As Long
Dim doc As NotesDocument
noteid = nc.Getfirstnoteid()
For i = 1 To nc.Count
'get the next note ID before removing any notes
nextid = nc.GetNextNoteId(noteid)
Set doc = db.GetDocumentByID(noteid)
title = doc.GetItemValue("$title")(0)
flagsExt = doc.GetItemValue("$flagsExt")(0)
If LCase(flagsExt) = "w" And Left(LCase(title),Len(APP_DIR)) = LCase(APP_DIR) Then
d1 = d1 + 1
If Not doc.Getitemvalue(FN_PUBLICACCESS)(0) = FLAG_TRUE Then
d2 = d2 + 1
Call doc.replaceItemValue(FN_PUBLICACCESS,FLAG_TRUE)
Call doc.save(True, False)
Print title & " - set to allow public access read"
End If
End If
noteid = nextid
Next
Print nc.count & " design elements checked. " & d1 & " elements found in '" & APP_DIR & "' and " & d2 & " updated to give public access"
End Sub