@cfxlabsinc/b2b-services
    Preparing search index...

    Role catalog, role↔permission mapping and per-user role assignment. One role per user, so assigning replaces whatever the user held. A role assignment publishes with publishConfirmed; catalog edits are config, so publish.

    Hierarchy (View Summary)

    Index
    db: B2bDatabase
    instance: (...args: []) => AdminDashboardRoleService = ...

    The process service: the shared database and the internal event bus.

    • The permission keys the user's role grants, deduped and sorted; [] for no role. One query, for the per-request auth path (lib/auth.ts).

      Parameters

      • __namedParameters: { userId: string }

      Returns Promise<
          {
              ok: true;
              value: { permissionKeys: string[]; roleName: string
              | null };
          },
      >

    • Parameters

      • Optionalinput: {
            ids?: string[];
            names?: string[];
            page?: number;
            pageSize?: number;
            userIds?: string[];
        }
        • Optionalids?: string[]
        • Optionalnames?: string[]
        • Optionalpage?: number
        • OptionalpageSize?: number
        • OptionaluserIds?: string[]

          Roles held by any of these users.

      Returns Promise<
          {
              ok: true;
              value: { hasNext: boolean; items: AdminDashboardRole[]; total: number };
          },
      >

    • Updates the name and description, and replaces the permission set when permissionKeys is given. A field whose value is unchanged is not written.

      Parameters

      • input: {
            data: { description?: string; name?: string; permissionKeys?: string[] };
            id: string;
        }

      Returns Promise<
          | { ok: true; value: AdminDashboardRole }
          | { error: ServiceError; ok: false },
      >