Websydian v6.1 online documentationOnline documentation - Websydian v6.5

Implementing the UserManagement Pattern


Inherit from the UserManagement Pattern

First, you must create a local User Management entity in your application model that inherits from the UserManagement pattern in the WSYUSER library:

Example:

MyUserMgt is a ENT UserManagement

The local MyUserMgt entity will scope the pattern to implement User Management.

Inherit from RelationalTable

The User entity scoped under the Data entity of the inherited UserManagement entity must inherit from RelationalTable.

Example:

MyUserMgt.Data.User is a ENT RelationalTable

Associate with Implemented Session Functionality

The UserManagement pattern contains an abstract version of the SessionControl pattern that is refered to by the User Management pattern.  This abstract SessionControl pattern must be replaced by the application specific Session Control entity.

Example:

MyUserMgt replaces ENT
...by ENT
MyUserMgt.Abstract.SessionControl
MySession

In addition, the implemented Session entity must inherit from the abstract Session data entity in User Management.  By this, the implemented Session entity will inherit a reference to the User entity.

Example:

MySession.Data.Session is a ENT MyUserMgt.Abstract.SessionControl.Data.Session

Replace Error Page

In most applications, an Error page function will be defined inheriting from the Websydian ErrorPage function pattern.  If so, references from the User Management pattern to the ErrorPage library function must be replaced with references to the implemented Error Page function.

Example:

MyUserMgt.Services replaces FNC
...by FNC
ErrorPage
MyErrorPage

Define Login Page as Entry Page

In an application with User Management functionality, the Entry page of the application will typically be the Login page scoped under the Services function provided the UserManagement pattern.  I.e. the first thing the user will do is to enter his user ID and password.

The Entry page of a Websydian application is generated by the Page Generator called by the CallFirstPageGenerator function scoped under the Dispatcher function.  This call must be specified in the Call to first page edit point.

Example:

Login Page called by Dispatcher

Login page included in User Management pattern is called as the Entry page of the web application.

Call First Real Page of Application

A Login Event Handler function is scoped under the WebLoginPage Page Generator function.  This Login function will perform the password validation and direct control to the next page to be sent to the web user.

Open the Login Event Handler function and in the edit point Call first page after login, add a call statement to the Page Generator to be called after the user has successfully logged onto the application.

Example:

Page Generator function called from Login Event Handler function

Page Generator function called from Login Event Handler function.

Declare Login Event Handler

All Event Handlers in a Websydian application must be declared by a calls-triple from the Dispatcher function.  This is also the case for the Login function.

Example:

MyDispatcher calls FNC MyUserMgt.Services.WebLoginPage.Login

Generate and Build

In order to implement the User Management functionality, the following objects (and their scoped objects) must be generated and built:

 

If you are using the iSeries variant of Websydian, warnings ("defaulting language to RPG") will appear for the web server functions using the internal display functions PasswordInput and PasswordOutput.  These warnings can safely be ignored.

Generate and Adjust Document Templates

To generate the Document Template for the Login page, run the _DocumentTemplateGenerator function scoped under the WebLoginPage service function.

If you want to protect the password during user entry, then open the generated Document Template and set the TYPE attribute to PASSWORD for the PasswordDisplayed field.

Run Windows Application and Enter Records in User Table

By now, the User table is empty.  User records including initial password settings must be created before it is possible for users to log onto the application.

The User Management pattern contains a small ready-to-run Windows application from which User records can be managed.  To enter User records, run the Grid function scoped under the User.EditDialog function.

Run Websydian Application with User Management

Finally, move the generated Document Templates and programs to the web server.  Now your application will be ready to run with User Management