Lotus用VB如何發現乙個使用者擁有的角色?

2021-04-12 19:30:24 字數 3694 閱讀 9252

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( name******$(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$(name******(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 name******$(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

name******$=nametoconvert$

end function

另乙個方法:

dim userroles as variant

userroles = evaluate("@userroles")

今天用itween發現的乙個座標問題

之前從別的地方copy了這一行 我計算了正確的目標位置posleft2,但是material沒有按照預想的去動,每次都會跑到乙個很奇怪的位置上去。itween.moveto material,itween.hash x posleft2.x,y posleft2.y,easetype itween....

用python建模 用Python建模乙個線性系統

我知道這有點舊,但搜尋引起了我的這個問題。當我找不到乙個好的模組時,我把它放在一起。這並不多,但如果有人發現他們在這裡,這是乙個好的開始。import matplotlib.pylab as plt import numpy as np import scipy.signal def bode g,...

用php做乙個分頁,用php做的乙個分頁小程式

require mysql conn.conf 以下統計資料庫中的最早和最新記錄時間 以下統計資料的最早時間 query begintime select mydate,mytime from temprature order by sn asc result begintime mysql que...