Single-app mode

Contents...

Any app in the Webasyst backend can be used in the single-app mode. When this mode is on, the entire user interface consists of only one app. No other apps are available to a user, they can neither use them nor even find out whether they are installed in their account at all.

If a user attempts to manually open a URL of the Webasyst backend that should correspond to some other app then they are redirected to the only app which is available to the user.

Users with the full “Administrator” access cannot open other apps’ interfaces either, but they can use some of their functionality indirectly. For instance, administrators can install plugins and design themes in the corresponding sections of the only available app’s interface, which indirectly utilizes the Installer app functionality. However, they cannot open Installer as an app.

PHP function wa_header() and Smarty template helpers {$wa->header()} and {wa_header} return only hidden content in this mode, i.e. system JavaScript code. The main backend menu is not displayed.

The developer of each app or plugin must ensure that their product is correctly displayed in the single-app mode.

Why use the single-app mode

This mode is useful to set up a special access level for the teammates who are not supposed to be distracted by anything else during their work and must concentrate on the only available app; e.g., a receptionist, a cashier, a hotel or restaurant hostess, etc.

As a user gets better acquainted with one app, you may find it useful to grant them also access to other Webasyst features such as the dashboard, Installer and other apps.

How to enable the single-app mode

Select to which users and apps this mode must be applied:

  • One app for all

    If all users, including administrators, must use only one app then edit file wa-config/config.php and set a flag in the single_app_mode parameter and specify the desired app’s ID in the single_app_id parameter.

    All other apps will be unavailable to all users.

    Example fo the Shop-Script app
    <?php
    
    return [
        ...
        'single_app_mode' => true,
        'single_app_id' => 'shop',
    ];
            
  • Selected apps for individual users

    If only certain users must use only one app in the single-app mode then select the “Single app” option in the access rights settings for a selected app in Team.

    You can select such access level for every user only to one app. All other apps will be unavailable to the user.

Detecting the single-app mode in the programming code

In PHP code, you can detect the single-app mode by calling the wa()->isSingleAppMode() method:

$single_app_mode_is_on = wa()->isSingleAppMode();

In Smarty templates call the $wa->isSingleAppMode() method for the same purpose:

{$single_app_mode_is_on = $wa->isSingleAppMode()}

You can also detect whether the single-app mode is enabled for a certain user (different from the current user) using public method waContact->isSingleAppMode():

$single_app_mode_for_user_is_on = (new waContact(42))->isSingleAppMode();

Use this methods if your product needs to be specifically adjusted to the single-app mode.

Use of API

If a user with limited access rights is using an app in the single-app mode then they are also allowed access to the API of that app. Therefore, the user can also use a mobile version of the same app. Attempts to access API methods of other apps will be blocked.

Administrators with full access rights can always use API methods of all apps, which includes the use of their mobile versions as well.