%@ Language=VBScript %>
<% Option Explicit %>
<%
dim szEmail, szServerEmail, szServerDomain, szOrigURL, szReason
dim fBadEmail, fBadCheck, fAgreeCheck, fBadReason, fLimited
dim objConn, objCmd, dwResult
Response.Buffer=false
Response.CacheControl="no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires=-1
%>
<%
Sub AddAuthenticationLevel(szEmail, szDomain, wAccessLevel)
dim objConn, objRec, szSQL, dwUserID, dwUserAccessLevelID
dim objCmd, res, dwResult
dwUserID = 0
'Response.Write("Connection: " + szConnectionAuthorization + "
")
set objConn = Server.CreateObject("ADODB.CONNECTION")
'objConn.Open szConnectionAuthorization, OCA_RW_UID, OCA_RW_PWD
objConn.Open szConnectionAuthorization
set objCmd = Server.CreateObject("ADODB.COMMAND")
objCmd.ActiveConnection = objConn
objCmd.CommandType = &H0004
objCmd.CommandText = "OcaAddUserAndLevel"
objCmd.Parameters.Append objCmd.CreateParameter ("RETURN_VALUE", 3, &H0004)
objCmd.Parameters.Append objCmd.CreateParameter ("@User",200,&H0001,50,szEmail)
objCmd.Parameters.Append objCmd.CreateParameter ("@Domain",200,&H0001,50,szDomain)
objCmd.Parameters.Append objCmd.CreateParameter ("@CurrTime",200,&H0001,50,CStr(Now()))
objCmd.Parameters.Append objCmd.CreateParameter ("@Level",3,&H0001,,wAccessLevel)
'Response.Write("User: " & szEmail & " domain: " & szDomain & " access: " & wAccessLevel )
objCmd.Execute
dwResult = CLng(objCmd.Parameters("RETURN_VALUE"))
set objCmd = nothing
objConn.Close
set objConn = nothing
if dwResult = 0 then
Response.Write "
If it has been more than 24-hours and you have not heard from us, please E-mail " Response.Write "dwappr." Response.End End Sub Sub SendApprovalMail(dwUserID, AccessLevelID, szEmail, szDomain, szReason) dim szBody, szTo Const ForReading = 1, ForWriting = 2, ForAppending = 3 Dim fs, f, szFilename szFilename = Server.MapPath("\") & "\ApproverEmail.htm" Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.OpenTextFile(szFilename, ForReading,False,0) szBody = f.ReadAll f.Close set f=nothing set fs = nothing FindReplace szBody, "%domainalias%", szDomain & "\" & szEmail FindReplace szBody, "%approveurl%", "http://watson/UserLevels.asp?UserID=" & dwUserID FindReplace szBody, "%requestuser%", szEmail FindReplace szBody, "%reason%", szReason szTo = EmailListFromAccessLevelID(AccessLevelID) if Not FSendMail("dwappr@microsoft.com", szTo, "Request for Watson Access", szBody, 15) then Response.Write "
" Response.Write "An error has occured while processing your request. Please E-mail " Response.Write "dwappr." Response.End end if Response.Write "If you don't hear from us within 24-hours, please E-mail "
Response.Write "dwappr."
Response.End
End Sub
Sub ProcessApproval(szEmail, szDomain, szReason)
dim dwUserID
dim szReasonLimited
szReasonLimited = szReason
if Len(szReasonLimited) > 255 then
szReasonLimited = Left(szReasonLimited, 255)
end if
dwUserID = AddUserForApproval(constApprovalTypeWebsiteAccess, szEmail, szDomain, szReasonLimited)
'SendApprovalMail dwUserID, constAccessApproveNonStd, szEmail, szDomain, szReasonLimited
End Sub
szEmail = ""
szReason = ""
fBadReason = False
fAgreeCheck = False
szOrigURL = CStr(Request("Orig"))
if CStr(Request.QueryString ) <> "" then
szOrigURL = Request.QueryString
end if
//Response.Write "
qyer: " & Request.QueryString
//Response.Write "
queyrstring: " & Request.QueryString( "OrigForm" )
//Response.Write ("
SZOrigurl: " & szOrigURL )
EmailDomainFromLogon szServerEmail, szServerDomain
fLimited = FLimitedUser(szServerEmail, szServerDomain)
set objConn = Server.CreateObject("ADODB.CONNECTION")
'objConn.Open szConnectionAuthorization, OCA_RO_UID, OCA_RO_PWD
'objConn.Open "Driver=SQL Server;Server=TKOffDWSql02;DATABASE=Authorization;uid=ocasqlrw;pwd=FT126USW"
objConn.Open szConnectionAuthorization
set objCmd = Server.CreateObject("ADODB.COMMAND")
objCmd.ActiveConnection = objConn
objCmd.CommandType = &H0004
objCmd.CommandText = "OcaCheckUserAccessApprovals"
objCmd.Parameters.Append objCmd.CreateParameter ("RETURN_VALUE", 3, &H0004)
objCmd.Parameters.Append objCmd.CreateParameter ("@User",200,&H0001,50,szServerEmail)
objCmd.Parameters.Append objCmd.CreateParameter ("@Domain",200,&H0001,50,szServerDomain)
objCmd.Parameters.Append objCmd.CreateParameter ("@Level",3,&H0001,,constAccessAuthorized)
objCmd.Parameters.Append objCmd.CreateParameter ("@ApprovalTypeID",3,&H0001,,constApprovalTypeWebsiteAccess )
objCmd.Execute
dwResult = CLng(objCmd.Parameters("RETURN_VALUE"))
set objCmd = nothing
objConn.Close
set objConn = nothing
if dwResult = 1 then
Session("Authenticated") = "Yes"
DoRedirect
end if
if dwResult = 2 then
DoNoAccess
end if
if dwResult = 3 then
DoApproval
end if
if (Request("Authentication") = "seen") then
if Request.Form("chkAgree") <> "ON" then
fBadCheck = True
else
fAgreeCheck = True
end if
szEmail = CStr(Request.Form("txtEmail"))
if StrComp(szServerEmail, szEmail, vbTextCompare) <> 0 or szServerEmail = "" then
fBadEmail = True
end if
if fLimited then
szReason = CStr(Request.Form("txtReason"))
if Len(szReason) = 0 then
fBadReason = True
end if
end if
if Not fBadEmail and Not fBadCheck and not fBadReason then
if Not fLimited then
Session("Authenticated") = "Yes"
AddAuthenticationLevel szServerEmail, szServerDomain, constAccessAuthorized
DoRedirect
else
AddAuthenticationLevel szServerEmail, szServerDomain, constAccessAuthorized
ProcessApproval szServerEmail, szServerDomain, szReason
end if
end if
end if
%>