2008年8月19日 星期二

取得資料庫使用者名稱

下面這一個範例是『取得使用者名稱』;當可以取得使用者名稱後,可以針對『使用者』加以限制,他的閱讀權限。可以應用在編輯介面與閱讀介面的切換;又或是在『審核過程中』後配合使用者名稱,加以控管『目前審核者』,所擁有的權限。
---------------------------------------
Dim ws As New NotesUIWorkspace
Dim sess As New NotesSession
Dim db As NotesDatabase '目前資料庫
Set db = ws.CurrentDatabase.Database
'以下是宣告ACL,準備讀取角色
Dim acl As NotesACL
Dim entry As NotesACLEntry
Set acl = db.ACL
Set entry = acl.GetEntry( sess.CommonUserName )
If entry Is Nothing Then
Set entry = acl.GetEntry( sess.UserName )
End If
If entry Is Nothing Then
Messagebox _
"No entry for " & sess.CommonUserName & _
" or " & sess.UserName,, "No entry"
Exit Sub
End If
---來源 Lotus Notes Designer Help

沒有留言: