注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

mylotustips的博客

IBM Lotus协作产品家族经验分享

 
 
 

日志

 
 
关于我

欢迎大家使用SR向IBM800提交问题http://www.ibm.com/support/servicerequest 可以随时查看问题状态,上传文件

网易考拉推荐

转帖:批量修改访问控制列表的代码  

2012-12-05 21:12:59|  分类: LotusScript |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

'原作者:Stan Rogers http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/bef6e3f2b0a03e9285256e8d0068c906?OpenDocument

Option Public
Option Declare

Dim s As NotesSession
Dim NAB As NotesDatabase
Dim peopleView As NotesView
Dim personDoc As NotesDocument
Dim mailDb As NotesDatabase
Dim acl As NotesACL
Dim aclEntry As NotesACLEntry
Dim userName As String
Dim mailServerName As String
Dim mailDbFilepath As String
Dim isUserListed As Boolean

Sub Initialize
Set s = New NotesSession
Set NAB = s.GetDatabase(<server name goes here>,"names.nsf")
Set peopleView = NAB.GetView("($VIMPeople)")
Set personDoc = peopleView.GetFirstDocument

Do Until personDoc Is Nothing
If personDoc.GetItemValue("MailSystem") = "Notes" Then
userName = personDoc.GetItemValue("FullName")(0)
mailServerName = personDoc.GetItemValue("MailServer")(0)
mailDbFilepath = personDoc.GetItemValue("MailFile")(0)
Set mailDb = s.GetDatabase(mailServerName,mailDbFilepath)
If Not (mailDb Is Nothing) Then
isUserListed = False
Set acl = mailDb.ACL
Set aclEntry = acl.GetFirstEntry
Do Until aclEntry Is Nothing
If aclEntry.Name = userName Then
If aclEntry.Level > 0 Then
'User has not been specifically denied access by name
'(may be part of termination process)
'Make access level Editor (Or set value as 6 for Manager)
aclEntry.Level = 4
End If
isUserListed = True
Exit Do
End If
Loop
If Not isUserListed Then
'User was not listed in mail db ACL
Set aclEntry = acl.CreateACLEntry(userName,4)
'Sets the user to Editor to avoid future ACL problems
aclEntry.IsPerson = True
End If
Call acl.Save
Else
Messagebox("Mail database not found for " & userName & ".",48,"Agent Error")
End If
End If
Set personDoc = peopleView.GetNextDocument(personDoc)
Loop
End Sub

  评论这张
 
阅读(359)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017