I am in the process of setting up a company intranet and will be using windows authentication (anonymous access turned off). After grabbing the user's logon info I will then need to check group permissions in order to give them access to certain pages within the website. Other than the code I have listed below (which takes some time to run), that loops through the groups for that user and compares to the group I am passing to it. There may be times that I will have to check for several groups, thereby increasing the amount of time to compute the comparison.
------------------------------------------------------
function checkGroupPermission(strUser, strGroup)
thisUser = strUser
set myDomain = GetObject("WinNT://DOMAINNAME")
myDomain.Filter = Array("group")
for each group in myDomain
strGroupName = group.name
set grp = getObject("WinNT://DOMAINNAME/" & strGroupName)
if grp.isMember("WinNT://DOMAINNAME/" & thisUser) then
if LCase(strGroupName) = LCase(strGroup) then
checkGroupPermission = true
end if
end if
set grp = nothing
next
end function
----------------------------------------------------------
Is there a quicker way to do this? We're not talking minutes in time, but several noticable seconds do elapse.
Thank you for any help you can provide.
------------------------------------------------------
function checkGroupPermission(strUser, strGroup)
thisUser = strUser
set myDomain = GetObject("WinNT://DOMAINNAME")
myDomain.Filter = Array("group")
for each group in myDomain
strGroupName = group.name
set grp = getObject("WinNT://DOMAINNAME/" & strGroupName)
if grp.isMember("WinNT://DOMAINNAME/" & thisUser) then
if LCase(strGroupName) = LCase(strGroup) then
checkGroupPermission = true
end if
end if
set grp = nothing
next
end function
----------------------------------------------------------
Is there a quicker way to do this? We're not talking minutes in time, but several noticable seconds do elapse.
Thank you for any help you can provide.