Skip to content

Issue with plugin content types and admin routes #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kevinvugts opened this issue Aug 19, 2024 · 3 comments
Closed

Issue with plugin content types and admin routes #104

kevinvugts opened this issue Aug 19, 2024 · 3 comments

Comments

@kevinvugts
Copy link

kevinvugts commented Aug 19, 2024

Hi @ComfortablyCoding

There is an issue with this plugin.
Individual plugins contentTypes cannot be transformed individually. The only thing that works is basically allowing them all by proving the "id" of the plugin in the plugins.ids object. However, it would be nice if we could allow individual contentTypes like you can with the contentTypeFilter "api::content-type-name.name"

I checked your code in the register.js and it seems to be because the way you are checking the UIDS from the strapi[apiType].

This config does seem to pass some checks

  "some-plugin": {
    enabled: true,
    resolve: "./src/plugins/some-plugin",
  },
  transformer: {
    enabled: true,
    config: {
      responseTransforms: {
        removeAttributesKey: true,
        removeDataKey: true,
      },
      contentTypeFilter: {
        mode: "allow",
        uids: {
          "some-plugin": true, // This line bypasses the checks in isAvailableApi and isAvailableMethod. However it does not allow for allowing individual content types from a plugin..
          "api::blog.blog": true,
        },
      },
      plugins: {
        mode: "allow",
        ids: {
          "some-plugin": true,
        },
      },
    },
  },
};

However, as you can see I have to remove the plugin:: prefix to make it pass those checks.
Also, admin api routes are not transformed on purpose, this shouldn't be the case since these should also be able to be transformed.

Can you support this?

// skip admin routes

@kevinvugts
Copy link
Author

I opened up a pull request #105

@ComfortablyCoding
Copy link
Contributor

As discussed I am unfortunately no longer maintaining this plugin nor do I have the permissions to merge any longer.

A maintainer would need to take this over and review as needed.

P.S. The PR is present for anyone who wishes to patch it for themselves in the meantime.

@kevinvugts
Copy link
Author

As discussed I am unfortunately no longer maintaining this plugin nor do I have the permissions to merge any longer.

A maintainer would need to take this over and review as needed.

P.S. The PR is present for anyone who wishes to patch it for themselves in the meantime.

Thanks for your response. As discussed per Discord I am unable to maintain this library either. Anyhow, for anyone that wants this change. Please do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants