Skip to content

Latest commit

 

History

History
34 lines (30 loc) · 1.9 KB

IsInRoleMethod.md

File metadata and controls

34 lines (30 loc) · 1.9 KB

IsInRole global method call (IsInRoleMethod)

Description

To check access rights in the code, use the AccessRight method.

When a role does not grant access rights to metadata objects and defines an additional access right only, use the IsInRole method.

If Standard Subsystems Library is used in a configuration, use the RolesAvailable function of the Users common module, otherwise IsInRole method call must be combined with PrivilegedMode() method call. If Standard Subsystems Library is used in a configuration, use the RolesAvailable() function of the Users common module, otherwise IsInRole() method call must be combined with PrivilegedMode() method call.

Examples

Wrong:

If RolesAvailable("AddingChangingCountriesWorld") Then...
If RolesAvailable("ViewPopularCountriesReport") Then ...

Correct:

If AccessRight("Edit", Metadata.Catalogs.WorldCountries) Then ...
If AccessRight("View", Metadata.Reports.PopularCountries) Then ...

Wrong:

If RolesAvailable("Treasurer") Then...

Сorrect:

If IsInRole("Treasurer") OR PrivilegedMode() Then ...

Sources