Вы находитесь на странице: 1из 30

''************************************************************************** ****************************************** '* Function: fnCheckAddUser() '* Description: This function checks in Database for all the parameters

for Add User functionality '* Parameters: None '* Returns: None '* Example: Call fnCheckAddUser() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckAddUser()

'Declaration and initialization of variables and recordset objects Dim sqlConn,sqlRecSet,vUserType, vUserName,vFirstName,vActualFirstName, vLastName,vActualLastName, vDepartment,vActualDepartment, vTimeZone, vPhoneNumber,vActualPhoneNumber, vClientName, vUserRoleName,vRemoveRole,vExist

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Call the function to retrieve the value of Username vUserName = fnGetValue("UserName")

'Check if the User name exists in Users table sqlQuery = "SELECT * FROM Portal.Users WHERE UserName ='" & vUserName & "'"

Set sqlRecSet=createobject("Adodb.recordset")

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Add User","User "& vUserName & "DOES NOT EXIST in the table Portal.Users" Else

'Check if First Name is present vFirstName = fnGetValue("FirstName") vActualFirstName = trim(sqlRecSet.Fields("FirstName")) If vFirstName <> "" Then If vActualFirstName = vFirstName Then Reporter.ReportEvent micPass,"Database Check: Add User","First Name '" & vFirstName & "' is present in the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Add User","Expected First Name = " & vFirstName & " but Actual First Name = '" & vActualFirstName & "' in the table Portal.Users" End If End If

'Check if Last Name is present vLastName = fnGetValue("LastName")

vActualLastName = trim(sqlRecSet.Fields("LastName")) If vLastName <> "" Then If vActualLastName = vLastName Then Reporter.ReportEvent micPass,"Database Check: Add User","Last Name '" & vLastName & "' is present in the table Portal.Users"

Else Reporter.ReportEvent micFail,"Database Check: Add User","Expected Last Name = " & vLastName & " but Actual Last Name = '" & vActualLastName & "' in the table Portal.Users" End If End If

'Check if Department is present vDepartment = fnGetValue("Department") vActualDepartment = trim(sqlRecSet.Fields("Department")) If vDepartment <> "" Then If vActualDepartment = vDepartment Then Reporter.ReportEvent micPass,"Database Check: Add User","Department '" & vDepartment & "' is present in the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Add User","Expected Department = '" & vDepartment & "' but Actual Department = '" & vActualDepartment & "' in the table Portal.Users" End If End If

'Check if Phone Number is present vPhoneNumber = fnGetValue("PhoneNumber") vActualPhoneNumber = trim(sqlRecSet.Fields("PhoneNumber"))

If vPhoneNumber <> "" Then If vActualPhoneNumber = vPhoneNumber Then Reporter.ReportEvent micPass,"Database Check: Add User","Phone Number '" & vPhoneNumber & "' is present in the table Portal.Users"

Else Reporter.ReportEvent micFail,"Database Check: Add User","Expected Phone Number = '" & vPhoneNumber & "' but Actual Phone Number = '" & vActualPhoneNumber & "' in the table Portal.Users" End If End If

'Check if Client Name is present vClientName = fnGetValue("ClientName") If vClientName <> "" Then sqlQuery = "SELECT A.NAME FROM Reporting.Clients A,Portal.RolesClientMapping B,Portal.UsersRolesMapping C,Portal.Users D WHERE " sqlQuery = sqlQuery & "A.ClientID = B.ClientId AND B.RoleId = C.RoleId AND C.UserId = D.UserId AND D.Username = '" & vUserName & "' AND " sqlQuery = sqlQuery & "A.Name = '" & vClientName &"'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Add User","Client Name '" & vClientName & "' DOES NOT exist in the table Reporting.Clients" Else

Reporter.ReportEvent micPass,"Database Check: Add User","Client Name '" & vClientName & "' exists in the table Reporting.Clients"

End If End If

'Check if Role Name is present vUserRoleName = fnGetValue("RoleName") If vUserRoleName <> "" Then sqlQuery = "SELECT A.ROLENAME FROM Portal.Roles A, Portal.UsersRolesMapping B,Portal.Users C WHERE " sqlQuery = sqlQuery & "A.RoleId = B.RoleId AND B.UserId = C.UserId AND A.RoleName = '" & vUserRoleName & "' AND " sqlQuery = sqlQuery & "C.Username = '" & vUserName & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Add User","Role Name '" & vUserRoleName & "' DOES NOT exist in the table Portal.Roles" Else Reporter.ReportEvent micPass,"Database Check: Add User","Role Name '" & vUserRoleName & "' exists in the table Portal.Roles"

