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.
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 ...
- Standard: Checking access rights (RU)