Using the Automated Tool

We've provided an automated FoxPro script - UserSecurityManager_AddToProject.prg - that can be used to update an existing Web Connection 7.0+ project by adding the necessary dependencies to integrate the User Security Manager.

In order for this automated tool to work you need:

  • A Web Connection 7.0+ project
  • A project that uses the well-known project web,deploy structure

You can use older version projects, but some portions (especially the Process class configuration) may not work as the tool makes assumptions for file locations and a few template strings contained in project files that are not generated by older projects. You can still run the tool and it will set what it can, but you'll want to go over the manual steps and compare settings to ensure settings were set properly.

Before Running this Tool

Please make sure you create a backup of your existing project. Either commit to source control or otherwise make a back up of your existing project. This tool will make changes to your existing project's code, and the changes are one-way and cannot be rolled back.

Backup first, ask questions later.

Run this Tool only once

Make sure you don't run this tool multiple times. If for some reason you need to re-run this tool, first revert back to a backup or previous source control state, then re-run. Running the tool multiple times will result in duplication of various settings and operations that can break your code.

Reference Project

As part of the download of this library, there's a reference integration project that is shippet in addition to the User Security Manager base project. The SecurityTest project contains a full integration of the User Security Manager that works and has all the integration steps applied so it makes for a good reference that you can compare your own project against.

Running the Automated Tool

To run the configuration tool open the UserSecurity Manager property and make sure the project works and runs (DO UserSecurityManagerMain.prg). Specifically make sure that all the paths are set properly so that Web Connection support files can be found.

For demonstration purposes I'll use SecurityTest and SecureyProcess as the project and process class names of the project to integrate into

  • Open the UserSecurityManager Project
  • Make sure you are running in the UserSecurityManager's Deploy folder
  • Make sure all paths are set (run DO SETPATHS or open with shortcut/config.fpw settings)
  • Make sure the project runs (DO UserSecurityMain and check requests)

Once the project runs properly run the integration tool UserSecurityManager_AddToProject.prg. In order to run it you'll need to pass two parameters:

  • Your project's Main prg file (SecurityTestMain.prg)
  • Your project's Process prg file (SecureProcess.prg)
  • Your project's primary script map extension (st without the .)

You should run (all one line):

UserSecurityManager_AddToProject(
  "c:\webconnectionProjects\SecurityTest\deploy\SecurityTestmain.prg",
  "c:\webconnectionProjects\SecurityTest\deploy\SecureProcess.prg",
  "st")

This tool will run very quickly and display a wait window when it's done.

The tool does the following:

  • Creates a UserSecurityManager folder in your project's Deploy folder
  • Copies UserSecurityManagerProcess and AppUserSecurity classes
  • Copies Web folder files (usermanager folder and _login.wcs in `Views)
  • Creates a scriptmap for .usm in your web.config
  • Hooks up the usm scriptmap in your main prg's Process() method
  • Hooks up UserSecurityManagerProcess in your main prg
  • Configures your Process class to use the new Auth code
  • Adds Sign in Widget into _layoutpage.wcs
  • Creates a default.st home page from default.htm if it doesn't exist

Once complete your application can now Login.usm, Logout.usm and Profile.usm to access the most common sign in features and the authentication form automatically routes to these requests. There's also an admin link for admin/UserList.usm for user administration.

Sign In Widget only used on Content Scripts and Templates

Remember that the default Signin Widget only shows up on Script and Template pages that use a _layout page. Any coded pages, or script pages that don't use the _layout page will need to explicitly add the sign in display in some other way. If you're using scripts you can explicit <%= RenderPartial("~/usermanager/LoginMenu_Partial.usm) %>.


© West Wind Technologies, 2018 • Updated: 11/13/18
Comment or report problem with topic