Access Level Feature
|Top Previous Next|
Access Level Feature provides that it is possible to make a Gelecek Control Visible- Invisible or Enabled- Disabled
in accordance with the current user's access level.
Step 1: Defining acces levels
To use Access Level Feature, before starting .NET project, you need to create a Configuration File that includes Access Level Definitions.
Configuration File is created by Gelecek HMI Components Configurator (GelecekHMICompConfigurator.exe) which is supplied with demo download of our software
With this configurator, you can define Access levels, passwords and InHierarchy properties.
Main priniciple of access level system is that an InHierarchy Higher level has all authorization of all InHierarchy Lower levels.
If an access level is not InHierarchy, it is an independent level, its position in table is not important.
Create file, define access levels and save file in a known location.
Step 2: Setting access level properties of controls
By settings these properties you define if control will be Visible-Invisible or Enabled-Disabled in accordance with current user's access level.
Suppose that control's gAccessLevelForEnabling property is set as "1: NewLevel1". (Name of access level is not important)
-This means that "if user's access level is 1 or higher, control will be enabled".
-In runtime, if user's accesss level is 1 or 2 or 5, this control is Enabled. As Level4 is not InHierarchy, Level4 does not have authorization of Level 2, or 1, or 0.
Suppose that control's gAccessLevelForEnabling property is set as "4: NewLevel4". This access level is not InHierarchy.
-This means that "if user's access level is exactly 4, control will be enabled."
Scenario and explanation is the same for gAccessLevelForVisible property.
Step 3: Changing access level of user
In runtime, to have its authorization, the user need to set access level.
Basic way is to use a simple control : gAccessLevelSelector.
In runtime its view:
When you click a level, you will be asked to enter password.
Use this method to change user's access level:
bool result = GelecekCommon.GlobalObjects.AccessLevelManager.gSetActiveAccessLevel(1);
//Level 1 is set. Name of level is not important.
//For a successful level change, result should be true.
When access level changes, "GelecekCommon.gGlobalObjects.gAccessLevelManager.gActiveAccessLevelChanged" event occurs.
C# code syntax
private void AccessLevelManager_gActiveAccessLevelChanged(object sender, GelecekCommon.ActiveAccessLevelChangedEventArgs e)
"e.no_of_new_level" gives us the new access level.