⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getpermission.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<%
Function GetPermission(ObjDB,DeptID)	
	Dim StrURL,StrModulePath,StrFileName
	Dim IntPos,IntAccountID,IntDeptID
	Dim ObjRS,StrSQL
	Dim IntCRoleIDs,IntDRoleIDs
	Dim i,Permission
	Dim Operation
	
	IntAccountID = Session("AccountID")
	IntDeptID = DeptID
	StrURL = Request.ServerVariables("URL")
	
	For i = 1 To Len(StrURL)
		If Mid(StrURL,i,1)="/" Then IntPos = i
	Next

	StrModulePath = Mid(StrURL,1,IntPos)
	StrFileName =  Replace(StrURL,StrMOdulePath,"")
	StrModulePath = Mid(StrModulePath,2,Len(StrModulePath)-2)
	
	StrSQL = "Select RoleIDs from t_OA_SYS_Account where ID = " & IntAccountID
	Set ObjRS = ObjDB.execute (StrSQL)
	IntCRoleIDs = ObjRS("RoleIDs")
	If IntCRoleIDs = "" Then IntCRoleIDs = 0
	ObjRS.close
	
	
	StrSQL = "Select BasicPermission from v_OA_SYS_Role_Permission where BasicPath = '" & StrModulePath & "' and RoleID in (" & IntCRoleIDs & ")"
	Set ObjRS = ObjDB.execute (StrSQL)
	
	If Lcase(Left(StrFileName,4)) = "list" Then i = 1
	If Lcase(Left(StrFileName,4)) = "view" Then i = 2
	If Lcase(Left(StrFileName,4)) = "addn" Then i = 3
	If Lcase(Left(StrFileName,4)) = "edit" Then i = 4
	If Lcase(Left(StrFileName,4)) = "dele" Then i = 5
	If Lcase(Left(StrFileName,4)) = "sear" Then i = 6

	While Not ObjRS.eof
		Permission = Permission or Mid (ObjRS("BasicPermission"),i,1) 
		ObjRS.movenext
	Wend
	ObjRS.close
	If Permission = 1 Then
		GetPermission = 1
		Exit Function
	Else
		Dim ParentDepIDs
		Dim HasParent
		Dim NowDepID
		HasParent = True
		NowDepID = IntDeptID
		ParentDepIDs = IntDeptID
		While HasParent
			StrSQL = "Select ParentID From t_OA_SYS_Department Where ID = " & NowDepID
			Set ObjRS = ObjDB.Execute(StrSQL)
			If ObjRS.Eof Then
				HasParent = False
			Else
				NowDepID = ObjRS("ParentID")
				ParentDepIDs = ParentDepIDs & "," & NowDepID
			End If
		Wend
		
		StrSQL = "Select RoleIDs from t_OA_SYS_Department_Account where AccountID = " & IntAccountID & " And DepID In ( " & ParentDepIDs & ")"
		
		Set ObjRS = ObjDB.execute (StrSQL)
		IntDRoleIDs = 0
		While Not ObjRS.Eof
			IntDRoleIDs = IntDRoleIDs & "," & ObjRS("RoleIDs")
			ObjRS.MoveNext
		Wend
		ObjRS.close
		StrSQL = "Select BasicPermission from v_OA_SYS_Role_Permission where BasicPath = '" & StrModulePath & "' and RoleID in (" & IntDRoleIDs & ")"
		Set ObjRS = ObjDB.execute (StrSQL)
		While Not ObjRS.eof
			Permission = Permission or Mid (ObjRS("BasicPermission"),i,1)
			ObjRS.movenext
		Wend
		If Permission = 1 Then
			GetPermission = 2
			Exit Function
		ElseIf Permission = 0 Then
			GetPermission = 0
		End If
	End If
		
		
End Function

%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -