?? logic_role.asp
字號(hào):
<%
''===================================================================
'= ASP FILENAME : /inc/logic/logic_role.asp
'= CREATED TIME : 2006-5-3
'= LAST MODIFIED: 2006-5-3
'= VERSION INFO : CCASP Framework Ver 2.0.1 ALL RIGHTS RESERVED BY www.cclinux.com
'= DESCRIPTION : 權(quán)限管理邏輯
'= Change Log:
'==================================================================='
%>
<%
'== 常量定義
Const CONST_ROLE_DEFAULT = 1 '== 缺省用戶權(quán)限
Const CONST_ROLE_NORMAL = 0 '== 一般用戶權(quán)限
Const CONST_ACTION_VIEW = 0 '== 瀏覽型請(qǐng)求
Const CONST_ACTION_EXEC = 1 '== 執(zhí)行型請(qǐng)求
''===================================================================
'= Function : GetRolesLogic()
'= Time : Created At 2006-5-5
'= Input : strWhere : 符合條件
'= Return : boolean
'= Description : 取用戶權(quán)限記錄集
'==================================================================='
Function GetRolesLogic(strWhere)
GBL_objPubDB.Clear()
GBL_objPubDB.AllSQL = "SELECT * FROM CLASS_ROLE WHERE 1=1 " & strWhere & " ORDER BY ROLE_ID DESC"
If Not GBL_objPubDB.SQLRSExecute() Then
GetRolesLogic = False
Exit Function
End If
GetRolesLogic = True
End Function
''===================================================================
'= Function : GetRoleLogic()
'= Time : Created At 2006-5-5
'= Input : strWhere : 符合條件
'= Return : boolean
'= Description : 取用戶權(quán)限記錄
'==================================================================='
Function GetRoleLogic(strWhere)
GBL_objPubDB.Clear()
GBL_objPubDB.AllSQL = "SELECT ROLE_NAME,ROLE_DESC,ROLE_ADD_TIME FROM CLASS_ROLE WHERE 1=1" & strWhere
If Not GBL_objPubDB.SQLRSExecute() Then
GetRoleLogic = False
Exit Function
End If
GetRoleLogic = True
End Function
''===================================================================
'= Function : GetActionsLogic()
'= Time : Created At 2006-5-5
'= Input : strWhere : 符合條件
'= Return : boolean
'= Description : 取頁面請(qǐng)求記錄集
'==================================================================='
Function GetActionsLogic(strWhere)
GBL_objPubDB.Clear()
GBL_objPubDB.AllSQL = "SELECT * FROM CLASS_ACTION WHERE 1=1 " & strWhere & " ORDER BY ACTION_ID DESC"
If Not GBL_objPubDB.SQLRSExecute() Then
GetActionsLogic = False
Exit Function
End If
GetActionsLogic = True
End Function
''===================================================================
'= Function : RemoveRolesLogic()
'= Time : Created At 2006-5-5
'= Input : strWhere : 符合條件
'= Return : boolean
'= Description : 刪除用戶權(quán)限
'==================================================================='
Function RemoveRolesLogic(strWhere)
'== 默認(rèn)記錄不能刪除
If Not GetRolesLogic(strWhere &" AND ROLE_IS_DEFAULT=" & CONST_ROLE_DEFAULT) Then
RemoveRolesLogic = False
Exit Function
End If
If GBL_objPubDB.intRSNum > 0 Then
Call GBL_objException.catchErr(E_USER_PUB,"缺省的用戶權(quán)限不能刪除")
RemoveRolesLogic = False
Exit Function
End If
'== 判斷是否用戶使用
'== 刪除操作表
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_MANAGE"
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = " MANAGE_ROLE_ID IN (SELECT ROLE_ID FROM CLASS_ROLE WHERE 1=1 " & strWhere & ")"
If Not GBL_objPubDB.SQLRSExecute() Then
RemoveRolesLogic = False
Exit Function
End If
'==刪除本表
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_ROLE"
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = "1=1 " & strWhere
If Not GBL_objPubDB.SQLRSExecute() Then
RemoveRolesLogic = False
Exit Function
End If
RemoveRolesLogic = True
End Function
''===================================================================
'= Function : SaveRoleLogic()
'= Time : Created At 2006-5-5
'= Input : intRoleId : Role ID ""--add other--edit
'= Return : boolean
'= Description : 添加/編輯用戶權(quán)限
'==================================================================='
Function SaveRoleLogic(intRoleId,objFormData)
Dim strName,strDesc,strSql
'== 獲取數(shù)據(jù)
strName = objFormData.Item("Name")
strDesc = objFormData.Item("Desc")
'== 是否重復(fù)
strSql = " AND ROLE_NAME='" & strName & "' "
If intRoleId <> "" Then strSql = strSql & " AND ROLE_ID <> " & intRoleId
If Not GetRoleLogic(strSql) Then
SaveRoleLogic = False
Exit Function
End If
If GBL_objPubDB.intRSNum > 0 Then
Call GBL_objException.catchErr(E_USER_PUB,"該用戶權(quán)限名(" & strName & ")已存在")
SaveRoleLogic = False
Exit Function
End If
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_ROLE"
If intRoleId = "" Then
GBL_objPubDB.SQLType = "INSERT"
GBL_objPubDB.AddField "ROLE_ADD_TIME",Now()
GBL_objPubDB.AddField "ROLE_ADD_ADMIN_ID",GBL_intAdminId
Else
GBL_objPubDB.SQLType = "UPDATE"
End If
GBL_objPubDB.AddField "ROLE_NAME",strName
GBL_objPubDB.AddField "ROLE_DESC",strDesc
GBL_objPubDB.AddField "ROLE_LAST_TIME",Now()
GBL_objPubDB.AddField "ROLE_IS_DEFAULT",CONST_ROLE_NORMAL
GBL_objPubDB.AddField "ROLE_LAST_ADMIN_ID",GBL_intAdminId
If intRoleId <> "" Then GBL_objPubDB.Where = "ADMIN_ID=" & intAdminId
If Not GBL_objPubDB.SQLRSExecute() Then
SaveRoleLogic = False
Exit Function
End If
SaveRoleLogic = True
End Function
''===================================================================
'= Function : GetRoleActionStrLogic()
'= Time : Created At 2006-5-5
'= Input : intRoleId : Role ID
'= Input : strRoleAction : 構(gòu)造請(qǐng)求字符串
'= Return : boolean
'= Description : 構(gòu)造權(quán)限請(qǐng)求字符串
'==================================================================='
Function GetRoleActionStrLogic(intRoleId,ByRef strRoleAction)
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_MANAGE"
GBL_objPubDB.SQLType = "SELECT"
GBL_objPubDB.AddField "MANAGE_ACTION_ID",""
GBL_objPubDB.Where = "MANAGE_ROLE_ID=" & intRoleId
If Not GBL_objPubDB.SQLRSExecute() Then
GetRoleActionStrLogic = False
Exit Function
End If
strRoleAction = ""
While Not GBL_objPubDB.objPubRS.Eof
strRoleAction = strRoleAction & "|" & GBL_objPubDB.objPubRS("MANAGE_ACTION_ID")
GBL_objPubDB.objPubRS.MoveNext
Wend
GetRoleActionStrLogic = True
End Function
''===================================================================
'= Function : RoleActionCheck()
'= Time : Created At 2006-5-5
'= Input : intActionId : Acton ID
'= Input : strRoleAction : 請(qǐng)求字符串
'= Return : boolean
'= Description : 權(quán)限請(qǐng)求分配中中選checkbox
'==================================================================='
Function RoleActionCheck(intActionId,strRoleAction)
strRoleAction = strRoleAction & "|"
intActionId = "|" & intActionId & "|"
If Instr(strRoleAction,intActionId) > 0 Then
RoleActionCheck = " checked "
Exit Function
End If
End Function
''===================================================================
'= Function : SaveUserActonsLogic()
'= Time : Created At 2006-5-5
'= Input : intActionId : Acton ID
'= Input : strIds :
'= Return : boolean
'= Description : 保存用戶權(quán)限
'==================================================================='
Function SaveUserActonsLogic(intRoleId,strIds)
Dim arrIds,i
'== 刪除目前權(quán)限請(qǐng)求
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_MANAGE"
GBL_objPubDB.SQLType = "DELETE"
GBL_objPubDB.Where = "MANAGE_ROLE_ID=" & intRoleId
If Not GBL_objPubDB.SQLRSExecute() Then
SaveUserActonsLogic = False
Exit Function
End If
'== 插入新權(quán)限請(qǐng)求
arrIds = Split(strIds,",")
For i = Lbound(arrIds) To UBound(arrIds)
GBL_objPubDB.Clear()
GBL_objPubDB.TableName = "CLASS_MANAGE"
GBL_objPubDB.SQLType = "INSERT"
GBL_objPubDB.AddField "MANAGE_ROLE_ID",intRoleId
GBL_objPubDB.AddField "MANAGE_ACTION_ID",arrIds(i)
GBL_objPubDB.AddField "MANAGE_ADD_TIME",Now()
GBL_objPubDB.AddField "MANAGE_ADD_ADMIN_ID",GBL_intAdminId
If Not GBL_objPubDB.SQLExecute() Then
SaveUserActonsLogic = False
Exit Function
End If
Next
SaveUserActonsLogic = True
End Function
''===================================================================
'= Function : GetActionTypeLogic()
'= Time : Created At 2006-5-13
'= Input : intType : 請(qǐng)求數(shù)字
'= Return : 請(qǐng)求的中文含義
'= Description : 取請(qǐng)求
'==================================================================='
Function GetActionTypeLogic(intType)
Dim strTmp
Select Case intType
Case CONST_ACTION_VIEW:
strTmp = "瀏覽型"
Case CONST_ACTION_EXEC::
strTmp = "執(zhí)行型"
End Select
GetActionTypeLogic = strTmp
End Function
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -