Implement the settings of the menu section permissions in PowerBuilder

zhaozj2021-02-17  74

Implement the settings of the menu section permissions in PowerBuilder

Kunming, Yunjin

In a network application, it is very important to teach different users with different programs. The general application is divided: entry, query rights, modification rights, and other rights, etc., many features can be subdivided into the menu bar level, in order to facilitate management, different functional applications should give people with different working nature to make one The company or group division is clear, the responsibility is clear, and standardized management is realized.

Different permissions to the procedures for the procedures are flexible for system management, and can also see the privileges owned by the user without the user identity enterpris, which is the most basic requirement of the background management program. I have explored the settings and views of the user program to the menu item level by practice. The convenience of this module is that the administrator consistent with the menu used by the user permission, which privileges have any privileges.

Let's first see two functions related to this: MID and Replace

1. Function MID (String, Start {, Length})

Take the LENGTH bit string after the String string in the START item.

Example: MID ("Abcdefg", 3, 2)

Return value: "de"

2. Function Replace (String1, Start, N, String2)

Replace the N bit after the String1 in the String1, use String2 strings.

Example: Replace ("AbcDefgh", 3, 2, "ABC")

Return value: "abcabcfgh"

It may be possible to speculate that the two functions that can be used to use PB is the basis for implementing the definition of menu stripes in PB.

Let's first assume that our menu of our application is as follows:

M_1 m_2 m_3 ...

M1_1 m2_1 m3_1

M1_2 m2_2 m3_2

M1_3 m2_3 m3_3

M1_4 m2_4

M2_5

The definition of the menu bar variable name is required to define in a matrix mode. Then copy a menu mode as the application menu, which is used for the system authorization module, including the menu bar variable name, but only the program code is not called under the menu strip, but the menu status setting function. Set three string global variables to represent the state of the menu strip. We agree that "0" means that the menu is not optionally, "1" is optional.

String M1, M2, M3

M1 = "0000" file: / / four submenu strips for M_1

M2 = "00000" file: / / five submenu of M_2

M3 = "000" file: // Corresponding to M_1 three submerarage

Setting the initial value is not optional for the menu bar.

In the m1_1 menu, the Clicked event program is:

IF m1_1.checked = true kil

m1_1.uncheck ()

M1 = Replace (M1, 1, 1, "0")

Else

m1_1.check ()

M1 = replace (m1, 1, 1, "1")

END IF

In the m1_1 menu, the Clicked event program is:

IF m1_2.checked = true kil

m1_2.uncheck ()

M1 = Replace (M1, 2, 1, "0")

Else

m1_2.check ()

M1 = Replace (M1, 2, 1, "1")

END IF

..... other push

Function Description:

File: //m1_2.check () Plus "V" (hook symbol) File: //m1_2.uncheck () before you choose the menu, remove "V" (hook symbol)

If the A user can use M1_1, M1_3; M2_2; M3_1. The value of the menu status variable should be:

M1 = "1010"

M2 = "01000"

M3 = "100"

If b users can use M1_1; M2_3, M2_4, M2_5; M3_1, M3_2, M3_3. The value of the menu status variable should be:

M1 = "1000"

M2 = "00111"

M3 = "111"

Put this value to the permissions field of A and B users. When the A, b user enters the application, the available and unavailable use of the menu bar corresponds to the user, that is, the definition of the user use menu permissions is implemented.

转载请注明原文地址:https://www.9cbs.com/read-31081.html

New Post(0)