Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Preconfigurations Runtime users management

Administrative management of users in runtime mode. The users with defined rights are saved in a csv file and then in the application memory.
 
This preconfiguration can be activated when creating a new object (e.g. by "New object" in the local object menu or by pressing the Insert key after selecting the object) and is included in the group: " / Panels (PmPanel) / User administration".

This preconfiguration can be used with the objects: PmFolder, PmRoot, PmPanel or PmWorkspace.

 
The preconfiguration is created including the panel (PmPanel object) functionality as a WEB panel.
 
The preconfiguration creates three PmPanel type objects. The main panel is titled "AdminUsers" and has two subobjects:
The "EditUsers" panel represents a modal window for adding new user or editin an existing one.
The "ChangePass" panel represents a modal window for changing the password of current user.
All these objects have, on the Permissions page, defined all items for the users from the $ADMIN group. The "AdminUsers" main panel is used for loading a table containing a user list and adding/editing them using the function buttons. The OpenView method is used for opening.
 
The main panel has the following methods:
Crypt - (complementary) for coding and decoding the user login password
GetGroup - (complementary) for loading the list of available user groups
GetUsers - (complementary) for loading the complete list of all users (saved in ini or pra file)
InitUsers - (essential) adds the users saved in the csv file into the running application
LoadUsers - (essential) loads the array containing all users with user rights from the csv file
SaveUsers - (essential) saves the array containing all users with user rights into the csv file
UserAdd - (essential) prepares the array for saving with the values updated from the user editing
UserChangePass - (essential) prepares the array for saving with modified value of password for selected user
UserRemove - (essential) prepares the array for saving without the values for deleted user

The basic essential method is InitUsers. It uses the AddUser method in order to add all users saved in the csv file into the running application. This method is always called when modifications are being made to user list and it also has to be called at application launch. The LoadUsers and SaveUsers methods are used for loading or saving all users together with their rights into the csv file. (It is possible to modify them in order to allow saving into some database table.) The EncryptText and DecryptText methods are used in the complementary Crypt method where the sSeed variable for coding and decoding the login password can be modified.

 
The main panel contains the PmTable graphic item and some PmiButton buttons. In the onStart table event, there is a script used for filling in the table with the list of users gathered from the csv file. The script in the CellClicked event allws to select a row. In the CellEditRequested event, a new EditUsers window is opened for editing the selected user. Button of PmiButton type contain the a script in the onButtonUp event, that executes the desired action.
 
The EditUsers panel is opened from the CellEditRequested event of the table or from buttons Add or Edit. The panel itself contains PmiWEdit, PmiText, PmiButton and PmTable graphic items. In the onStart event of the table, each graphic item is filled with the data of the edited user. These can be edited as needed and the confirmed and saved by the OK button.
 
The ChangePass panel is opened from the main panel by the Change password button. The panel contains the PmiWEdit, PmiText and PmiButton graphic items. In the onStart event of the PmiButton item the original user login data is saved into the hidden items. After the new user login data is entered and the OK pressed, the script compares the data and saves it.
These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the application object tree. This is a system name and must not contain empty string, diacritics, spaces and the first character must not be a number.

Default: "AdminUsers"

PermissionsOn this page permissions of the object are defined. See Description of the page Permissions.
Member of logical groupsThe list of the identifiers of the logical groups (the comma ',' is the separator), the object belongs into (it is a group member), see Logical groups. The logical group selection can be done in the Member of logical groups window.

After this preconfiguration is created, the configurator is se to: PmObject > Object > Member of logical groups.

The name of the file for saving the user rightsname of the file for saving the users and their user rights (default) users
Password encryption stringstring, for example "xyz" is used as a seed for the EncryptText and DecryptText methods for crypting the user password.
Enable as WEB componentIt indicates if this object has to be registered as a WEB server component

After this preconfiguration is created, the configurator is se to: PmPanel > Web Server > Enable as WEB component.

Scripting language settingsSets the scripting language type (VBScript or JavaScript).
vbscript (obsolete) - All scripts in events of graphic items in this panel will be written in VBScript language. In such case the WEB panels are functional only in Internet Explorer browser.

In such case, the Level of integration of panel viewer and the local application configurator is visible and it is possible to enter both "full" and "client".

javascript - All scripts in events of graphic items in this panel will be written in VBScript language. In such case the WEB panels are functional in all standard web browsers (Chrome, Firefox, Edge ...).

In such case, the Level of integration of panel viewer and the local application configurator is not visible and the "client" mode is set.

Example1:
An example of calling the InitUsers method after application launch. The script must be placed into the onAppStartEnd event of the PmRoot object.
pMe.Pm("AdminUsers").Methods.InitUsers
Example2:
An example of opening the AdminUsers panel from the onButtonUp event of the PmiButton graphic item located in another panel. (The panel will be opened only by a user that is logged in and belonging to the $ADMIN group).
-------------------------
An example in VBScript syntax:
-------------------------
An example in JavaScript syntax:
pMe.PmPanel.OpenView("/AdminUsers", "target:_blank;");
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice