User restrictions for sending commands at PowerExplorer and XPowerMenuCreator.

Question:

How can I insert user restrictions for sending commands via PowerExplorer and via XPowerMenuCreator?

Solution:

At PowerExplorer

1. Access the Rectangle1’s script at XPowerMenuCreator XControl.

2. Double-click the rectangle and access its script. This script is responsible for creating the PowerExplorer window and the selection menu, as well as the protections’, measurements’, and commands’ selection tree.

3. Retrieve ShowPowerExplorer method in the script via Search command:  . The following line will return:

Application.ShowPowerExplorer auxTitle, MeaPath,, , false, XPowerMenuCreator, XPowerMenuCreator.PowerExplorerBackColor

4. When checking the ShowPowerExplorer method’s specification, note that parameters set as False are read-only. When setting them as True, you will no longer be able to send commands via Power Explorer.

5. In this example, a script was created to limit the number of commands sent to adm group. In your case, create the logic according to the groups created in your application.

If Application.IsUserMemberOfGroup (“adm”, Application.User) then
‘show PowerExplorer
Application.ShowPowerExplorer auxTitle, MeaPath,, , false, XPowerMenuCreator, XPowerMenuCreator.PowerExplorerBackColor
Else Application.ShowPowerExplorer auxTitle, MeaPath,, , true, XPowerMenuCreator, XPowerMenuCreator.PowerExplorerBackColor
End if

From the Viewer’s IsUserMemberOfGroup method, the script tests if the user logged on belongs to the group set up at GroupName parameter (in this case, adm), and either grants or denies permission to sending commands.

At XPowerMenuCreator

1. Also at the Rectangle1’s script from XPowerMenuCreator XControl, create a script to delete the Commands option from the tree:

To do so, search for Commands in the script via Search command. The following script will return:

2. Then, create a script that hides this window. In this case, it is also possible to use IsUserMemberOfGroup method to test if the logged-on user belongs or not to a certain group. In the example, a script was created to test if the user logged on adm is present:

IF NOT Application.IsUserMemberOfGroup (“adm”, Application.User) then
auxCommand = “!Commands|”
End if

3. In the example above, if the user not belongs to adm, the Commands option is not enabled; by the end, the script will look like this:

For further information on IsUserMemberOfGroup and ShowPowerExplorer methods, please refer to Elipse E3/Power Scripts Reference Manual.

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *