Lotus用VB如何发现一个用户拥有的角色?
来源:互联网 发布:新点招投标软件 编辑:程序博客网 时间:2024/05/27 20:25
Function Roles(UserName$) As Variant
Dim AllRoles As Variant
Dim session As New NotesSession
Dim db As NotesDatabase
Dim acl As NotesACL
Dim entry As NotesACLEntry
Dim FirstGroupFound%
Set db = session.CurrentDatabase
Set acl = db.ACL
Set entry = acl.GetEntry( UserName$ )
If entry Is Nothing Then
Set entry = acl.GetEntry( NameSimple$(UserName$) )
End If
If Not entry Is Nothing Then
AllRoles = entry.Roles
Else
Set entry = acl.GetFirstEntry
Do While Not entry Is Nothing
'Default roles (survives only if no other found)
If Trim$(Ucase$(entry.name)) = Ucase$("-Default-") Then
AllRoles = entry.roles
Else
If IsaMemberOf(UserName$, entry.name) Then
If FirstGroupFound% Then
Redim Preserve AllRoles(Ubound(AllRoles)+Ubound(entry.roles)+1)
For Cont%=0 To Ubound(entry.roles)
AllRoles(Ubound(AllRoles)-Cont%) = entry.roles(Cont%)
Next
Else
FirstGroupFound% =True
AllRoles=entry.roles
End If
End If
End If
Set entry = acl.GetNextEntry( entry )
Loop
End If
Roles = AllRoles
End Function
Function IsaMemberOf(UserName$, GroupName$)
On Error Goto IsaMemberOfError
Dim doc As NotesDocument
Static ViewGroup As NotesView
If (ViewGroup Is Nothing) Then
Dim PublicBook As Variant
Dim session As New NotesSession
Set PublicBook=Nothing
Forall Book In session.AddressBooks
If (Book.IsPublicAddressBook) Then
Set PublicBook=Book
Exit Forall
End If
End Forall
If PublicBook Is Nothing Then
Forall Book In session.AddressBooks
Set PublicBook=Book
Exit Forall
End Forall
End If
If Not (PublicBook Is Nothing) Then
Call PublicBook.Open("", "")
Set ViewGroup=PublicBook.GetView("Groups")
If ViewGroup Is Nothing Then
Messagebox "No group view found"
End If
Else
Messagebox "No address book found"
Exit Function
End If
End If
Set doc=ViewGroup.GetDocumentByKey(GroupName$)
If doc Is Nothing Then
IsaMemberOf = False
Else
If Not (doc Is Nothing) Then
Forall Member In doc.Members
If Trim$(Ucase$(Member)) = Trim$(Ucase$(UserName$)) Or Trim$(Ucase$(Member)) = Trim$(Ucase$(NameSimple(UserName$))) Then
IsaMemberOf = True
Exit Forall
Else
If IsaMemberOf(UserName$, Cstr(Member)) Then
IsaMemberOf = True
Exit Forall
End If
End If
End Forall
End If
End If
Exit Function
IsaMemberOfError:
Messagebox "IsaMemberOf"+Str$(Err)+": "+Error$
Exit Function
End Function
Function NameSimple$(Byval NameToConvert$)
Dim InstrUguale%,Cont%,NameResto$
Do
InstrUguale%=Instr(NameToConvert$,"=")
If InstrUguale%=0 Then
Exit Do
End If
NameResto$=Mid$(NameToConvert$,InstrUguale%+1)
For Cont%=InstrUguale%-1 To 0 Step -1
If Cont%=0 Then
NameToConvert$=""
Elseif Mid$(NameToConvert$,Cont%,1)="/" Then
NameToConvert$=Left$(NameToConvert$,Cont%)
Exit For
End If
Next
NameToConvert$=NameToConvert$+NameResto$
Loop
NameSimple$=NameToConvert$
End Function
另一个方法:
Dim UserRoles As Variant
UserRoles = Evaluate("@UserRoles")
- Lotus用VB如何发现一个用户拥有的角色?
- Oracle 中如何删除一个用户拥有的所有对象
- oracle 查看当前用户拥有的角色权限
- ORACLE管理-查看拥有DBA角色的用户
- 如何查询用户拥有的权限
- 最近发现VB.net2003的一个bug
- 最近发现VB.net2003的一个bug
- 用户具有多重角色,角色拥有可重复权限,确定用户具有权限的数据库设计方案(关系型数据库)
- 如何给一个注册用户添加一个权限或角色
- 如何拥有一个初学者的心态
- 如何拥有一个有意义的人生
- 如何拥有一个初学者的心态
- 如何拥有一个游戏策划的思维
- 如何拥有一个完全免费的博客?
- 如何拥有一个属于自己的网站
- oracle 查看当前用户拥有的角色权限信息的命令
- 如何设计一个基于Lotus的可配置的工作流
- 如何快速创建拥有全部权限的SAP用户
- .Net中的反射使用入门
- SQL入门:创建视图
- 开通我的博客了
- Demon模块流程开发文档
- 要查一个系列的包有没有装的命令
- Lotus用VB如何发现一个用户拥有的角色?
- 三十六计
- 若夫果腹嘎
- 下载网址集锦
- 纪念我逝去的爱情 -- 我爱你 xiaoxin
- 如何选择第一份职业
- Javascript的IE和FF兼容性汇编
- C#頁面轉換
- DOMINO的一个数据库最大能有多大??