End If

End If

End If

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function

''************************************************************************** ****************************************** '* Function: fnCheckAddUserRole() '* Description: This function checks in Database for the newly added Role name '* Parameters: None '* Returns: None '* Example: Call fnCheckAddUserRole() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckAddUserRole()

'Declaration and initialization of variables and recordset objects Dim sqlQuery,sqlConn,vRoleName,vUserName Set sqlRecSet=createobject("Adodb.recordset")

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

vRoleName = Environment.Value("RoleName") sqlQuery = "SELECT ROLENAME FROM Portal.Roles WHERE RoleName = '" & vRoleName & "' "

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Add User Role","Role Name '" & vRoleName & "' DOES NOT exist in the table Portal.Roles" Else Reporter.ReportEvent micPass,"Database Check: Add User Role","Role Name '" & vRoleName & "' exists in the in the table Portal.Roles" End If

'Close the Record Set object is if it already open

If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function

''************************************************************************** ****************************************** '* Function: fnCheckEditUser() '* Description: This function checks in Database for all the parameters for EditUser functionality '* Parameters: None '* Returns: None '* Example: Call fnCheckEditUser() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckEditUser()

'Declaration and initialization of variables and recordset objects

Dim sqlConn,sqlRecSet,vUserType, vUserName,vFirstName, vActualFirstName, vLastName, vActualLastName, vDepartment, vActualDepartment, vTimeZone, vPhoneNumber, vActualPhoneNumber, vClientName, vUserRoleName,vRemoveRole,vExist

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Call the function to retrieve the value of Username vUserName = fnGetValue("UserName")

'Check if the User name exists in Users table sqlQuery = "SELECT * FROM Portal.Users WHERE UserName ='" & vUserName & "'"

Set sqlRecSet=createobject("Adodb.recordset") 'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User","User '"& vUserName & "' DOES NOT EXIST in the table Portal.Users" Else 'Check if First Name is updated vFirstName = fnGetValue("FirstName")

vActualFirstName = trim(sqlRecSet.Fields("FirstName") ) If vFirstName <> "" Then If vActualFirstName = vFirstName Then Reporter.ReportEvent micPass,"Database Check: Edit User","First Name '" & vFirstName & "' is updated in the table Portal.Users"

Else Reporter.ReportEvent micFail,"Database Check: Edit User","Expected First Name = '" & vFirstName & "' but Actual First Name = '" & vActualFirstName & "' in the table Portal.Users" End If End If

'Check if Last Name is updated vLastName = fnGetValue("LastName") vActualLastName = trim(sqlRecSet.Fields("LastName") ) If vLastName <> "" Then If vActualLastName = vLastName Then Reporter.ReportEvent micPass,"Database Check: Edit User","Last Name " & vLastName & " is updated in the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Edit User","Expected Last Name = " & vLastName & " but Actual Last Name = '" & vActualLastName & "' in the table Portal.Users" End If End If

'Check if Department is updated vDepartment = trim(fnGetValue("Department")) vActualDepartment = sqlRecSet.Fields("Department")

If vDepartment <> "" Then If vActualDepartment = vDepartment Then Reporter.ReportEvent micPass,"Database Check: Edit User","Department " & vDepartment & " is updated in the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Edit User","Expected Department = '" & vDepartment & "' but Actual Department = '" & vActualDepartment & "' in the table Portal.Users" End If End If

'Check if Phone Number is updated vPhoneNumber = fnGetValue("PhoneNumber") vActualPhoneNumber = trim(sqlRecSet.Fields("PhoneNumber")) If vPhoneNumber <> "" Then If vActualPhoneNumber = vPhoneNumber Then Reporter.ReportEvent micPass,"Database Check: Edit User","Phone Number " & vPhoneNumber & " is updated in the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Edit User","Expected Phone Number = '" & vPhoneNumber & "' but Actual Phone Number = '" & vActualPhoneNumber & "' in the table Portal.Users" End If End If

'Check if Client Name is updated vClientName = fnGetValue("ClientName") If vClientName <> "" Then sqlQuery = "SELECT A.NAME FROM Reporting.Clients A,Portal.RolesClientMapping B,Portal.UsersRolesMapping C,Portal.Users D WHERE "

sqlQuery = sqlQuery & "A.ClientID = B.ClientId AND B.RoleId = C.RoleId AND C.UserId = D.UserId AND D.Username = '" & vUserName & "' AND " sqlQuery = sqlQuery & "A.Name = '" & vClientName &"'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User","Client Name '" & vClientName & "' DOES NOT exist in the table Reporting.Clients" Else Reporter.ReportEvent micPass,"Database Check: Edit User","Client Name '" & vClientName & "' exists in the table Reporting.Clients"

