getUserPermission()

Checks authorizations.

Synopsis

boolean getUserPermission( int level [, unsigned userid[, int manType[, int manNum]]]);

Parameters

Parameters Meaning
level authorization level
userid user ID
manType

manager type

For every manager type there is a constant defined (see myManType()).

manNum Number of the manager

Return value

The function returns FALSE in the event of an error or no authorization otherwise, TRUE.

Error

Missing arguments

Description

Checks the authorizations for the action to be performed. If the parameters userid, manType and manNum have not been specified, the current user and current manager will be used. The result for the user root is always 1. Checking will be performed as follows:

(BS & ( AP | AU))

Abbreviation Description
BS Authorization level
AU workplace independent authorization level
AP workplace dependent authorization level

Example

The following example opens a configuration panel as a function of a user's authorization. If there is no permission for setting configurations, the corresponding information will be shown in the LogViewer.

main()
{
  if (getUserPermission(5))
  DebugN("authorization for level 5 ok");
  else DebugN("no authorization for level");
}

Assignment

User administration

Availability

CTRL