<% '------------------------------------------------------------ 'InputForAddEditUser.asp '------------------------------------------------------------ 'Author: Michael R. Miller (mimr), Chevron Park, B1317 'Purpose: '------------------------------------------------------------ Dim strPageName strPageName="InputForAddEditUser.asp" %> <% '*** Code layer (No special styling added) %>
<% Dim strUserId Dim strAction Dim blnIsExternalUser Dim strTitle Dim strSubTitle Dim objUsersRO Dim rsUserAttr Dim arrUserAttr Dim objCountriesRO Dim rsCountries Dim objSecurityRO Dim rsRoles Dim rsUserRoles Dim arrUserRoles Dim strRoleName Dim strRoleNameToDisplay Dim strCheckBoxStatus Dim i Dim strButtonStatus Dim strFirstName Dim strLastName Dim strEmail Dim strPhone Dim strCompany Dim strCountry Dim strValidationEvent '*** Initialize variables strUserId = Trim(Request("strUserId")) strAction = Trim(Request("strAction")) '*** Process action type If strAction = "Edit" Then strTitle = "Edit User" strSubTitle = "Note: In case you do Not want to change user's password, you may leave it blank." '*** Get the user attributes and assign to an array Set objUsersRO = Server.CreateObject("ChvCITCUserMgr.clsUsersRO") Set rsUserAttr = objUsersRO.rsGetUserInfo(strUserId) If Err.number <> 0 Then call HandleError(Err.number,Err.Source,Err.Description, strPageName) strFirstName = rsUserAttr.Fields("first_name").Value & "" strLastName = rsUserAttr.Fields("last_name").Value & "" strEmail = rsUserAttr.Fields("email").Value & "" strPhone = rsUserAttr.Fields("phone").Value & "" strCompany = rsUserAttr.Fields("company").Value & "" strCountry = rsUserAttr.Fields("country").Value & "" If rsUserAttr.Fields("extranet_only").Value = "0" Then blnIsExternalUser = False Else blnIsExternalUser = True End If ElseIf strAction = "Create" Then strTitle = "Create User" strSubTitle = "" '*** If internal user then initialize user attributes from previous form (from the CTN object) blnIsExternalUser = Cbool(Trim(Request("blnIsExternalUser"))) If blnIsExternalUser = False Then strFirstName = Trim(Request("strFirstName")) strLastName = Trim(Request("strLastName")) strEmail = Trim(Request("strEmail")) strPhone = Trim(Request("strPhone")) strCompany = Trim(Request("strCompany")) strCountry = Trim(Request("strCountry")) '*** Else leave as empty strings (the attributes will be entered by a site administrator) Else strEmail = strUserId End If Else Err.Raise vbobjecterror + 512, "InputForAddEditUser.asp","Invalid form action" End If If blnIsExternalUser = True Then strValidationEvent = "onSubmit='return Validate(this);'" Else strValidationEvent = "" End If %>

<%=strTitle%>

<%=strSubTitle%>
> <% If blnIsExternalUser = True Then %> <% End If %>
<% If blnIsExternalUser = True Then %> <% End If %> <% If blnIsExternalUser = False Then %> <% Else %> <% End If %> <% If blnIsExternalUser = False Then %> <% Else %> <% End If %> <% If blnIsExternalUser = False Then %> <% Else %> <% End If %> <% If blnIsExternalUser = False Then %> <% Else %> <% End If %> <% If blnIsExternalUser = False Then %> <% Else %> <% If blnIsUserAuthorizedForTask("PUBLISHER_ADMIN") = True Then %> <% End If If blnIsUserAuthorizedForTask("MODIFY_SECURITY_DATA") Then strButtonStatus = "" Else strButtonStatus = "disabled" End If %>
User Id: <%=strUserId%>
Password:
Re-Enter Password:
First Name:<%=strFirstName%>
Last Name:<%=strLastName%>
Phone:<%=strPhone%>
Email: <%=strEmail%>
Company:<%=strCompany%>
User's Home Country:<%=strCountry%>

