public grant()

in src/auth.ts [81:103]


  public grant(
    req: IPermissionRequest | IPermissionRequest[],
    options?: grpc.CallOptions,
  ): Promise<this> {
    if (req instanceof Array) {
      return Promise.all(req.map(r => this.grant(r))).then(() => this);
    }

    const range = getRange(req);
    return this.client
      .roleGrantPermission(
        {
          name: this.name,
          perm: {
            permType: req.permission,
            key: range.start,
            range_end: range.end,
          },
        },
        options,
      )
      .then(() => this);
  }