Code for the permission control of the ASP program
Source: Internet
Author: User
' Important code, copy the code into the code configuration file. (The code profile is a normal ASP file, where all the common code is placed in the ' file, and other calls to the public code are included in the file via include.)
' Permission authentication Code ' rightstring: A string of permissions (all the user's permissions are connected to, all good (,) connections. For example:, 1,3,12,7,45, ' Rightid: Verify the Permission ID, for a number ' program function is to find Rightid in the rightstring string, if found, indicating that the user has to change the Operation permission ' returns True, Returns False if no indication is found that the user does not have the operation permission.
function Validright (rightstring,rightid) if rightstring= "" or rightid= "" then validright=false Exit Function End If if INS TR (1,rightstring, "," & Rightid & ") >0 then validright=true else Validright=false End If End Function ' Permission validation code 2 ' Rightstring: A string of permission strings (all the user's permissions are connected to, with all good (,) connections, with a comma beginning with a comma ending.)
' For example:, 1,3,12,7,45, ' rightidstring: Validation of the permission ID string, which is composed in a similar way to rightstring, but with no commas on either side.
' The function of the program is to find every permission contained in the rightidstring string in the rightstring string, if any match is found, ' stating that the user has one of the operations rights, returns True, and if no match is found, Indicates that the user does not have ' any operation rights ' contained in the rightidstring and returns false.
function ValidRight2 (rightstring,rightidstring) if rightstring= "" or rightidstring= "" then Validright=false exit Function End If Rightidarr=split (rightidstring, ",") for I=0 to UBound (Rightidarr) if Validright ( i) then validright2=true exit Function End If Next validright2=false End Function ' Permission validation code 3 ' rightstring: Permission string (user all permissions connected to a string , the connection is good (,), and begins with a comma, ending with a comma.
' For example:, 1,3,12,7,45, ' rightidstring: Validation of the permission ID string, which is composed in a similar way to rightstring, but with no commas on either side.
' The function of the program is to find all the permissions contained in the rightidstring string in the rightstring string, if Rightstring contains all the permissions in the Rightidstring, Indicates that the user has all the permissions in the rightidstring, returns true; ' returns false ' if one does not match, the user does not have all the permissions contained in the rightidstring.
function ValidRight3 (rightstring,rightidstring) if rightstring= "" or rightidstring= "" then Validright=false exit Function End If Rightidarr=split (rightidstring, ",") for I=0 to UBound (Rightidarr) if not validright (rightstring, Rightidarr (i)) then Validright3=false Exit Function End If Next validright3=true End Function
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service