End If

End If

'Check if Role Name is updated vUserRoleName = fnGetValue("RoleName") If vUserRoleName <> "" Then sqlQuery = "SELECT A.ROLENAME FROM Portal.Roles A, Portal.UsersRolesMapping B,Portal.Users C WHERE " sqlQuery = sqlQuery & "A.RoleId = B.RoleId AND B.UserId = C.UserId AND A.RoleName = '" & vUserRoleName & "' AND " sqlQuery = sqlQuery & "C.Username = '" & vUserName & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User","Role Name '" & vUserRoleName & "' DOES NOT exist in the table Portal.Roles for the User '" & vUserName & "'" Else Reporter.ReportEvent micPass,"Database Check: Edit User","Role Name '" & vUserRoleName & "' exists in the table Portal.Roles for the User '" & vUserName & "'"

End If

End If

'Check if Role mentioned under RemoveRole field in input data sheet is removed vRemoveRole = fnGetValue("RemoveRole") If vClientName <> "" Then sqlQuery = "SELECT A.ROLENAME FROM Portal.Roles A, Portal.UsersRolesMapping B,Portal.Users C WHERE " sqlQuery = sqlQuery & "A.RoleId = B.RoleId AND B.UserId = C.UserId AND A.RoleName = '" & vRemoveRole & "' AND " sqlQuery = sqlQuery & "C.Username = '" & vUserName & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then

sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micPass,"Database Check: Edit User","Role Name '" & vUserRoleName & "' is removed from table Portal.Roles for the User '" & vUserName & "'" Else Reporter.ReportEvent micPass,"Database Check: Edit User","Role Name '" & vUserRoleName & "' is NOT removed from table Portal.Roles for the User '" & vUserName & "'" End If End If End If

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function

''************************************************************************** ****************************************** '* Function: fnCheckDeleteUser() '* Description: This function checks in Database if the User is deleted '* Parameters: None '* Returns: None '* Example: Call fnCheckDeleteUser() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckDeleteUser()

'Declaration and initialization of variables and recordset objects Dim sqlConn,sqlRecSet,vUserType, vUserName,vFirstName,vActualFirstName, vLastName,vActualLastName, vDepartment,vActualDepartment, vTimeZone, vPhoneNumber,vActualPhoneNumber, vClientName, vUserRoleName,vRemoveRole,vExist

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Call the function to retrieve the value of Username vUserName = fnGetValue("UserName")

'Check if the User name exists in Users table sqlQuery = "SELECT * FROM Portal.Users WHERE UserName ='" & vUserName & "' AND DELETED = '0'"

Set sqlRecSet=createobject("Adodb.recordset")

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micPass,"Database Check: Delete User","User "& vUserName & "is removed from the table Portal.Users" Else Reporter.ReportEvent micFail,"Database Check: Delete User","User "& vUserName & "is NOT removed from the table Portal.Users" End If

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If End Function

''************************************************************************** ****************************************** '* Function: fnCheckEditUserRole() '* Description: This function checks in Database for all the parameters for Edit User Role functionality '* Parameters: None '* Returns: None '* Example: Call fnCheckEditUserRole() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckEditUserRole()

'Declaration and initialization of variables and recordset objects Dim sqlConn,sqlRecSet,sqlQuery,vRoleName,vClientName,vPermission,vUserName

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Check if New Role Name is updated If vRoleName <> "" Then vRoleName = fnGetValue("NewRoleName") Else 'Assign the old Role name vRoleName = fnGetValue("RoleName")

End If

'Check if the Role name exists in Users table sqlQuery = "SELECT * FROM Portal.Roles WHERE RoleName ='" & vRoleName & "'"

Set sqlRecSet=createobject("Adodb.recordset")

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","User Role '"& vRoleName & "' DOES NOT EXIST in the table Portal.Roles" Else Reporter.ReportEvent micPass,"Database Check: Edit User Role","User Role '"& vRoleName & "' exists in the table Portal.Roles" End If

'Check if a new client is added vClientName = fnGetValue("NewClientName") If vClientName <> "" Then

sqlQuery = "SELECT A.NAME FROM REPORTING.Clients A,PORTAL.RolesClientMapping B,PORTAL.Roles C WHERE " sqlQuery = sqlQuery & "A.ClientID = B.ClientId AND B.RoleId = C.RoleId AND C.RoleName = '" & vRoleName &"' AND "

