搞定了!在数据库里保存的有相关信息,写了下面一个函数,但是不能支持一个用户同时属于两个用户组,欢迎拍砖啊!
Function Ingroup(user_str,group_str)
Set group_ddict = CreateObject("Scripting.Dictionary")
group_ddict.Add "0001000","Developer"
group_ddict.Add "0000001","Tester Manager"
group_ddict.Add "0100000","QATester"
group_ddict.Add "0000010","Developer Manager"
group_ddict.Add "1000000","QAadmin"
group_ddict.Add "0000100","Viewer"
group_ddict.Add "0010000","roject Manager"
Set dbconn = CreateObject("ADODB.Connection")
Set myRecordSet = CreateObject("ADODB.Recordset")
mydbname = TDConnection.DBName
connstr = "rovider = SQLOLEDB;Data Source=192.168.2.46;Initial Catalog="+mydbname+";User Id=adminassword=zcxc123;"
dbconn.Open connstr
sqlstr = "select US_GROUP from td.USERS where US_USERNAME = '"+ user_str+"'"
myRecordSet.Open sqlstr,dbconn
Do
If Not myRecordSet.EOF Then
rd = myRecordSet("US_GROUP")
myRecordSet.MoveNext
End If
Loop Until myRecordSet.EOF=True
If StrComp(group_ddict.Item(rd),group_str) = 0 Then
Ingroup = True
Else
Ingroup = False
End If
End Function |