Appboard/2.4/admin/provisioning/custom jsp: Difference between revisions

imported>Jason.nicholls
(Created page with '{{DISPLAYTITLE:Custom JSP Provisioning}} Category:AppBoard 2.4 == Overview == == Custom JSP Instructions == This section details the procedures for implementing the Custom…')
 
imported>Jason.nicholls
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:Custom JSP Provisioning}}
{{DISPLAYTITLE:Custom JSP Provisioning}}
[[Category:AppBoard 2.4]]
[[Category:AppBoard 2.4]]
== Overview ==
== Overview ==


Another way to manage domains, users, roles, and role assignments is through the creation of a custom Java Server Page (JSP) that is run on the AppBoard server and exposed an web interface for management purposes.


== Custom JSP Instructions ==
This document covers an example JSP implementation.
This section details the procedures for implementing the Custom JSP solution for direct provisioning.
 


{{Note|This section documents an optional customization to AppBoard/enPortal that is not part of the core system or supported under the standard product maintenance contract. It is recommended that this solution be implemented as part of a consulting engagement to ensure that it is configured and implemented correctly. This solution offers some pieces of provisioning, but does not offer all of the provisioning options that are available in the application's web administration interface.}}
{{Warning|Creating custom JSPs that interface with AppBoard is not directly supported under the standard product maintenance contract. It is recommended this type of solution be implemented as part of a  
consulting engagement to ensure that it is configured and implemented correctly.   }}




Line 17: Line 16:
# Save the code shown in the "JSP Code" section below into a text file with the file name: selfProvisioning.jsp
# Save the code shown in the "JSP Code" section below into a text file with the file name: selfProvisioning.jsp
# Modify the code as appropriate to meet the needs of the customer.
# Modify the code as appropriate to meet the needs of the customer.
# Save the file in to <tt>${Application_Home}/server/webapps/enportal/pkg/system/selfProvisioning.jsp</tt>
# Save the file in to <tt>[INSTALL_HOME]/server/webapps/enportal/pkg/system/selfProvisioning.jsp</tt>
# Invoke the self-provisioning options through the URL.  See details and examples provided below under <i>Applying Provisioning Updates</i>
# Invoke the self-provisioning options through the URL.  See details and examples provided below under <i>Applying Provisioning Updates</i>
# After creating the desired Users in the system, delete the <tt>selfProvisioning.jsp</tt> file from the system, so that users do not access the provisioning capabilities.
# After creating the desired Users in the system, delete the <tt>selfProvisioning.jsp</tt> file from the system, so that users do not access the provisioning capabilities.

Revision as of 14:58, 16 July 2014

Overview

Another way to manage domains, users, roles, and role assignments is through the creation of a custom Java Server Page (JSP) that is run on the AppBoard server and exposed an web interface for management purposes.

This document covers an example JSP implementation.

Template-warning.png
Creating custom JSPs that interface with AppBoard is not directly supported under the standard product maintenance contract. It is recommended this type of solution be implemented as part of a consulting engagement to ensure that it is configured and implemented correctly.


Installation and Configuration

Perform the following steps to install the Custom JSP for direct provisioning:

  1. Save the code shown in the "JSP Code" section below into a text file with the file name: selfProvisioning.jsp
  2. Modify the code as appropriate to meet the needs of the customer.
  3. Save the file in to [INSTALL_HOME]/server/webapps/enportal/pkg/system/selfProvisioning.jsp
  4. Invoke the self-provisioning options through the URL. See details and examples provided below under Applying Provisioning Updates
  5. After creating the desired Users in the system, delete the selfProvisioning.jsp file from the system, so that users do not access the provisioning capabilities.


Template-warning.png
As long as the selfProvisioning.jsp file is placed in the system, the direct provisioning capabilities can be implemented by any User who has knowledge of the commands and access to the server in a browser.


JSP Code

[xml,N]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%@ page import="java.util.*" import="com.edgetech.eportal.component.*" import="com.edgetech.eportal.user.*" import="com.edgetech.eportal.session.*" import="com.edgetech.eportal.util.*" import="com.edgetech.eportal.user.impl.*" import="com.edgetech.util.logger.*" import="com.edgetech.eportal.directory.*" import="com.edgetech.eportal.executive.impl.PrivilegedServiceRegistry" import="com.edgetech.eportal.executive.ServiceRegistry" import="com.edgetech.eportal.session.impl.SessionServiceImpl" import="com.edgetech.eportal.web.JSPUtilities" import="com.edgetech.eportal.config.Config" %> <jsp:useBean id="JspConfigBean" scope="application" class="com.edgetech.util.config.JspConfig" /> <%@ taglib uri="/PortalTagLibrary" prefix="portal" %> <%

String username = request.getParameter("uid"); String password = "ChangeMe"; // Note: the initial password is set to "ChangeMe"! String domainName = request.getParameter("domain"); String rolePath = request.getParameter("rolePath");

String errorMessage = "";

if (username != null && domainName != null && rolepath != null) { SessionServiceImpl sessionService = null; AuthenticationToken systemSession = null; try{ sessionService = (SessionServiceImpl)PrivilegedServiceRegistry.getSessionService();

systemSession = sessionService.createSystemSession();

UserService userService = ServiceRegistry.getUserService(systemSession); Domain domain = UserPackageToolkit.makeDomain(domainName);

Role role = UserPackageToolkit.makeRoleFromAbsoluteString(rolePath); String[] roleArray = rolePath.substring(1).split("/"); // Ignore the leading '/'

userService.createRole(roleArray);

String[] userArray = username.split(","); for (int i=0; i< userArray.length; i++) { User user = UserPackageToolkit.makeUser(domainName, userArray[i].trim()); userService.createUser(domain, userArray[i].trim(), password); userService.assignUserToRole(user, role); }


} catch (Exception exp) { errorMessage = exp.getMessage(); exp.printStackTrace(); } finally { // Terminate the system session. sessionService.terminateSession(systemSession, SessionService.TERMCODE_LOGOUT); } if (errorMessage.equals("")) { %> <html> <head> <LINK href='<%=JSPUtilities.out(URLUtil.getPortalContext(), true)%>/framework/styles/editors.css' type=text/css rel=stylesheet> <script type="text/javascript" src='<%=JSPUtilities.out(URLUtil.getPortalContext(), true)%>/framework/js/browser.js'></script>

</head> <body>




<% out.println("User Creation successful. Please login to Portal."); %>


<button onClick="return cancel();" class=fixedWidth>Ok</button>

</body> </html> <% return; } else { // re-write errorMessage here.// } }

%> <html> <head> <title>Self Provisioning Form</title> <LINK href='<%=JSPUtilities.out(URLUtil.getPortalContext(), true)%>/framework/styles/editors.css' type=text/css rel=stylesheet> <script type="text/javascript" src='<%=JSPUtilities.out(URLUtil.getPortalContext(), true)%>/framework/js/browser.js'></script>

<script type="text/javascript"> var warned=""; function saveChanges(actionType) {

   if (validateInput(document.inputForm))
   {
       document.inputForm.actionType.value = actionType;
       document.inputForm.submit();
   }
   return false;

}

function validateInput(workerForm) {

   if ( ! isValidUsernameFieldType(workerForm.uid, "User Name", true, false))
   {
       workerForm.uid.focus();
       return false;
   }
   else if ( emptyString.test(workerForm.rolePath.value))
   {
       alert('Role cannot be empty.');
       workerForm.rolePath.focus();
       return false;
   }
   else if (emptyString.test(workerForm.domain.value))
   {
       alert('domain cannot be empty.');
       workerForm.domain.focus();
       return false;
   }
   return true;

}

</script> </head>

<body>

<form name="inputForm" method="POST" action=""> <input type="hidden" name="actionType">

Self Provisioning

<%=JSPUtilities.out(errorMessage)%>

<tbody> </tbody>
New User Name
<input value="" name="uid" size="200" maxlength="2000" type="text">
role
<input value="" name="rolePath" size="15" type="text">
domain
<input value="" name="domain" size="15" type="text" >

</form>


<button onClick="return saveChanges('Ok');" class=fixedWidth>Continue</button>

  <button onClick="return cancel();" class=fixedWidth>Cancel</button>

</body> </html>



Usage

  1. uid, domain, and rolePath are required parameters in order for the provisioning code to run.
  2. Each new User's password is defaulted to "ChangeMe".


Applying Provisioning Updates

Perform the following steps to apply provisioning updates using the Custom JSP:

  1. Follow the steps above under Installation and Configuration to save the JSP code into the system.
  2. Enter a URL into the browser to invoke the self-provisioning command. The URL will have the following format:
    • http://<serverhost>:<port>/enportal/pkg/system/selfProvisioning.jsp?uid=<userid01>,<userid02>,...,<userid_n>&domain=<DomainName>&rolePath=<RoleName>
  3. Each user will be added to the system under the indicated Domain, and will be assigned the indicated Role.


Examples:

  • http://localhost:8080/enportal/pkg/system/selfProvisioning.jsp?uid=jMurphy ,rJohnson ,bAckerman&domain=SafeCo&rolePath=/NOC
  • http://rimagicor.com:8081/enportal/pkg/system/selfProvisioning.jsp?uid=INM18483 ,INM20170 ,INM05057 ,INM02642 ,INM05166 ,INM02642 ,INM31735 ,INM20170&domain=CustomerA&rolePath=/Users/East/Home
  • http://myservername/enportal/pkg/system/selfProvisioning.jsp?uid=bill.thompson,amy.dobson,yolanda.pence&domain=North&rolePath=/SystemAdmin