sqlQuery = sqlQuery & "A.Name = '" & vClientName &"'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","Client Name '" & vClientName & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Client Name '" & vClientName & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check the Permissions for the old client vClientName = fnGetValue("ClientName")

'Check if Credit Card / Debit Card Refund Requests only permission is set If lcase(fnGetValue("Credit_Debit_Refund_Requests")) = "yes" Then vPermission = "Credit Card / Debit Card Refunds Request Only" sqlQuery = "SELECT A.PERMISSION FROM PORTAL.Permissions A,Portal.RolePermissionMapping B,PORTAL.Roles C," sqlQuery = sqlQuery & "PORTAL.RolesClientMapping D,Reporting.Clients E WHERE A.PermissionId = B.PermissionId AND " sqlQuery = sqlQuery & "B.RoleId = C.RoleId AND C.RoleId = D.RoleId AND D.ClientId = E.ClientID AND E.Name = '" & vClientName & "' "

sqlQuery = sqlQuery & "AND C.RoleName = '" & vRoleName & "' AND A.Permission = '" & vPermission & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","Permission '" & vPermission & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Permission '" & vPermission & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check if Voids permission is set If lcase(fnGetValue("Voids")) = "yes" Then vPermission = "Voids" sqlQuery = "SELECT A.PERMISSION FROM PORTAL.Permissions A,Portal.RolePermissionMapping B,PORTAL.Roles C," sqlQuery = sqlQuery & "PORTAL.RolesClientMapping D,Reporting.Clients E WHERE A.PermissionId = B.PermissionId AND " sqlQuery = sqlQuery & "B.RoleId = C.RoleId AND C.RoleId = D.RoleId AND D.ClientId = E.ClientID AND E.Name = '" & vClientName & "' " sqlQuery = sqlQuery & "AND C.RoleName = '" & vRoleName & "' AND A.Permission = '" & vPermission & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","Permission '" & vPermission & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Permission '" & vPermission & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check if Notes permission is set If lcase(fnGetValue("Notes")) = "yes" Then vPermission = "Notes" sqlQuery = "SELECT A.PERMISSION FROM PORTAL.Permissions A,Portal.RolePermissionMapping B,PORTAL.Roles C," sqlQuery = sqlQuery & "PORTAL.RolesClientMapping D,Reporting.Clients E WHERE A.PermissionId = B.PermissionId AND " sqlQuery = sqlQuery & "B.RoleId = C.RoleId AND C.RoleId = D.RoleId AND D.ClientId = E.ClientID AND E.Name = '" & vClientName & "' " sqlQuery = sqlQuery & "AND C.RoleName = '" & vRoleName & "' AND A.Permission = '" & vPermission & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close

End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","Permission '" & vPermission & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Permission '" & vPermission & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check if Chargeback Management permission is set If lcase(fnGetValue("Chargeback_Management")) = "yes" Then vPermission = "Chargeback Management" sqlQuery = "SELECT A.PERMISSION FROM PORTAL.Permissions A,Portal.RolePermissionMapping B,PORTAL.Roles C," sqlQuery = sqlQuery & "PORTAL.RolesClientMapping D,Reporting.Clients E WHERE A.PermissionId = B.PermissionId AND " sqlQuery = sqlQuery & "B.RoleId = C.RoleId AND C.RoleId = D.RoleId AND D.ClientId = E.ClientID AND E.Name = '" & vClientName & "' " sqlQuery = sqlQuery & "AND C.RoleName = '" & vRoleName & "' AND A.Permission = '" & vPermission & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","Permission '" & vPermission & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Permission '" & vPermission & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check if E-Check Refunds Request Only is set If lcase(fnGetValue("ECheck_Refunds_Request")) = "yes" Then vPermission = "E-Check Refunds Request Only" sqlQuery = "SELECT A.PERMISSION FROM PORTAL.Permissions A,Portal.RolePermissionMapping B,PORTAL.Roles C," sqlQuery = sqlQuery & "PORTAL.RolesClientMapping D,Reporting.Clients E WHERE A.PermissionId = B.PermissionId AND " sqlQuery = sqlQuery & "B.RoleId = C.RoleId AND C.RoleId = D.RoleId AND D.ClientId = E.ClientID AND E.Name = '" & vClientName & "' " sqlQuery = sqlQuery & "AND C.RoleName = '" & vRoleName & "' AND A.Permission = '" & vPermission & "'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then

Reporter.ReportEvent micFail,"Database Check: Edit User Role","Permission '" & vPermission & "' DOES NOT exist in the Database for the User Role '" & vRoleName &"'" Else Reporter.ReportEvent micPass,"Database Check: Edit User Roler","Permission '" & vPermission & "' is updated in the Database for the User Role '" & vRoleName &"'" End If End If

