Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
' 指定文字檔的路徑
Dim filePath As String
filePath = "C:\D12\file.txt"
' 打開文字檔
Dim fileNum As Integer
fileNum = FreeFile()
Open filePath For Input As fileNum
' 循環讀取文字檔每一行
Dim lineContent As String
While Not EOF(fileNum)
Line Input #fileNum, lineContent
' 假設每一行的格式為: 資料庫路徑,用戶ID
Dim parts As variant
parts = Split(lineContent, ",")
If UBound(parts) = 1 Then
Dim dbPath As String
Dim userId As String
dbPath = Trim(parts(0))
userId = Trim(parts(1))
' 打開資料庫並修改ACL
Set db = session.GetDatabase("", dbPath)
If Not db Is Nothing And db.IsOpen Then
Set acl = db.ACL
If Not acl Is Nothing Then
Set aclEntry = acl.GetEntry(userId)
If aclEntry Is Nothing Then
Set aclEntry = acl.CreateACLEntry(userId, ACLLEVEL_EDITOR) ' 例如設為Editor權限
Else
aclEntry.Level = ACLLEVEL_EDITOR ' 修改權限為Editor
End If
acl.Save
End If
End If
End If
Wend
' 關閉文字檔
Close fileNum
注意事項:
確保 `伺服器名稱`、`數據庫名稱` 和使用者名稱正確。
謹慎操作 ACL 變更,並確保您有必要的權限來執行此操作。
執行者需完整權限管理員或對所有資料庫有權限
AI自主客戶服務
若有任何需求可以直接詢問專業AI客服

發佈留言