RocketChat / Rocket.Chat.Apps-engine

The Rocket.Chat Apps engine and definitions.

Home Page:https://rocketchat.github.io/Rocket.Chat.Apps-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BREAKING BUG] Permission checking is totally broken

cuonghuunguyen opened this issue · comments

The has...Permission logic is incorrect with some bridges causes apps cannot work.
For example in Livechat bridge:

  hasMultiplePermission(appId, feature) {
        if (!AppPermissionManager_1.AppPermissionManager.hasPermission(appId, AppPermissions_1.AppPermissions[`livechat-${feature}`].multiple)) { // wrong
            return true;
        }
     ...
 hasWritePermission(appId, feature) {
        if (!AppPermissionManager_1.AppPermissionManager.hasPermission(appId, AppPermissions_1.AppPermissions[`livechat-${feature}`].write)) { // wrong
            return true;
        }
        AppPermissionManager_1.AppPermissionManager.notifyAboutError(new PermissionDeniedError_1.PermissionDeniedError({
            appId,
            missingPermissions: [AppPermissions_1.AppPermissions[`livechat-${feature}`].write],
        }));
        return false;
    }