getUserPermissionForArea()
The function getUserPermissionForArea() gets the user permission for an area.
The function checks if the user has the authorization for a specific authorization level of a specific area. The level can be one of the levels 1-32. If the authorization bit of , for example, level 1 for an area is set to 1 the user may visualize the area. In the same way a user can have other authorization levels for an area. See chapter authorization levels for more information on the different authorization levels and chapter areas for more information on areas.
Synopsis
void getUserPermissionForArea (bool &uPerm, unsigned level, string
sAreaName, [string sUser, [string sManType = -1, [string
sManNum]]]);
Parameters
Parameter | Meaning |
---|---|
&uperm | Either TRUE or FALSE. The function returns TRUE if the user authorization bit (inherited from the group) and the authorization bit of the defined level (see below) are both 1. If one of these two bits is 0 the function returns FALSE. |
level | Defines the authorization level. The level can be one of the levels from 1 to 32. For more information see chapter authorization levels. You can also query the authorization of all levels by using , for example, a FOR statement. |
sAreaName | Defines an area name , for example, "tunnel1". The function checks if the user has the authorization for a specific level (see above) of this area. |
sUser | Name or ID of the user for whom the permissions for the area shall be checked. |
sManType | User interface or Control Manager. This parameter is optional and if it is not defined the own manager is used. |
sManNum | An arbitrary number. This parameter is optional and if it is not defined the own manager number is used. |
Return value
None
Description
The function checks if a user has the authorization for a specific authorization level of a specific area.
The function checks if the user with the user name myUserName
has
the authorization for the authorization level 1 of the area tunnel1. The function
requires of course that you have defined an area called "tunnel1" in the user
administration and that there is a user with the name myUserName
.
The manager type and number are not defined in this example and the default values
(the own manager) are used.
main()
{
bool uPerm;
unsigned level = 1;
string areaName = "tunnel1";
string user = "myUserName";
getUserPermissionForArea(uPerm,level,areaName,user);
DebugN("Authorization:",uPerm," For
level:",level," Of the
area:",areaName," for the user with the
name:",user);
}
Assignment
User administration
Availability
CTRL
#uses "userMan.ctl
and #uses "panel.ctl
)