'Check if a new User is added to this role vUserName = fnGetValue("AddUser") If vUserName <>"" Then sqlQuery = "SELECT A.ROLENAME FROM PORTAL.Roles A,PORTAL.UsersRolesMapping B,PORTAL.Users C WHERE " sqlQuery = sqlQuery & "A.RoleId = B.RoleId AND B.UserId = C.UserId AND C.Username = '" & vUserName &"' AND " sqlQuery = sqlQuery & "A.RoleName = '" & vRoleName &"'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Edit User Role","User '" & vUserName &"' IS NOT added to the User Role '" & vRoleName & "' in the Database" Else

Reporter.ReportEvent micPass,"Database Check: Edit User Role","User '" & vUserName &"' is added to the User Role '" & vRoleName & "' in the Database"

End If End If

'Check if an existing User is removed from this role vUserName = fnGetValue("RemoveUser") If vUserName <>"" Then sqlQuery = "SELECT A.ROLENAME FROM PORTAL.Roles A,PORTAL.UsersRolesMapping B,PORTAL.Users C WHERE " sqlQuery = sqlQuery & "A.RoleId = B.RoleId AND B.UserId = C.UserId AND C.Username = '" & vUserName &"' AND " sqlQuery = sqlQuery & "A.RoleName = '" & vRoleName &"'"

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micPass,"Database Check: Edit User Role","User '" & vUserName &"' is removed from User Role '" & vRoleName & "' in the Database" Else Reporter.ReportEvent micFail,"Database Check: Edit User Role","User '" & vUserName &"' IS NOT removed from User Role '" & vRoleName & "' in the Database" End If End If

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function

''************************************************************************** ****************************************** '* Function: fnCheckDeleteUserRole() '* Description: This function checks in Database for all the parameters for Edit User Role functionality '* Parameters: None '* Returns: None '* Example: Call fnCheckDeleteUserRole() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckDeleteUserRole()

'Declaration and initialization of variables and recordset objects

Dim sqlConn,sqlRecSet,sqlQuery,vRoleName,vClientName,vPermission,vUserName

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Assign the Role name vRoleName = fnGetValue("RoleName")

'Check if the Role name exists in Users table sqlQuery = "SELECT * FROM Portal.Roles WHERE RoleName ='" & vRoleName & "'"

Set sqlRecSet=createobject("Adodb.recordset")

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micPass,"Database Check: Delete User Role","User Role '"& vRoleName & "' is removed from the table Portal.Roles" Else Reporter.ReportEvent micFail,"Database Check: Delete User Role","User Role '"& vRoleName & "' IS NOT removed from the table Portal.Roles" End If

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function

''************************************************************************** ****************************************** '* Function: fnCheckSearchClient() '* Description: This function checks in Database for all the parameters for Edit User Role functionality '* Parameters: None '* Returns: None '* Example: Call fnCheckSearchClient() '* Created By: Thulasiram Devi '*************************************************************************** *********************************************

Function fnCheckSearchClient()

'Declaration and initialization of variables and recordset objects Dim sqlConn,sqlRecSet,sqlQuery,vRoleName,vClientName,vPermission,vUserName

' Oracle client is required to be installed on your box Set sqlConn=createobject("adodb.connection") sqlConn.open "Driver={SQL Server}; Server=172.20.9.52;Database={EnterpriseReporting};uid=ccadmin; pwd=Verdun1916"

'Assign the client name vClientName = fnGetValue("ClientName")

'Check if the Role name exists in Users table sqlQuery = "SELECT * FROM Reporting.Clients WHERE Name ='" & vClientName & "'"

Set sqlRecSet=createobject("Adodb.recordset")

'Close the Record Set object is if it already open If sqlRecSet.state=1 Then sqlRecSet.close End If sqlRecSet.open sqlQuery,sqlConn

If sqlRecSet.eof = -1 and sqlRecSet.bof = -1 Then Reporter.ReportEvent micFail,"Database Check: Search Client","Client name'"& vClientName & "' DOES NOT exist in the table Reporting.Clients in the Database" Else Reporter.ReportEvent micPass,"Database Check: Search Client","Client name'"& vClientName & "' exists in the table Reporting.Clients in the Database" End If

'Close the Record Set object is if it already open

If sqlRecSet.state=1 Then sqlRecSet.close End If

'Close the Connection object is if it already open If sqlConn.state=1 Then sqlConn.close End If

End Function