 | Level: Intermediate Ehab AbuShmais (ehaba@us.ibm.com), Advanced Technical Services Engineer, IBM
29 Mar 2007 In the past, accessing U2 SB+ for UniData and UniVerse security from outside of SB+ security screens was difficult. But now, you can use a new function, SH.SEC.API, to talk to SB+ security using routine calls when outside of SB+ security screens and reports. SB+ Release 5.4.0 makes it significantly easier for the system administrator to maintain SB+ security. This article teaches you how to implement this API and includes detailed programming examples.
Introduction
SB+, IBM® SystemBuilder, is a cross-platform, complete and powerful rapid application development and deployment environment that enables developers to focus on what they know best: their application, their business and their users. SB+ lets you quickly design IBM U2 data server structures and develop applications using a comprehensive developer interface. And, you there's no need to handwrite code.
SB+ provides a comprehensive security system. Within the SB+ security system, you can define users and groups of users within a hierarchy of parent-child relationships while logged onto SB+ but only using SB+ security screens. Any attempt to amend or create SB+ user or group security records outside of SB+ configuration screens results in security violation and security record corruption. However, SB+ Version 5.4.0 implements a security API for applications developed in SB+. This API integrates the settings in the application with SB+ user and group security, thus enabling users with appropriate permissions to update SB+ user and group security records from outside of SB+ configuration screens.
This article teaches you how to use the SH.SEC.API function to access, control and manage SB+ security when outside of SB+ security setup screens and reports using BASIC programs. As of version 5.4.1 of SB+, there are 12 available options that can be passed through PARAM (in other words, the subroutine call includes 12 options), as described in Table 1 below.
This capability does require:
- The user initiating this program be in the SB+ ROOT group
- A control flag be set to 1 for the subroutine to take the effect:
SB.CONTROL <15,16>
To set this flag, edit the DMCONT file and the SB.CONTROL record, or set the value equal to 1 through a BASIC program.
Note: If this flag is not set the user subroutine will not be invoked.
Additional notes:
- When executing this routine, an SB+ message is sent to all the other ROOT group members informing them of this. This message contains details about the subroutine: which user ran the security API, as well as the date and time it was run, and from what IP address.
- Changes through this function are tracked by Sarbanes Oxley Reports (SOX).
- To adhere to SB+ standard conventions, you should use uppercase user and group IDs when creating new ones. The developer is responsible for this validation as well as any information that goes into the record.
- When running any SH.SEC.API parameters in a program to amend security, the API respects record locking. This means the record cannot be opened in SB+ security setup screens while the API program is trying to amend the same record. In this case, a record locked message is displayed.
Examples of the available API options
PARAM 1: Create a new user record in SB+ security
The following BASIC program uses the SH.SEC.API to create a new userid in SB+ based on a record from another file. The idea is to collect all the relevant information to create a new SB+ userid, using a customized interface, and store it on a file that this program can access. To help you build a customized interface, we provide you with the user record definition layout that SB+ expects. As a developer you are responsible for all field validation within your customized user and group security screen. For your convenience, the complete user definition layout is included at the end of this document. The requirements for creating a new user record using SH.SEC.API are provided in Table 2: User Definitions Record Layout.
The following attributes are the minimum requirements for creating a new user record: 1-5, 10, 15, 16, 21, 27 (including all multi-values), and 28
The following steps are necessary to successfully test the following example:
- Create a file and call it SEC.FILE.
- Copy DMSECURITY "~SB" for the
TO: prompt type (SEC.FILE BASE) and press Enter.
- Amend the record BASE by changing line 4, "password", to XXXX.
- Run the program example below.
The program example will create a new user called "NEWUSER" based on the record BASE from the file SEC.FILE with password XXXX. The password will be changed and encrypted after first logon with this userid. The user will be prompted to change the password from XXXX to a new password.
Program example 1
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
OPEN "SEC.FILE" TO MYFILE ELSE STOP
READ RECORD FROM MYFILE,"BASE" ELSE RECORD = ""
VALUE = "~NEWUSER"
PARAM = 1
CALL SH.SEC.API
|
PARAM 2: Amend an existing user record in SB+ security
Note: The user record must exist and must have no null flags. Validation will fail and you will not be able to amend an existing user record if any of the user flags are not set.
Program example 2
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
*
READ RECORD FROM F.PASS,"~NEWUSER" ELSE RECORD =""
RECORD<3> = "FIRSTNAME"
PARAM = 2
CALL SH.SEC.API
|
PARAM 3: Delete a user record from SB+ security
Program example 3
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
VALUE = "~NEWUSER"
PARAM = 3
CALL SH.SEC.API
|
PARAM 11: Create a new SB+ group record
The minimum requirement for creating a new SB+ group is a record with the first three attributes from Table 3: Group Definitions Record Layout at the end of this document.
- Type = "G"
- Description
- Parent Group Code
Program example 4
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
OPEN "SEC.FILE" TO MYFILE ELSE STOP
READ RECORD FROM MYFILE,"BASEG" ELSE RECORD = ""
KEY = "NEWGROUP"
PARAM = 11
CALL SH.SEC.API
|
PARAM 12: Amend an existing SB+ group record
Program example 5
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
READ RECORD FROM F.PASS, "NEWGRP" ELSE RECORD = ""
RECORD<2> = "NEW DESCRIPTION"
PARAM = 12
CALL SH.SEC.API
|
PARAM 13: Delete an existing group record
Program example 6
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "NEWGRP"
PARAM = 13
CALL SH.SEC.API
|
PARAM 15: Retrieve all restricted account access for a group
Program example 7
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 15
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
PARAM 16: Retrieve all unrestricted account access for a group
Program example 8
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 16
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
PARAM 17: Retrieve allowed processes
Program example 9
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 17
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
PARAM18: Retrieve disallowed processes
Program example 10
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 18
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
PARAM 19: Retrieve allowed menu options
Program example 11
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 19
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
PARAM 20: Retrieve disallowed menu options
Program example 12
$INCLUDE DMSKELCODE COMMON
$INCLUDE DMSKELCODE STANDARD.EQU
KEY = "ROOT"
PARAM = 20
CALL SH.SEC.API
CRT "VALUE IS: ":VALUE
|
Table 1. The 12 available options for SH.SEC.API
| Option | PARAM | Function |
|---|
| 1 | 1 | Create user record |
|---|
| 2 | 2 | Amend user record |
|---|
| 3 | 3 | Delete user record |
|---|
| - | 4-10 | Reserved |
|---|
| 4 | 11 | Create group record |
|---|
| 5 | 12 | Amend group record |
|---|
| 6 | 13 | Delete group record |
|---|
| 7 | 15 | Retrieve all restricted account access for a group |
|---|
| 8 | 16 | Retrieve all unrestricted account access for a group |
|---|
| 9 | 17 | Retrieve allowed processes |
|---|
| 10 | 18 | Retrieve disallowed processes |
|---|
| 11 | 19 | Retrieve allowed menu options |
|---|
| 12 | 20 | Retrieve disallowed menu options |
|---|
Table 2. User Definitions Record Layout
| AMC.VMC | Description |
|---|
| 1 | Type = "U" |
|---|
| 2 | Surname |
|---|
| 3 | First Name |
|---|
| 4 | Password (Encrypted) |
|---|
| 5 | Group Code (4 Alpha) |
|---|
| 10 | User Status Code (Active,Logged,Misc,Resigned, Network,Developer) |
|---|
| 15 | Keyboard Lock (Mins) |
|---|
| 16 | User defined Macro Lead-in Character |
|---|
| 21 | Nick-Name for Office use, friendlier status |
|---|
| 27.MC | Flags for user key insertion |
|---|
| 27.1 | Full Refresh Of Whole Screen (N/Y) |
|---|
| 27.2 | Auto Help Display (N/Y/M/A) |
|---|
| 27.3 | Suppress Confirm On Screen Esc (N/Y) |
|---|
| 27.4 | Command Stack Per Account (N/Y) |
|---|
| 27.5 | Suppress Beep On Error (N/Y) |
|---|
| 27.6 | Auto Extend Field Length (N/Y/D) |
|---|
| 27.7 | Suppress Logon Message Delay (N/Y/M/A) |
|---|
| 27.8 | Show errors in dialog box (N/Y/) |
|---|
| 27.9 | Main Heading Justification (C=0/L=1/R=2) |
|---|
| 27.10 | GUI User preferences - Add Fkey ref. to buttons |
|---|
| 27.11 | Center all screens |
|---|
| 27.12 | Center all menus (1,3,4) |
|---|
| 27.13 | Center/position help |
|---|
| 27.14 | Center/position lookups |
|---|
| 27.15 | Generate GUI screen code - not used |
|---|
| 27.16 | Grey Out Disabled Forms |
|---|
| 27.17 | Deselect before Int. Help |
|---|
| 27.18 | ECLType 'U' (N/Y) |
|---|
| 27.19 | Disable 1st Level Help (use HELP_STRING) |
|---|
| 27.20 | Suppress E19 (derived fld/conv) in FD tool (N/Y) |
|---|
| 27.21 | Use "sbplistlistviewclass" for GUI Selects |
|---|
| 27.22 | GUI User preferences - Menu Navigation Method |
|---|
| 27.23 | Self-Contained Forms Flag |
|---|
| 27.24 | Disable SBClient Tooltips |
|---|
| 27.25 | Use Windows Edit Menu (GUI Click) |
|---|
| 27.26 | Language Code |
|---|
| 27.27 | Temporary Quiet Mode Flag |
|---|
| 27.28 | Date format - International or American |
|---|
| 27.29 | New password next login (N/Y) |
|---|
| 27.30 | Autologin Flag (0,1,2) |
|---|
| 28.MD | Flags in attribute 27 converted (N=0,Y=1,D=2,M=2,A=3) |
|---|
| Code | Description |
|---|
| M | Multi-Value |
|---|
| C | Controlling Field |
|---|
| D | Dependent Field |
|---|
| W | Work Field |
|---|
Table 3. Group Definitions Record Layout
| AMC.VMC | Description |
|---|
| 0 | Group Code (Alpha) |
|---|
| 1 | Type = "G" |
|---|
| 2 | Description |
|---|
| 3 | Parent Group Code |
|---|
| 4.MC | Child Group Codes |
|---|
| 5.MC | Accounts Un-Restricted List |
|---|
| 6.MC | Restricted Accounts List |
|---|
| 7 | Inhibit Break Key (Y/N) |
|---|
| 8 | Inhibit Supervisor (Y/N) |
|---|
| 9 | Inhibit Process From Inputs (N/C/A) |
|---|
| 10 | Inhibit TCL (Y/N) |
|---|
| 11 | Keyboard Lock Upper Limit (Mins) |
|---|
| 12.1 | Allow or Disallow Verbs list (A/D) |
|---|
| 12.MC | Restricted Verbs |
|---|
| 13.MC | Valid Report Locations |
|---|
| 14.MC | Users of this Group |
|---|
| 15.MC | Active Dates OR Days (Start Date or Day of Week) |
|---|
| 16.MD | Active Dates OR Days (Upto Date or Day of Week) |
|---|
| 17.MD | Active Logon From Times |
|---|
| 18.MD | Active Logon Upto Times |
|---|
| 19 | Password Rollover Date Expression |
|---|
| 20 | Check-Sum |
|---|
| 21.MC | Last Maintained by |
|---|
| 22.MD | Last Maintained Date |
|---|
| 23W | <12.M> (Y/N) |
|---|
| 25.MW | Unrestricted Accounts up Tree |
|---|
| 26.MW | Restricted Accounts up Tree |
|---|
| 27.MW | Restricted Verbs Up Tree |
|---|
| 28.MW | Restricted Files Up Tree |
|---|
| 29.M | Group Printer Defaults |
|---|
| 30.M | Group Aux Print Defaults |
|---|
| Code | Description |
|---|
| M | Multi-Value |
|---|
| C | Controlling Field |
|---|
| D | Dependent Field |
|---|
| W | Work Field |
|---|
Conclusion
Hopefully, this article enables you to take full advantage of the new SB+ security API. It provided an explanation of the new feature, descriptions of the 12 options within the feature, and examples for each. You've gained knowledge about the background of the SB+ Security API and its power to give you, as a developer, the ability to customize your own security front end to communicate with SB+ security. Now, you know how to enable the SB+ Security API in your environment and how to deploy each of the security API's option.
Resources Learn
Get products and technologies
-
Download IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Rational®, Tivoli®, and WebSphere®.
-
Build your next development project with
IBM
trial software, available for download directly from developerWorks.
Discuss
About the author  | 
|  | Ehab AbuShmais is an SB+ software engineer with 11 years of experience in SB+ products support, engineering, and consulting. Ehab is the author of the book Building Applications Using IBM SB+ GUI. Ehab has a Bachelor of Science in Information Systems Engineering from Southern Polytechnic State University, and a Master of Science in Computer Information Systems from University of Denver. |
Rate this page
|  |