all repos — caroster @ 52ad6be503528baa3feff0e610b44f0f82ffc2a3

[Octree] Group carpool to your event https://caroster.io

backend/src/index.ts (view raw)

 1import bootstrapActions from "./bootstrap";
 2import graphqlExtends from "./graphql";
 3
 4export default {
 5  /**
 6   * An asynchronous register function that runs before
 7   * your application is initialized.
 8   *
 9   * This gives you an opportunity to extend code.
10   */
11  register(context) {
12    graphqlExtends(context);
13
14    // Because of bug https://github.com/strapi/strapi/issues/17995, we're forced
15    // to enable "plugin::users-permissions.user" permission for Authenticated role.
16    // Disable REST endpoints
17    context.strapi.controller("plugin::users-permissions.user").find = (ctx) =>
18      ctx.unauthorized();
19    context.strapi.controller("api::event.event").find = (ctx) =>
20      ctx.unauthorized();
21    // Disable GQL methods
22    strapi
23      .plugin("graphql")
24      .service("extension")
25      .shadowCRUD("plugin::users-permissions.user")
26      .disableAction("find");
27    strapi
28      .plugin("graphql")
29      .service("extension")
30      .shadowCRUD("api::event.event")
31      .disableAction("find");
32  },
33
34  /**
35   * An asynchronous bootstrap function that runs before
36   * your application gets started.
37   *
38   * This gives you an opportunity to set up your data model,
39   * run jobs, or perform some special logic.
40   */
41  async bootstrap(context) {
42    for (let action of bootstrapActions) {
43      await action(context);
44    }
45  },
46};