User Roles <% '*** Create a set of check boxes for all of the possible roles the user can belong to Set objSecurityRO = Server.CreateObject("ChvCITCSecurityMgr.clsSecurityRO") Set rsRoles = objSecurityRO.rsGetRoles(gstrAppInstAbbr) rsRoles.sort = "GROUPNAME" If Err.number <> 0 Then Call HandleError(Err.number,Err.Source,Err.Description, strPageName) '*** If "Edit" then get the user's currently assigned roles If strAction = "Edit" Then Set rsUserRoles = objUsersRO.rsGetUserRoles(gstrAppInstAbbr, strUserId) If Err.number <> 0 Then call HandleError(Err.number,Err.Source,Err.Description, strPageName) If Not (rsUserRoles.EOF And rsUserRoles.BOF) Then arrUserRoles = rsUserRoles.GetRows End If If Not (rsUserRoles Is Nothing) Then Set rsUserRoles = Nothing End If '*** Iterate through the roles and add a checkbox for each role If Not (rsRoles.EOF And rsRoles.BOF) Then rsRoles.MoveFirst While Not rsRoles.EOF '*** Format the role name for display strRoleName = Trim(rsRoles.Fields("GROUPNAME").Value & "") strRoleNameToDisplay = Trim(Replace(Replace(strRoleName,"EQT", ""),"_"," ")) '*** If "Edit" Then determine if the current role is assigned to this user If strAction = "Edit" Then strCheckBoxStatus = "" '*** Loop through the array of user roles setting the checkbox status if a match is found If IsArray(arrUserRoles) Then For i = 0 to UBound(arrUserRoles,2) If arrUserRoles(0,i) = strRoleName Then strCheckBoxStatus = "checked" End If Next End If '*** Else set checkbox status as unchecked Else strCheckBoxStatus = "" End If '*** Display the checkbox %> <% rsRoles.MoveNext Wend Else %>

No roles have been defined

<% End If If Not (rsRoles Is Nothing) Then Set rsRoles = Nothing If Not (objSecurityRO Is Nothing) Then Set objSecurityRO = Nothing %>
name="chkRoles" value="<%=strRoleName%>"><%=strRoleNameToDisplay%>

MBP's Owned <% Dim objPublisherRO Dim rsMBPs Dim rsUserMBPs Dim arrUserMBPs Dim strMBPName '*** Create a set of check boxes for each MBP that a user can be an owner of Set objPublisherRO = Server.CreateObject("ChvCITCPublisher.clsPublisherRO") Set rsMBPs = objPublisherRO.rsGetMBPs(gstrAppInstAbbr) If Err.number <> 0 Then Call HandleError(Err.number,Err.Source,Err.Description, strPageName) '*** If "Edit" then get the user's currently assigned MBPs If strAction = "Edit" Then Set rsUserMBPs = objUsersRO.rsGetUserMBPs(gstrAppInstAbbr, strUserId, True) If Err.number <> 0 Then call HandleError(Err.number,Err.Source,Err.Description, strPageName) If Not (rsUserMBPs.EOF And rsUserMBPs.BOF) Then arrUserMBPs = rsUserMBPs.GetRows End If If Not (rsUserMBPs Is Nothing) Then Set rsUserMBPs = Nothing If Not (objUsersRO Is Nothing) Then Set objUsersRO = Nothing End If '*** Iterate through the MBPs and add a checkbox for each MBP If Not (rsMBPs.EOF And rsMBPs.BOF) Then rsMBPs.MoveFirst While Not rsMBPs.EOF strMBPName = Trim(rsMBPs.Fields("process_name").Value & "") '*** If "Edit" Then determine if the current role is assigned to this user If strAction = "Edit" Then strCheckBoxStatus = "" '*** Loop through the array of user MBPs setting the checkbox status if a match is found If IsArray(arrUserMBPs) Then For i = 0 to UBound(arrUserMBPs,2) If arrUserMBPs(0,i) = strMBPName Then strCheckBoxStatus = "checked" End If Next End If '*** Else set checkbox status as unchecked Else strCheckBoxStatus = "" End If '*** Display the check box %> <% rsMBPs.MoveNext Wend Else %>

No MPBs have been defined

<% End If If Not (rsMBPs Is Nothing) Then Set rsMBPs = Nothing If Not (objPublisherRO Is Nothing) Then Set objPublisherRO = Nothing %>
name="chkMBPs" value="<%=strMBPName%>"><%=strMBPName%>
value="Submit">
<%=htmlGetPasswordRules()%>
<%'Footer include file closes the BODY & HTML tags %>