How to use the @verdaccio/commons-api.getForbidden function in @verdaccio/commons-api

To help you get started, we’ve selected a few @verdaccio/commons-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bufferoverflow / verdaccio-gitlab / src / gitlab.ts View on Github external
packagePermit = true;
        break;
      }
    }

    if (packagePermit || packageScopePermit) {
      const perm = packagePermit ? 'package-name' : 'package-scope';
      this.logger.debug(
        `[gitlab] user: ${user.name || ''} allowed to publish package: ${_package.name} based on ${perm}`
      );
      return cb(null, true);
    } else {
      this.logger.debug(`[gitlab] user: ${user.name || ''} denied from publishing package: ${_package.name}`);
      // @ts-ignore
      const missingPerm = _package.name.indexOf('@') === 0 ? 'package-scope' : 'package-name';
      return cb(getForbidden(`must have required permissions: ${this.publishLevel || ''} at ${missingPerm}`));
    }
  }