diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 142bb03ccb..ae45bc481a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,6 +45,8 @@ The Strapi Documentation team has created a complete style guide for you to make 💁 While writing, please consider the [12 Rules of Technical Writing](https://handbook.strapi.io/user-success-manual/12-rules-of-technical-writing) that the Strapi Documentation team will use to assess the quality and consistency of the contribution. 😊 +⚠️ **Important: Please disable any linter or automatic formatting tool(s)** before saving and submitting your files. Not doing so could, at best, add unnecessary formatting changes to the submitted PR or, at worst, prevent Docusaurus from properly rendering some pages. + ### Working locally: Set up the project To set up the Docusaurus project on your machine, perform the following steps from a terminal instance: diff --git a/docusaurus/docs/cloud/getting-started/cloud-fundamentals.md b/docusaurus/docs/cloud/getting-started/cloud-fundamentals.md index 98a5469f80..fea185f867 100644 --- a/docusaurus/docs/cloud/getting-started/cloud-fundamentals.md +++ b/docusaurus/docs/cloud/getting-started/cloud-fundamentals.md @@ -14,7 +14,7 @@ Before going any further into this Strapi Cloud documentation, we recommend you - **Hosting Platform**
Strapi Cloud is a hosting platform that allows to deploy already existing Strapi projects created with Strapi CMS (Content Management System). Strapi Cloud is *not* the SaaS (Software as a Service) version of Strapi CMS. Feel free to refer to the [Developer Documentation](https://docs.strapi.io/dev-docs/intro) and [User Guide](https://docs.strapi.io/user-docs/intro) to learn more about Strapi CMS. -- **Strapi Cloud Pricing Plans**
As a Strapi Cloud user you have the choice between 3 tiers: Developer, Pro and Team. Depending on the tier, you have access to different functionalities, support and customization options (see [Pricing page](https://strapi.io/pricing-cloud) for more details). In this Strapi Cloud documentation, the , , and badges can be displayed beside a section's title to indicate for which tier the feature is available. +- **Strapi Cloud Pricing Plans**
As a Strapi Cloud user you have the choice between 3 tiers: Developer, Pro and Team. Depending on the tier, you have access to different functionalities, support and customization options (see [Pricing page](https://strapi.io/pricing-cloud) for more details). In this Strapi Cloud documentation, the , , and badges can be displayed below a section's title to indicate for which tier the feature is available. - **Strapi CMS Enterprise features**
Some of Strapi features, usually accessible via the Enterprise Edition of Strapi CMS, are included in some Strapi Cloud tiers (see [Pricing page](https://strapi.io/pricing-cloud) and [Information on billing & usage](/cloud/getting-started/usage-billing) for more details). These features, highlighted with an badge, are documented in the [User Guide](https://docs.strapi.io/user-docs/intro) and the [Developer Documentation](https://docs.strapi.io/dev-docs/intro). diff --git a/docusaurus/docs/cloud/getting-started/usage-billing.md b/docusaurus/docs/cloud/getting-started/usage-billing.md index c0676af03c..a3bd8d883e 100644 --- a/docusaurus/docs/cloud/getting-started/usage-billing.md +++ b/docusaurus/docs/cloud/getting-started/usage-billing.md @@ -31,7 +31,7 @@ Strapi Cloud offers a free 14 days trial for all new accounts, and 3 paid plans: | **Content History** | 14 days retention | N/A | 14 days retention | 90 days retention | | | | | | | | **Backups** | N/A | N/A | Weekly | Daily | -| **Environments** | N/A | N/A | 0 included (up to 99 extra) | 1 included (up to 99 extra) | +| **Environments** | N/A | N/A | 0 included (up to 99 extra) | 2 included (up to 99 extra) | :::strapi Additional information on usage and features - General features & usage: diff --git a/docusaurus/docs/cloud/projects/runtime-logs.md b/docusaurus/docs/cloud/projects/runtime-logs.md index e4cb2fd759..f4b3cc43e9 100644 --- a/docusaurus/docs/cloud/projects/runtime-logs.md +++ b/docusaurus/docs/cloud/projects/runtime-logs.md @@ -9,8 +9,6 @@ tags: - Strapi Cloud --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Runtime logs From a chosen project's dashboard, the *Runtime logs* tab displays the live logs of the project. diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/bundlers.md b/docusaurus/docs/dev-docs/admin-panel-customization/bundlers.md index ee7e6aba15..db96082408 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/bundlers.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/bundlers.md @@ -1,6 +1,7 @@ --- title: Admin panel bundlers description: Learn more about configuring Vite and webpack with Strapi 5. +displayed_sidebar: cmsSidebar sidebar_label: Bundlers toc_max_heading_level: 4 tags: diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/deployment.md b/docusaurus/docs/dev-docs/admin-panel-customization/deployment.md index 955e7c2911..e59ed48e4b 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/deployment.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/deployment.md @@ -1,6 +1,7 @@ --- title: Admin panel deployment description: Learn more about deploying Strapi's admin panel in various scenarios. +displayed_sidebar: cmsSidebar sidebar_label: Deployment toc_max_heading_level: 4 tags: diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/extension.md b/docusaurus/docs/dev-docs/admin-panel-customization/extension.md index 5f8df33e56..b19f49170d 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/extension.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/extension.md @@ -1,6 +1,7 @@ --- title: Admin panel extension description: Learn more about extending Strapi's admin panel. +displayed_sidebar: cmsSidebar sidebar_label: Extension toc_max_heading_level: 4 tags: diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/host-port-path.md b/docusaurus/docs/dev-docs/admin-panel-customization/host-port-path.md index 4cb9537cd8..cf95a1cd0b 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/host-port-path.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/host-port-path.md @@ -1,6 +1,7 @@ --- title: Admin panel customization - URL, host, and path configuration description: Learn more about configuring the URL, host, and path to access Strapi's admin panel. +displayed_sidebar: cmsSidebar sidebar_label: URL, host, and port configuration toc_max_heading_level: 4 tags: diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/options.md b/docusaurus/docs/dev-docs/admin-panel-customization/options.md index 03496d9b32..58dd821ee8 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/options.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/options.md @@ -1,6 +1,7 @@ --- title: Admin panel customization options description: Various options help you configure Strapi's administration panel behavior and look, so you can make it reflect your identity. +displayed_sidebar: cmsSidebar sidebar_label: Customization options toc_max_heading_level: 4 tags: diff --git a/docusaurus/docs/dev-docs/admin-panel-customization/wysiwyg-editor.md b/docusaurus/docs/dev-docs/admin-panel-customization/wysiwyg-editor.md index 83cdeb9c4e..2fcd3a315a 100644 --- a/docusaurus/docs/dev-docs/admin-panel-customization/wysiwyg-editor.md +++ b/docusaurus/docs/dev-docs/admin-panel-customization/wysiwyg-editor.md @@ -1,6 +1,7 @@ --- title: Customizing the WYSIWYG editor description: Learn more about the various strategies available to customize the WYSIWYG editor in Strapi's admin panel. +displayed_sidebar: cmsSidebar sidebar_label: WYSIWYG editor tags: - admin panel diff --git a/docusaurus/docs/dev-docs/advanced-features.md b/docusaurus/docs/dev-docs/advanced-features.md index baaf5163a0..bb80503b0a 100644 --- a/docusaurus/docs/dev-docs/advanced-features.md +++ b/docusaurus/docs/dev-docs/advanced-features.md @@ -17,7 +17,7 @@ Strapi provides advanced built-in features for developers who'd like to get the - + @@ -27,7 +27,7 @@ Strapi provides advanced built-in features for developers who'd like to get the - + diff --git a/docusaurus/docs/dev-docs/api/content-api.md b/docusaurus/docs/dev-docs/api/content-api.md index d7b3dc4437..09ad3f0326 100644 --- a/docusaurus/docs/dev-docs/api/content-api.md +++ b/docusaurus/docs/dev-docs/api/content-api.md @@ -2,6 +2,7 @@ title: Content API description: Learn more about Strapi 5's Content API displayed_sidebar: cmsSidebar +sidebar_label: APIs Introduction pagination_prev: dev-docs/setup-deployment pagination_next: dev-docs/advanced-features tags: diff --git a/docusaurus/docs/dev-docs/api/document-service/fields.md b/docusaurus/docs/dev-docs/api/document-service/fields.md index 6a102d1eb0..5042eed0d0 100644 --- a/docusaurus/docs/dev-docs/api/document-service/fields.md +++ b/docusaurus/docs/dev-docs/api/document-service/fields.md @@ -1,6 +1,7 @@ --- title: Using fields with the Document Service API description: Use Strapi's Document Service API to select the fields to return with your queries. +sidebar_label: Fields displayed_sidebar: cmsSidebar tags: - API @@ -24,7 +25,7 @@ import IdsInResponse from '/docs/snippets/id-in-responses.md' By default the [Document Service API](/dev-docs/api/document-service) returns all the fields of a document but does not populate any fields. This page describes how to use the `fields` parameter to return only specific fields with the query results. -:::time.p +:::tip You can also use the `populate` parameter to populate relations, media fields, components, or dynamic zones (see the [`populate` parameter](/dev-docs/api/document-service/populate) documentation). ::: diff --git a/docusaurus/docs/dev-docs/api/document-service/filters.md b/docusaurus/docs/dev-docs/api/document-service/filters.md index 98cb233421..f235bee635 100644 --- a/docusaurus/docs/dev-docs/api/document-service/filters.md +++ b/docusaurus/docs/dev-docs/api/document-service/filters.md @@ -2,6 +2,7 @@ title: Using filters with the Document Service API description: This document provides information about the filters available in the Document Service API. displayed_sidebar: cmsSidebar +sidebar_label: Filters tags: - API - Content API diff --git a/docusaurus/docs/dev-docs/api/document-service/locale.md b/docusaurus/docs/dev-docs/api/document-service/locale.md index 8e05147dd8..d840374e1b 100644 --- a/docusaurus/docs/dev-docs/api/document-service/locale.md +++ b/docusaurus/docs/dev-docs/api/document-service/locale.md @@ -2,6 +2,7 @@ title: Using the locale parameter with the Document Service API description: Use Strapi's Document Service API to work with locale versions with your queries. displayed_sidebar: cmsSidebar +sidebar_label: Locale tags: - API - Content API @@ -21,7 +22,7 @@ tags: # Document Service API: Using the `locale` parameter -By default the [Document Service API](/dev-docs/api/document-service) returns the default locale version of documents (which is 'en', i.e. the English version, unless another default locale has been set for the application, see [User Guide](/user-docs/settings/internationalization)). This page describes how to use the `locale` parameter to get or manipulate data only for specific locales. +By default the [Document Service API](/dev-docs/api/document-service) returns the default locale version of documents (which is 'en', i.e. the English version, unless another default locale has been set for the application, see [Internationalization (i18n) feature](/user-docs/features/internationalization)). This page describes how to use the `locale` parameter to get or manipulate data only for specific locales. ## Get a locale version with `findOne()` {#find-one} diff --git a/docusaurus/docs/dev-docs/api/document-service/middlewares.md b/docusaurus/docs/dev-docs/api/document-service/middlewares.md index b77288b446..b3ccee3e86 100644 --- a/docusaurus/docs/dev-docs/api/document-service/middlewares.md +++ b/docusaurus/docs/dev-docs/api/document-service/middlewares.md @@ -2,6 +2,7 @@ title: Extending the Document Service behavior description: This document provides information about the middlewares in the Document Service API. toc_max_heading_level: 4 +sidebar_label: Middlewares displayed_sidebar: cmsSidebar --- diff --git a/docusaurus/docs/dev-docs/api/document-service/populate.md b/docusaurus/docs/dev-docs/api/document-service/populate.md index 6c0c8ff32a..e9675917ea 100644 --- a/docusaurus/docs/dev-docs/api/document-service/populate.md +++ b/docusaurus/docs/dev-docs/api/document-service/populate.md @@ -2,6 +2,7 @@ title: Using Populate with the Document Service API description: Use Strapi's Document Service API to populate or select some fields. displayed_sidebar: cmsSidebar +sidebar_label: Populate tags: - Components - Content API diff --git a/docusaurus/docs/dev-docs/api/document-service/sort-pagination.md b/docusaurus/docs/dev-docs/api/document-service/sort-pagination.md index 262444b702..1a8882e9c0 100644 --- a/docusaurus/docs/dev-docs/api/document-service/sort-pagination.md +++ b/docusaurus/docs/dev-docs/api/document-service/sort-pagination.md @@ -2,6 +2,7 @@ title: Using Sort & Pagination with the Document Service API description: Use Strapi's Document Service API to sort and paginate query results displayed_sidebar: cmsSidebar +sidebar_label: Sort & Pagination tags: - API - Content API diff --git a/docusaurus/docs/dev-docs/api/document-service/status.md b/docusaurus/docs/dev-docs/api/document-service/status.md index 3de0f4d49a..808f13c32f 100644 --- a/docusaurus/docs/dev-docs/api/document-service/status.md +++ b/docusaurus/docs/dev-docs/api/document-service/status.md @@ -2,6 +2,7 @@ title: Using Draft & Publish with the Document Service API description: Use Strapi's Document Service API to return either the draft or the published version of a document displayed_sidebar: cmsSidebar +sidebar_label: Status tags: - API - Content API diff --git a/docusaurus/docs/dev-docs/api/document.md b/docusaurus/docs/dev-docs/api/document.md index 64b2a081ed..15642011d9 100644 --- a/docusaurus/docs/dev-docs/api/document.md +++ b/docusaurus/docs/dev-docs/api/document.md @@ -2,6 +2,7 @@ title: Documents description: Learn what a Document is in Strapi v5 displayed_sidebar: cmsSidebar +sidebar_label: Document concept pagination_prev: dev-docs/api/content-api tags: - API diff --git a/docusaurus/docs/dev-docs/api/entity-service.md b/docusaurus/docs/dev-docs/api/entity-service.md index 70f2d1dd10..00c6cc6ab4 100644 --- a/docusaurus/docs/dev-docs/api/entity-service.md +++ b/docusaurus/docs/dev-docs/api/entity-service.md @@ -7,7 +7,6 @@ unlisted: true import EntityQueryKnex from '/docs/snippets/entity-query-knex.md' import BackendIntroCrosslink from '/docs/snippets/backend-custom-intro-crosslink.md' -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ESdeprecated from '/docs/snippets/entity-service-deprecated.md' # Entity Service API diff --git a/docusaurus/docs/dev-docs/api/entity-service/order-pagination.md b/docusaurus/docs/dev-docs/api/entity-service/order-pagination.md index 742de1a88c..003ec486ad 100644 --- a/docusaurus/docs/dev-docs/api/entity-service/order-pagination.md +++ b/docusaurus/docs/dev-docs/api/entity-service/order-pagination.md @@ -2,6 +2,7 @@ title: Ordering & Pagination with the Entity Service API description: Use Strapi's Entity Service API to order and paginate queries results. displayed_sidebar: cmsSidebar +unlisted: true --- import ESdeprecated from '/docs/snippets/entity-service-deprecated.md' diff --git a/docusaurus/docs/dev-docs/api/graphql.md b/docusaurus/docs/dev-docs/api/graphql.md index 0372b82619..e5591c2311 100644 --- a/docusaurus/docs/dev-docs/api/graphql.md +++ b/docusaurus/docs/dev-docs/api/graphql.md @@ -15,8 +15,6 @@ tags: - sort --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # GraphQL API The GraphQL API allows performing queries and mutations to interact with the [content-types](/dev-docs/backend-customization/models#content-types) through Strapi's [GraphQL plugin](/dev-docs/plugins/graphql.md). Results can be [filtered](#filters), [sorted](#sorting) and [paginated](#pagination). @@ -463,7 +461,7 @@ mutation CreateCategory { ``` :::tip -If the Internationalization (i18n) feature is enabled for your content-type, you can create a document for a specific locale (see [i18n documentation](/dev-docs/i18n#graphql-create)). +If the Internationalization (i18n) feature is enabled for your content-type, you can create a document for a specific locale (see [i18n documentation](/dev-docs/api/graphql#graphql-create)). ::: ### Update an existing document @@ -491,7 +489,7 @@ mutation UpdateRestaurant($documentId: ID!, $data: RestaurantInput!) { ``` :::tip -If the Internationalization (i18n) feature is enabled for your content-type, you can create a document for a specific locale (see [i18n documentation](/dev-docs/i18n#graphql-update)). +If the Internationalization (i18n) feature is enabled for your content-type, you can create a document for a specific locale (see [i18n documentation](/dev-docs/api/graphql#graphql-update)). ::: #### Update relations @@ -529,7 +527,7 @@ mutation DeleteRestaurant { ``` :::tip -If the Internationalization (i18n) feature is enabled for your content-type, you can delete a specific localized version of a document (see [i18n documentation](/dev-docs/i18n#graphql-delete)). +If the Internationalization (i18n) feature is enabled for your content-type, you can delete a specific localized version of a document (see [i18n documentation](/dev-docs/api/graphql#graphql-delete)). ::: ### Mutations on media files @@ -747,3 +745,148 @@ Pagination methods can not be mixed. Always use either `page` with `pageSize` or :::tip The default and maximum values for `pagination.limit` can be [configured in the `./config/plugins.js`](/dev-docs/configurations/plugins#graphql) file with the `graphql.config.defaultLimit` and `graphql.config.maxLimit` keys. ::: + +## `locale` {#locale} + +The [Internationalization (i18n)](/user-docs/features/internationalization) feature adds new features to the GraphQL API: + +- The `locale` field is added to the GraphQL schema. +- GraphQL can be used: + - to query documents for a specific locale with the `locale` argument + - for mutations to [create](#graphql-create), [update](#graphql-update), and [delete](#graphql-delete) documents for a specific locale + +### Fetch all documents in a specific locale {#graphql-fetch-all} + +To fetch all documents for a specific locale, pass the `locale` argument to the query: + + + + + +```graphql +query { + restaurants(locale: "fr") { + documentId + name + locale + } +} +``` + + + + + +```json +{ + "data": { + "restaurants": [ + { + "documentId": "a1b2c3d4e5d6f7g8h9i0jkl", + "name": "Restaurant Biscotte", + "locale": "fr" + }, + { + "documentId": "m9n8o7p6q5r4s3t2u1v0wxyz", + "name": "Pizzeria Arrivederci", + "locale": "fr" + }, + ] + } +} +``` + + + + + +### Fetch a document in a specific locale {#graphql-fetch} + +To fetch a documents for a specific locale, pass the `documentId` and the `locale` arguments to the query: + + + + + +```graphql +query Restaurant($documentId: ID!, $locale: I18NLocaleCode) { + restaurant(documentId: "a1b2c3d4e5d6f7g8h9i0jkl", locale: "fr") { + documentId + name + description + locale + } +} +``` + + + + + +```json +{ + "data": { + "restaurant": { + "documentId": "lviw819d5htwvga8s3kovdij", + "name": "Restaurant Biscotte", + "description": "Bienvenue au restaurant Biscotte!", + "locale": "fr" + } + } +} +``` + + + + +### Create a new localized document {#graphql-create} + +The `locale` field can be passed to create a localized document for a specific locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#create-a-new-document)). + +```graphql title="Example: Create a new restaurant for the French locale" +mutation CreateRestaurant($data: RestaurantInput!, $locale: I18NLocaleCode) { + createRestaurant( + data: { + name: "Brasserie Bonjour", + description: "Description in French goes here" + }, + locale: "fr" + ) { + documentId + name + description + locale +} +``` + +### Update a document for a specific locale {#graphql-update} + +A `locale` argument can be passed in the mutation to update a document for a given locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#update-an-existing-document)). + +```graphql title="Example: Update the description field of restaurant for the French locale" +mutation UpdateRestaurant($documentId: ID!, $data: RestaurantInput!, $locale: I18NLocaleCode) { + updateRestaurant( + documentId: "a1b2c3d4e5d6f7g8h9i0jkl" + data: { + description: "New description in French" + }, + locale: "fr" + ) { + documentId + name + description + locale +} +``` + +### Delete a locale for a document {#graphql-delete} + +Pass the `locale` argument in the mutation to delete a specific localization for a document : + +```graphql +mutation DeleteRestaurant($documentId: ID!, $locale: I18NLocaleCode) { + deleteRestaurant(documentId: "xzmzdo4k0z73t9i68a7yx2kk", locale: "fr") { + documentId + } +} +``` diff --git a/docusaurus/docs/dev-docs/api/graphql/locale.md b/docusaurus/docs/dev-docs/api/graphql/locale.md new file mode 100644 index 0000000000..356b52d8fc --- /dev/null +++ b/docusaurus/docs/dev-docs/api/graphql/locale.md @@ -0,0 +1,144 @@ +# Use `locale` with the GraphQL API {#graphql} + +The i18n feature adds new features to the [GraphQL API](/dev-docs/api/graphql): + +- The `locale` field is added to the GraphQL schema. +- GraphQL can be used: + - to query documents for a specific locale with the `locale` argument + - for mutations to [create](#graphql-create), [update](#graphql-update), and [delete](#graphql-delete) documents for a specific locale + +### Fetch all documents in a specific locale {#graphql-fetch-all} + +To fetch all documents for a specific locale, pass the `locale` argument to the query: + + + + + +```graphql +query { + restaurants(locale: "fr") { + documentId + name + locale + } +} +``` + + + + + +```json +{ + "data": { + "restaurants": [ + { + "documentId": "a1b2c3d4e5d6f7g8h9i0jkl", + "name": "Restaurant Biscotte", + "locale": "fr" + }, + { + "documentId": "m9n8o7p6q5r4s3t2u1v0wxyz", + "name": "Pizzeria Arrivederci", + "locale": "fr" + }, + ] + } +} +``` + + + + + +### Fetch a document in a specific locale {#graphql-fetch} + +To fetch a documents for a specific locale, pass the `documentId` and the `locale` arguments to the query: + + + + + +```graphql +query Restaurant($documentId: ID!, $locale: I18NLocaleCode) { + restaurant(documentId: "a1b2c3d4e5d6f7g8h9i0jkl", locale: "fr") { + documentId + name + description + locale + } +} +``` + + + + + +```json +{ + "data": { + "restaurant": { + "documentId": "lviw819d5htwvga8s3kovdij", + "name": "Restaurant Biscotte", + "description": "Bienvenue au restaurant Biscotte!", + "locale": "fr" + } + } +} +``` + + + + +### Create a new localized document {#graphql-create} + +The `locale` field can be passed to create a localized document for a specific locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#create-a-new-document)). + +```graphql title="Example: Create a new restaurant for the French locale" +mutation CreateRestaurant($data: RestaurantInput!, $locale: I18NLocaleCode) { + createRestaurant( + data: { + name: "Brasserie Bonjour", + description: "Description in French goes here" + }, + locale: "fr" + ) { + documentId + name + description + locale +} +``` + +### Update a document for a specific locale {#graphql-update} + +A `locale` argument can be passed in the mutation to update a document for a given locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#update-an-existing-document)). + +```graphql title="Example: Update the description field of restaurant for the French locale" +mutation UpdateRestaurant($documentId: ID!, $data: RestaurantInput!, $locale: I18NLocaleCode) { + updateRestaurant( + documentId: "a1b2c3d4e5d6f7g8h9i0jkl" + data: { + description: "New description in French" + }, + locale: "fr" + ) { + documentId + name + description + locale +} +``` + +### Delete a locale for a document {#graphql-delete} + +Pass the `locale` argument in the mutation to delete a specific localization for a document : + +```graphql +mutation DeleteRestaurant($documentId: ID!, $locale: I18NLocaleCode) { + deleteRestaurant(documentId: "xzmzdo4k0z73t9i68a7yx2kk", locale: "fr") { + documentId + } +} +``` diff --git a/docusaurus/docs/dev-docs/api/query-engine/bulk-operations.md b/docusaurus/docs/dev-docs/api/query-engine/bulk-operations.md index 9dcaab19ec..9948face98 100644 --- a/docusaurus/docs/dev-docs/api/query-engine/bulk-operations.md +++ b/docusaurus/docs/dev-docs/api/query-engine/bulk-operations.md @@ -13,7 +13,6 @@ tags: - updateMany() --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ConsiderDocumentService from '/docs/snippets/consider-document-service.md' # Bulk Operations with the Query Engine API diff --git a/docusaurus/docs/dev-docs/api/query-engine/filtering.md b/docusaurus/docs/dev-docs/api/query-engine/filtering.md index 199ef9f331..191b588194 100644 --- a/docusaurus/docs/dev-docs/api/query-engine/filtering.md +++ b/docusaurus/docs/dev-docs/api/query-engine/filtering.md @@ -11,7 +11,6 @@ tags: - Query Engine API --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ConsiderDocumentService from '/docs/snippets/consider-document-service.md' # Filtering with the Query Engine API diff --git a/docusaurus/docs/dev-docs/api/rest.md b/docusaurus/docs/dev-docs/api/rest.md index d3327aafa2..1abd11e7ab 100644 --- a/docusaurus/docs/dev-docs/api/rest.md +++ b/docusaurus/docs/dev-docs/api/rest.md @@ -1,7 +1,7 @@ --- title: REST API reference description: Interact with your Content-Types using the REST API endpoints Strapi generates for you. -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar tags: - API - Content API @@ -26,10 +26,6 @@ All content types are private by default and need to be either made public or qu By default, the REST API responses only include top-level fields and does not populate any relations, media fields, components, or dynamic zones. Use the [`populate` parameter](/dev-docs/api/rest/populate-select) to populate specific fields. Ensure that the find permission is given to the field(s) for the relation(s) you populate. ::: -:::strapi Upload plugin API -The Upload plugin (which handles media found in the [Media Library](/user-docs/media-library)) has a specific API described in the [Upload plugin documentation](/dev-docs/plugins/upload). -::: - ## Endpoints For each Content-Type, the following endpoints are automatically generated: @@ -120,6 +116,10 @@ The following endpoint examples are taken from the [FoodAdvisor](https://github. +:::strapi Upload API +The Upload package (which powers the [Media Library feature](/user-docs/features/media-library)) has a specific API accessible through its [`/api/upload` endpoints](/dev-docs/api/rest/upload). +::: + :::note [Components](/dev-docs/backend-customization/models#components-json) don't have API endpoints. ::: @@ -274,7 +274,7 @@ In Strapi 5, a specific document is reached by its `documentId`. Creates a document and returns its value. -If the [Internationalization (i18n) plugin](/dev-docs/i18n) is installed, it's possible to use POST requests to the REST API to [create localized documents](/dev-docs/i18n#rest-create). +If the [Internationalization (i18n) plugin](/user-docs/features/internationalization) is installed, it's possible to use POST requests to the REST API to [create localized documents](/dev-docs/api/rest/locale#rest-delete). :::note While creating a document, you can define its relations and their order (see [Managing relations through the REST API](/dev-docs/api/rest/relations.md) for more details). @@ -346,7 +346,7 @@ Send a `null` value to clear fields. :::note NOTES * Even unmodified fields must be included in the request's body. -* Even with the [Internationalization (i18n) plugin](/dev-docs/i18n) installed, it's currently not possible to [update the locale of a document](/dev-docs/i18n#rest-update). +* Even with the [Internationalization (i18n) plugin](/user-docs/features/internationalization) installed, it's currently not possible to [update the locale of a document](/dev-docs/api/rest/locale#rest-update). * While updating a document, you can define its relations and their order (see [Managing relations through the REST API](/dev-docs/api/rest/relations) for more details). ::: diff --git a/docusaurus/docs/dev-docs/api/rest/filters-locale-publication.md b/docusaurus/docs/dev-docs/api/rest/filters.md similarity index 73% rename from docusaurus/docs/dev-docs/api/rest/filters-locale-publication.md rename to docusaurus/docs/dev-docs/api/rest/filters.md index 463634596f..629fe627a5 100644 --- a/docusaurus/docs/dev-docs/api/rest/filters-locale-publication.md +++ b/docusaurus/docs/dev-docs/api/rest/filters.md @@ -1,8 +1,9 @@ --- -title: Filters, Locale, and Publication State +title: Filters description: Use Strapi's REST API to filter the results of your requests. sidebarDepth: 3 -displayed_sidebar: restApiSidebar +sidebar_label: Filters +displayed_sidebar: cmsSidebar tags: - API - complex filtering @@ -19,22 +20,19 @@ tags: import QsIntroFull from '/docs/snippets/qs-intro-full.md' import QsForQueryBody from '/docs/snippets/qs-for-query-body.md' import QsForQueryTitle from '/docs/snippets/qs-for-query-title.md' -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' -# REST API: Filtering, Locale, and Publication State +# REST API: Filters The [REST API](/dev-docs/api/rest) offers the ability to filter results found with its ["Get entries"](/dev-docs/api/rest#get-all) method.
Using optional Strapi features can provide some more filters: -- If the [Internationalization (i18n) plugin](/dev-docs/i18n) is enabled on a content-type, it's possible to filter by locale. +- If the [Internationalization (i18n) plugin](/user-docs/features/internationalization) is enabled on a content-type, it's possible to filter by locale. - If the [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) is enabled, it's possible to filter based on a `published` (default) or `draft` status. :::tip ::: -## Filtering - Queries can accept a `filters` parameter with the following syntax: `GET /api/:pluralApiId?filters[field][operator]=value` @@ -72,8 +70,7 @@ The following operators are available: By default, the filters can only be used from `find` endpoints generated by the Content-type Builder and the CLI. ::: - -### Example: Find users having 'John' as a first name +## Example: Find users having 'John' as a first name You can use the `$eq` filter operator to find an exact match. @@ -87,7 +84,7 @@ You can use the `$eq` filter operator to find an exact match.
- +JavaScript query (built with the qs library): @@ -138,8 +135,7 @@ await request(`/api/users?${query}`); - -### Example: Find multiple restaurants with ids 3, 6,8 +## Example: Find multiple restaurants with ids 3, 6,8 You can use the `$in` filter operator with an array of values to find multiple exact values. @@ -153,7 +149,7 @@ You can use the `$in` filter operator with an array of values to find multiple e
- +JavaScript query (built with the qs library): @@ -201,7 +197,7 @@ await request(`/api/restaurants?${query}`); -### Complex filtering +## Complex filtering Complex filtering is combining multiple filters using advanced methods such as combining `$and` & `$or`. This allows for more flexibility to request exactly the data needed. @@ -214,7 +210,7 @@ Complex filtering is combining multiple filters using advanced methods such as c
- +JavaScript query (built with the qs library): @@ -278,7 +274,7 @@ await request(`/api/books?${query}`); -### Deep filtering +## Deep filtering Deep filtering is filtering on a relation's fields. @@ -308,7 +304,7 @@ Deep filtering is filtering on a relation's fields.
- +JavaScript query (built with the qs library): @@ -361,101 +357,3 @@ await request(`/api/restaurants?${query}`); - -## Locale - -:::prerequisites - -- The [Internationalization (i18n) feature](/dev-docs/i18n) should be installed. -- [Localization should be enabled for the content-type](/user-docs/content-type-builder/creating-new-content-type.md#creating-a-new-content-type). -::: - -The `locale` API parameter can be used to work with entries from a specific locale (see [Internationalization documentation](/dev-docs/i18n#rest)). - -## Status - -:::prerequisites -The [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) feature should be enabled. -::: - -Queries can accept a `status` parameter to fetch documents based on their status: - -- `published`: returns only the published version of documents (default) -- `draft`: returns only the draft version of documents - -:::tip -In the response data, the `publishedAt` field is `null` for drafts. -::: - -:::note -Since published versions are returned by default, passing no status parameter is equivalent to passing `status=published`. -::: - -

- - - - -`GET /api/articles?status=draft` - - - -
- - - - -```js -const qs = require('qs'); -const query = qs.stringify({ - status: 'draft', -}, { - encodeValuesOnly: true, // prettify URL -}); - -await request(`/api/articles?${query}`); -``` - -
- - - -```json {21} -{ - "data": [ - // … - { - "id": 5, - "documentId": "znrlzntu9ei5onjvwfaalu2v", - "Name": "Biscotte Restaurant", - "Description": [ - { - "type": "paragraph", - "children": [ - { - "type": "text", - "text": "This is the draft version." - } - ] - } - ], - "createdAt": "2024-03-06T13:43:30.172Z", - "updatedAt": "2024-03-06T21:38:46.353Z", - "publishedAt": null, - "locale": "en" - }, - // … - ], - "meta": { - "pagination": { - "page": 1, - "pageSize": 25, - "pageCount": 1, - "total": 4 - } - } -} -``` - - -
diff --git a/docusaurus/docs/dev-docs/api/rest/guides/intro.md b/docusaurus/docs/dev-docs/api/rest/guides/intro.md index 2adfb98597..82fd2d71d6 100644 --- a/docusaurus/docs/dev-docs/api/rest/guides/intro.md +++ b/docusaurus/docs/dev-docs/api/rest/guides/intro.md @@ -1,7 +1,7 @@ --- title: REST API Guides description: Deep dive into some specific REST API topics using guides that extensively explain some use cases or give step-by-step instructions. -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar sidebar_label: Guides pagination_prev: dev-docs/api/rest pagination_next: dev-docs/api/rest/guides/understanding-populate diff --git a/docusaurus/docs/dev-docs/api/rest/guides/populate-creator-fields.md b/docusaurus/docs/dev-docs/api/rest/guides/populate-creator-fields.md index 582baf8c92..71300269ce 100644 --- a/docusaurus/docs/dev-docs/api/rest/guides/populate-creator-fields.md +++ b/docusaurus/docs/dev-docs/api/rest/guides/populate-creator-fields.md @@ -1,6 +1,7 @@ --- title: How to populate creator fields description: Learn how to populate creator fields such as createdBy and updatedBy by creating a custom controller that leverages the populate parameter. +displayed_sidebar: cmsSidebar tags: - API - Content API @@ -13,12 +14,8 @@ tags: - updatedBy --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # 🛠️ How to populate creator fields such as `createdBy` and `updatedBy` - - The creator fields `createdBy` and `updatedBy` are removed from the [REST API](/dev-docs/api/rest) response by default. These 2 fields can be returned in the REST API by activating the `populateCreatorFields` parameter at the content-type level. :::note diff --git a/docusaurus/docs/dev-docs/api/rest/guides/understanding-populate.md b/docusaurus/docs/dev-docs/api/rest/guides/understanding-populate.md index be893a0ddc..0b5a743259 100644 --- a/docusaurus/docs/dev-docs/api/rest/guides/understanding-populate.md +++ b/docusaurus/docs/dev-docs/api/rest/guides/understanding-populate.md @@ -1,7 +1,7 @@ --- title: Understanding populate description: Learn what populating means and how you can use the populate parameter in your REST API queries to add additional fields to your responses. -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar toc_max_heading_level: 6 tags: - API diff --git a/docusaurus/docs/dev-docs/api/rest/interactive-query-builder.md b/docusaurus/docs/dev-docs/api/rest/interactive-query-builder.md index bf54950eee..f591faaf5f 100644 --- a/docusaurus/docs/dev-docs/api/rest/interactive-query-builder.md +++ b/docusaurus/docs/dev-docs/api/rest/interactive-query-builder.md @@ -1,7 +1,8 @@ --- title: Interactive Query Builder description: Use an interactive tool that leverages the querystring library to build your query URL -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar +sidebar_label: Interactive Query Builder tags: - Content API - interactive query builder diff --git a/docusaurus/docs/dev-docs/i18n.md b/docusaurus/docs/dev-docs/api/rest/locale.md similarity index 61% rename from docusaurus/docs/dev-docs/i18n.md rename to docusaurus/docs/dev-docs/api/rest/locale.md index 13eb59d840..cdd29a5ece 100644 --- a/docusaurus/docs/dev-docs/i18n.md +++ b/docusaurus/docs/dev-docs/api/rest/locale.md @@ -1,57 +1,34 @@ --- -title: Internationalization (i18n) -displayed_sidebar: cmsSidebar -toc_max_heading_level: 4 -description: Instructions on how to use Strapi Content API with the Internationalization (i18n) optional plugin +title: Locale +description: Browse the REST API reference for the locale parameter to take advantage of the Internationalization feature through REST. +toc_max_heading_level: 5 tags: -- collection type -- documentId -- locale -- GraphQL API -- Internationalization (i18n) - REST API -- single type +- Internationalization +- API +- locale +- Content API +- find +- interactive query builder +- qs library --- +import QsIntroFull from '/docs/snippets/qs-intro-full.md' +import QsForQueryBody from '/docs/snippets/qs-for-query-body.md' +import QsForQueryTitle from '/docs/snippets/qs-for-query-title.md' -# 🌍 Internationalization (i18n) - -The Internationalization (i18n) feature allows Strapi users to create, manage and distribute localized content in different languages, called "locales". For more information about the concept of internationalization, please refer to the -[W3C definition](https://www.w3.org/International/questions/qa-i18n.en#i18n). - -The i18n feature: - -- allows admin panel users to create several localized versions of their content (see [User Guide](/user-docs/content-manager/translating-content)) -- allows developers to build localized projects by fetching and consuming the right content depending on the country/language of the audience. - -:::info -The i18n feature does not automatically translate the users' content nor adapt the admin interface to languages specificities (e.g., displaying the admin panel in Right To Left format). -::: - -:::note Notes -* In Strapi 5, i18n is no longer a plugin and is installed by default. You can still decide to [enable/disable it on a content-type](/user-docs/content-type-builder/creating-new-content-type#creating-a-new-content-type), and [enable/disable it at the field-level ](/user-docs/content-type-builder/configuring-fields-content-type) in an i18n-enabled content-type. -* Since i18n is part of the Strapi core, this might affect how some parameters are sent to the Content Manager (see the [related breaking change entry](/dev-docs/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale)). -::: - -## Configuration of the default locale - -A `STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE` [environment variable](/dev-docs/configurations/environment#strapi) can be configured to set the default locale for your environment. The value used for this variable should be an ISO country code (see [full list of available locales](https://github.com/strapi/strapi/blob/v4.0.0/packages/plugins/i18n/server/constants/iso-locales.json)). - +# REST API: `locale` -This is useful when a Strapi application is deployed in production, with the i18n feature installed and enabled for your content types the first time. On a fresh i18n installation, `en` is set as default locale. If the database does not contain any locale, and no `STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE` is set for the environment, all documents of content types that have localization enabled will be automatically migrated to the `en` locale. - -## Use `locale` with the REST API {#rest} - -The Internationalization (i18n) feature adds new abilities to the [REST API](/dev-docs/api/rest). +The [Internationalization (i18n) feature](/user-docs/features/internationalization) adds new abilities to the [REST API](/dev-docs/api/rest). :::prerequisites -To work with API content for a locale, please ensure the locale has been already [added to Strapi in the admin panel](/user-docs/settings/internationalization). +To work with API content for a locale, please ensure the locale has been already [added to Strapi in the admin panel](/user-docs/features/internationalization#settings). ::: -The `locale` [API parameter](/dev-docs/api/rest/parameters) can be used to work documents only for a specified locale. `locale` takes a locale code as a value (see [full list of available locales](https://github.com/strapi/strapi/blob/v4.0.0/packages/plugins/i18n/server/constants/iso-locales.json)). +The `locale` [API parameter](/dev-docs/api/rest/parameters) can be used to work with documents only for a specified locale. `locale` takes a locale code as a value (see [full list of available locales](https://github.com/strapi/strapi/blob/main/packages/plugins/i18n/server/src/constants/iso-locales.json)). :::tip -If the `locale` parameter is not defined, it will be set to the default locale. `en` is the default locale when a new Strapi project is created, but another locale can be [set as the default locale](/user-docs/settings/internationalization) in the admin panel. +If the `locale` parameter is not defined, it will be set to the default locale. `en` is the default locale when a new Strapi project is created, but another locale can be [set as the default locale](/user-docs/features/internationalization#settings) in the admin panel. For instance, by default, a GET request to `/api/restaurants` will return the same response as a request to `/api/restaurants?locale=en`. ::: @@ -84,10 +61,7 @@ The following table lists the new possible use cases added by i18n to the REST A -### Get all documents in a specific locale {#rest-get-all} - - - +### `GET` Get all documents in a specific locale {#rest-get-all} @@ -137,7 +111,7 @@ The following table lists the new possible use cases added by i18n to the REST A -### Get a document in a specific locale {#rest-get} +### `GET` Get a document in a specific locale {#rest-get} To get a specific document in a given locale, add the `locale` parameter to the query: @@ -232,7 +206,7 @@ To get a specific single type document in a given locale, add the `locale` param -### Create a new localized document for a collection type {#rest-create} +### `POST` Create a new localized document for a collection type {#rest-create} To create a localized document from scratch, send a POST request to the Content API. Depending on whether you want to create it for the default locale or for another locale, you might need to pass the `locale` parameter in the request's body @@ -322,7 +296,7 @@ To create a localized entry for a locale different from the default one, add the -### Create a new, or update an existing, locale version for an existing document {#rest-update} +### `PUT` Create a new, or update an existing, locale version for an existing document {#rest-update} With `PUT` requests sent to an existing document, you can: @@ -434,7 +408,7 @@ To create a new locale for an existing single type document, add the `locale` pa
-### Delete a locale version of a document {#rest-delete} +### `DELETE` Delete a locale version of a document {#rest-delete} To delete a locale version of a document, send a `DELETE` request with the appropriate `locale` parameter. @@ -459,148 +433,3 @@ To delete only a specific locale version of a single type document, add the `loc `DELETE /api/homepage?locale=fr` - -## Use `locale` with the GraphQL API {#graphql} - -The i18n feature adds new features to the [GraphQL API](/dev-docs/api/graphql): - -- The `locale` field is added to the GraphQL schema. -- GraphQL can be used: - - to query documents for a specific locale with the `locale` argument - - for mutations to [create](#graphql-create), [update](#graphql-update), and [delete](#graphql-delete) documents for a specific locale - -### Fetch all documents in a specific locale {#graphql-fetch-all} - -To fetch all documents for a specific locale, pass the `locale` argument to the query: - - - - - -```graphql -query { - restaurants(locale: "fr") { - documentId - name - locale - } -} -``` - - - - - -```json -{ - "data": { - "restaurants": [ - { - "documentId": "a1b2c3d4e5d6f7g8h9i0jkl", - "name": "Restaurant Biscotte", - "locale": "fr" - }, - { - "documentId": "m9n8o7p6q5r4s3t2u1v0wxyz", - "name": "Pizzeria Arrivederci", - "locale": "fr" - }, - ] - } -} -``` - - - - - -### Fetch a document in a specific locale {#graphql-fetch} - -To fetch a documents for a specific locale, pass the `documentId` and the `locale` arguments to the query: - - - - - -```graphql -query Restaurant($documentId: ID!, $locale: I18NLocaleCode) { - restaurant(documentId: "a1b2c3d4e5d6f7g8h9i0jkl", locale: "fr") { - documentId - name - description - locale - } -} -``` - - - - - -```json -{ - "data": { - "restaurant": { - "documentId": "lviw819d5htwvga8s3kovdij", - "name": "Restaurant Biscotte", - "description": "Bienvenue au restaurant Biscotte!", - "locale": "fr" - } - } -} -``` - - - - -### Create a new localized document {#graphql-create} - -The `locale` field can be passed to create a localized document for a specific locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#create-a-new-document)). - -```graphql title="Example: Create a new restaurant for the French locale" -mutation CreateRestaurant($data: RestaurantInput!, $locale: I18NLocaleCode) { - createRestaurant( - data: { - name: "Brasserie Bonjour", - description: "Description in French goes here" - }, - locale: "fr" - ) { - documentId - name - description - locale -} -``` - -### Update a document for a specific locale {#graphql-update} - -A `locale` argument can be passed in the mutation to update a document for a given locale (for more information about mutations with GraphQL, see [the GraphQL API documentation](/dev-docs/api/graphql#update-an-existing-document)). - -```graphql title="Example: Update the description field of restaurant for the French locale" -mutation UpdateRestaurant($documentId: ID!, $data: RestaurantInput!, $locale: I18NLocaleCode) { - updateRestaurant( - documentId: "a1b2c3d4e5d6f7g8h9i0jkl" - data: { - description: "New description in French" - }, - locale: "fr" - ) { - documentId - name - description - locale -} -``` - -### Delete a locale for a document {#graphql-delete} - -Pass the `locale` argument in the mutation to delete a specific localization for a document : - -```graphql -mutation DeleteRestaurant($documentId: ID!, $locale: I18NLocaleCode) { - deleteRestaurant(documentId: "xzmzdo4k0z73t9i68a7yx2kk", locale: "fr") { - documentId - } -} -``` diff --git a/docusaurus/docs/dev-docs/api/rest/parameters.md b/docusaurus/docs/dev-docs/api/rest/parameters.md index 2c4f64ff7f..d511de01e7 100644 --- a/docusaurus/docs/dev-docs/api/rest/parameters.md +++ b/docusaurus/docs/dev-docs/api/rest/parameters.md @@ -1,7 +1,7 @@ --- title: Parameters description: Use API parameters to refine your Strapi REST API queries. - +sidebar_label: Parameters next: ./filtering-locale-publication.md tags: - API @@ -14,8 +14,6 @@ tags: - status --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # REST API parameters API parameters can be used with the [REST API](/dev-docs/api/rest) to filter, sort, and paginate results and to select fields and relations to populate. Additionally, specific parameters related to optional Strapi features can be used, like the publication state and locale of a content-type. @@ -24,11 +22,11 @@ The following API parameters are available: | Operator | Type | Description | | ------------------ | ------------- | ----------------------------------------------------- | +| `filters` | Object | [Filter the response](/dev-docs/api/rest/filters) | +| `locale` | String | [Select a locale](/dev-docs/api/rest/locale) | +| `status` | String | [Select the Draft & Publish status](/dev-docs/api/rest/status) | | `populate` | String or Object | [Populate relations, components, or dynamic zones](/dev-docs/api/rest/populate-select#population) | | `fields` | Array | [Select only specific fields to display](/dev-docs/api/rest/populate-select#field-selection) | -| `filters` | Object | [Filter the response](/dev-docs/api/rest/filters-locale-publication#filtering) | -| `locale` | String | [Select a locale](/dev-docs/i18n#rest) | -| `status` | String | [Select the Draft & Publish status](/dev-docs/api/rest/filters-locale-publication#status) | | `sort` | String or Array | [Sort the response](/dev-docs/api/rest/sort-pagination.md#sorting) | | `pagination` | Object | [Page through entries](/dev-docs/api/rest/sort-pagination.md#pagination) | diff --git a/docusaurus/docs/dev-docs/api/rest/populate-select.md b/docusaurus/docs/dev-docs/api/rest/populate-select.md index 484e433b22..f0643c808b 100644 --- a/docusaurus/docs/dev-docs/api/rest/populate-select.md +++ b/docusaurus/docs/dev-docs/api/rest/populate-select.md @@ -2,7 +2,8 @@ title: Populate and Select description: Use Strapi's REST API to populate or select certain fields. sidebarDepth: 3 -displayed_sidebar: restApiSidebar +sidebar_label: Populate & Select +displayed_sidebar: cmsSidebar tags: - API - Content API @@ -17,7 +18,6 @@ tags: import QsIntroFull from '/docs/snippets/qs-intro-full.md' import QsForQueryTitle from '/docs/snippets/qs-for-query-title.md' import QsForQueryBody from '/docs/snippets/qs-for-query-body.md' -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' # REST API: Population & Field Selection @@ -157,7 +157,7 @@ The easiest way to build complex queries with multiple-level population is to us ### Combining Population with other operators -By utilizing the `populate` operator it is possible to combine other operators such as [field selection](/dev-docs/api/rest/populate-select#field-selection), [filters](/dev-docs/api/rest/filters-locale-publication), and [sort](/dev-docs/api/rest/sort-pagination) in the population queries. +By utilizing the `populate` operator it is possible to combine other operators such as [field selection](/dev-docs/api/rest/populate-select#field-selection), [filters](/dev-docs/api/rest/filters), and [sort](/dev-docs/api/rest/sort-pagination) in the population queries. :::caution The population and pagination operators cannot be combined. diff --git a/docusaurus/docs/dev-docs/api/rest/relations.md b/docusaurus/docs/dev-docs/api/rest/relations.md index 0264bc0fe0..37f1885979 100644 --- a/docusaurus/docs/dev-docs/api/rest/relations.md +++ b/docusaurus/docs/dev-docs/api/rest/relations.md @@ -1,7 +1,8 @@ --- title: Relations description: Use the REST API to manage the order of relations -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar +sidebar_label: Relations tags: - API - relations @@ -10,8 +11,6 @@ tags: - REST API --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Managing relations with API requests Defining relations between content-types (that are designated as entities in the database layers) is connecting entities with each other. diff --git a/docusaurus/docs/dev-docs/api/rest/sort-pagination.md b/docusaurus/docs/dev-docs/api/rest/sort-pagination.md index 282b31b382..3d889612f8 100644 --- a/docusaurus/docs/dev-docs/api/rest/sort-pagination.md +++ b/docusaurus/docs/dev-docs/api/rest/sort-pagination.md @@ -1,8 +1,9 @@ --- title: Sort and Pagination description: Use Strapi's REST API to sort or paginate your data. +sidebar_label: Sort & Pagination sidebarDepth: 3 -displayed_sidebar: restApiSidebar +displayed_sidebar: cmsSidebar tags: - API - Content API @@ -18,7 +19,6 @@ tags: import QsIntroFull from '/docs/snippets/qs-intro-full.md' import QsForQueryTitle from '/docs/snippets/qs-for-query-title.md' import QsForQueryBody from '/docs/snippets/qs-for-query-body.md' -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' # REST API: Sort & Pagination @@ -57,7 +57,7 @@ You can sort by multiple fields by passing fields in a `sort` array.
- +JavaScript query (built with the qs library): @@ -138,7 +138,7 @@ Using the `sort` parameter and defining `:asc` or `:desc` on sorted fields, you
- +JavaScript query (built with the qs library): @@ -235,7 +235,7 @@ To paginate results by page, use the following parameters:
- +JavaScript query (built with the qs library): @@ -298,7 +298,7 @@ The default and maximum values for `pagination[limit]` can be [configured in the
- +JavaScript query (built with the qs library): diff --git a/docusaurus/docs/dev-docs/api/rest/status.md b/docusaurus/docs/dev-docs/api/rest/status.md new file mode 100644 index 0000000000..591c6651d3 --- /dev/null +++ b/docusaurus/docs/dev-docs/api/rest/status.md @@ -0,0 +1,109 @@ +--- +title: Status +description: Use Strapi's REST API to work with draft or published versions of your documents. +sidebarDepth: 3 +sidebar_label: Status +displayed_sidebar: cmsSidebar +tags: +- API +- Content API +- find +- interactive query builder +- REST API +- qs library +- status +--- + +import QsIntroFull from '/docs/snippets/qs-intro-full.md' +import QsForQueryBody from '/docs/snippets/qs-for-query-body.md' +import QsForQueryTitle from '/docs/snippets/qs-for-query-title.md' + +# REST API: `status` + +The [REST API](/dev-docs/api/rest) offers the ability to filter results based on their status, draft or published. + +:::prerequisites +The [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) feature should be enabled. +::: + +Queries can accept a `status` parameter to fetch documents based on their status: + +- `published`: returns only the published version of documents (default) +- `draft`: returns only the draft version of documents + +:::tip +In the response data, the `publishedAt` field is `null` for drafts. +::: + +:::note +Since published versions are returned by default, passing no status parameter is equivalent to passing `status=published`. +::: + +

+ + + + +`GET /api/articles?status=draft` + + + +
+JavaScript query (built with the qs library): + + + +```js +const qs = require('qs'); +const query = qs.stringify({ + status: 'draft', +}, { + encodeValuesOnly: true, // prettify URL +}); + +await request(`/api/articles?${query}`); +``` + +
+ + + +```json {21} +{ + "data": [ + // … + { + "id": 5, + "documentId": "znrlzntu9ei5onjvwfaalu2v", + "Name": "Biscotte Restaurant", + "Description": [ + { + "type": "paragraph", + "children": [ + { + "type": "text", + "text": "This is the draft version." + } + ] + } + ], + "createdAt": "2024-03-06T13:43:30.172Z", + "updatedAt": "2024-03-06T21:38:46.353Z", + "publishedAt": null, + "locale": "en" + }, + // … + ], + "meta": { + "pagination": { + "page": 1, + "pageSize": 25, + "pageCount": 1, + "total": 4 + } + } +} +``` + + +
diff --git a/docusaurus/docs/dev-docs/api/rest/upload.md b/docusaurus/docs/dev-docs/api/rest/upload.md new file mode 100644 index 0000000000..5fc495749d --- /dev/null +++ b/docusaurus/docs/dev-docs/api/rest/upload.md @@ -0,0 +1,228 @@ +--- +title: Upload files +description: Learn how to use the /api/upload endpoints to upload files to Strapi with the REST API. +tags: +- API +- Content API +- upload +- REST API +- Media Library +--- + +# REST API: Upload files + +The [Media Library feature](/user-docs/features/media-library) is powered in the back-end server of Strapi by the `upload` package. To upload files to Strapi, you can either use the Media Library directly from the admin panel, or use the [REST API](/dev-docs/api/rest), with the following available endpoints : + +| Method | Path | Description | +| :----- | :---------------------- | :------------------ | +| GET | `/api/upload/files` | Get a list of files | +| GET | `/api/upload/files/:id` | Get a specific file | +| POST | `/api/upload` | Upload files | +| POST | `/api/upload?id=x` | Update fileInfo | +| DELETE | `/api/upload/files/:id` | Delete a file | + +:::note Notes +- [Folders](/user-docs/features/media-library#organizing-assets-with-folders) are an admin panel-only feature and are not part of the Content API (REST or GraphQL). Files uploaded through REST are located in the automatically created "API Uploads" folder. +- The GraphQL API does not support uploading media files. To upload files, use the REST API or directly add files from the [Media Library](/user-docs/features/media-library) in the admin panel. Some GraphQL mutations to update or delete uploaded media files are still possible (see [GraphQL API documentation](/dev-docs/api/graphql#mutations-on-media-files) for details). +::: + +## Upload files + +Upload one or more files to your application. + +`files` is the only accepted parameter, and describes the file(s) to upload. The value(s) can be a Buffer or Stream: + + + + +```html +
+ + + +
+ + +``` + +
+ + + +```js +import { FormData } from 'formdata-node'; +import fetch, { blobFrom } from 'node-fetch'; + +const file = await blobFrom('./1.png', 'image/png'); +const form = new FormData(); + +form.append('files', file, "1.png"); + +const response = await fetch('http://localhost:1337/api/upload', { + method: 'post', + body: form, +}); + +``` + + + +
+ +:::caution +You have to send FormData in your request body. +::: + +## Upload entry files + +Upload one or more files that will be linked to a specific entry. + +The following parameters are accepted: + +| Parameter | Description | +| --------- | ----------- | +|`files` | The file(s) to upload. The value(s) can be a Buffer or Stream. | +|`path` (optional) | The folder where the file(s) will be uploaded to (only supported on strapi-provider-upload-aws-s3). | +| `refId` | The ID of the entry which the file(s) will be linked to. | +| `ref` | The unique ID (uid) of the model which the file(s) will be linked to (see more below). | +| `source` (optional) | The name of the plugin where the model is located. | +| `field` | The field of the entry which the file(s) will be precisely linked to. | + +For example, given the `Restaurant` model attributes: + +```json title="/src/api/restaurant/content-types/restaurant/schema.json" +{ + // ... + "attributes": { + "name": { + "type": "string" + }, + "cover": { + "type": "media", + "multiple": false, + } + } +// ... +} +``` + +The following is an example of a corresponding front-end code: + +```html +
+ + + + + + +
+ + +``` + +:::caution +You have to send FormData in your request body. +::: + +## Update fileInfo + +Update a file in your application. + +`fileInfo` is the only accepted parameter, and describes the fileInfo to update: + +```js +import { FormData } from 'formdata-node'; +import fetch from 'node-fetch'; + +const fileId = 50; +const newFileData = { + alternativeText: 'My new alternative text for this image!', +}; + +const form = new FormData(); + +form.append('fileInfo', JSON.stringify(newFileData)); + +const response = await fetch(`http://localhost:1337/api/upload?id=${fileId}`, { + method: 'post', + body: form, +}); + +``` + +## Models definition + +Adding a file attribute to a [model](/dev-docs/backend-customization/models) (or the model of another plugin) is like adding a new association. + +The following example lets you upload and attach one file to the `avatar` attribute: + +```json title="/src/api/restaurant/content-types/restaurant/schema.json" + +{ + // ... + { + "attributes": { + "pseudo": { + "type": "string", + "required": true + }, + "email": { + "type": "email", + "required": true, + "unique": true + }, + "avatar": { + "type": "media", + "multiple": false, + } + } + } + // ... +} + +``` + +The following example lets you upload and attach multiple pictures to the `restaurant` content-type: + +```json title="/src/api/restaurant/content-types/restaurant/schema.json" +{ + // ... + { + "attributes": { + "name": { + "type": "string", + "required": true + }, + "covers": { + "type": "media", + "multiple": true, + } + } + } + // ... +} +``` + diff --git a/docusaurus/docs/dev-docs/backend-customization/examples/services-and-controllers.md b/docusaurus/docs/dev-docs/backend-customization/examples/services-and-controllers.md index 76b196bf5f..70508428b9 100644 --- a/docusaurus/docs/dev-docs/backend-customization/examples/services-and-controllers.md +++ b/docusaurus/docs/dev-docs/backend-customization/examples/services-and-controllers.md @@ -303,14 +303,14 @@ Out of the box, [FoodAdvisor](https://github.com/strapi/foodadvisor) does not pr Let's create an `email.js` service file to send an email. We could use it in a [custom controller](#custom-controller) to notify the restaurant owner whenever a new review is created on the front-end website. :::callout 🤗 Optional service -This service is an advanced code example using the [Email](/dev-docs/plugins/email) plugin and requires understanding how [plugins](/dev-docs/plugins) and [providers](/dev-docs/providers) work with Strapi. If you don't need an email service to notify the restaurant's owner, you can skip this part and jump next to the custom [controller](#custom-controller) example. +This service is an advanced code example using the [Email](/user-docs/features/email) plugin and requires understanding how [plugins](/dev-docs/plugins) and [providers](/dev-docs/providers) work with Strapi. If you don't need an email service to notify the restaurant's owner, you can skip this part and jump next to the custom [controller](#custom-controller) example. ::: :::prerequisites -- You have setup a [provider for the Email plugin](/dev-docs/plugins/email), for instance the [Sendmail](https://www.npmjs.com/package/@strapi/provider-email-sendmail) provider. +- You have setup a [provider for the Email plugin](/user-docs/features/email), for instance the [Sendmail](https://www.npmjs.com/package/@strapi/provider-email-sendmail) provider. - In Strapi's admin panel, you have [created an `Email` single type](/user-docs/content-type-builder/creating-new-content-type#creating-a-new-content-type) that contains a `from` Text field to define the sender email address. ::: @@ -343,7 +343,7 @@ This service is an advanced code example using the [Email](/dev-docs/plugins/ema -Additional information can be found in the [Services](/dev-docs/backend-customization/services), [Entity Service API](/dev-docs/api/entity-service), [Email plugin](/dev-docs/plugins/email) and [Providers](/dev-docs/providers) documentation. +Additional information can be found in the [Services](/dev-docs/backend-customization/services), [Entity Service API](/dev-docs/api/entity-service), [Email plugin](/user-docs/features/email) and [Providers](/dev-docs/providers) documentation. diff --git a/docusaurus/docs/dev-docs/backend-customization/models.md b/docusaurus/docs/dev-docs/backend-customization/models.md index 0f1da8d007..6e82b8f5b6 100644 --- a/docusaurus/docs/dev-docs/backend-customization/models.md +++ b/docusaurus/docs/dev-docs/backend-customization/models.md @@ -116,7 +116,7 @@ Many types of attributes are available: - `customField` to describe [custom fields](#custom-fields) and their specific keys - `component` to define a [component](#components-json) (i.e. a data structure usable in multiple content-types) - `dynamiczone` to define a [dynamic zone](#dynamic-zones) (i.e. a flexible space based on a list of components) - - and the `locale` and `localizations` types, only used by the [Internationalization (i18n) plugin](/dev-docs/i18n) + - and the `locale` and `localizations` types, only used by the [Internationalization (i18n) plugin](/user-docs/features/internationalization) The `type` parameter of an attribute should be one of the following values: @@ -127,7 +127,7 @@ The `type` parameter of an attribute should be one of the following values: | Number types |
  • `integer`
  • `biginteger`
  • `float`
  • `decimal`
| | Other generic types |
  • `boolean`
  • `json`
| | Special types unique to Strapi |
  • `media`
  • [`relation`](#relations)
  • [`customField`](#custom-fields)
  • [`component`](#components-json)
  • [`dynamiczone`](#dynamic-zones)
| -| Internationalization (i18n)-related types

_Can only be used if the [i18n](/dev-docs/i18n) is enabled on the content-type_|
  • `locale`
  • `localizations`
| +| Internationalization (i18n)-related types

_Can only be used if the [i18n](/user-docs/features/internationalization) is enabled on the content-type_|
  • `locale`
  • `localizations`
| #### Validations diff --git a/docusaurus/docs/dev-docs/backend-customization/requests-responses.md b/docusaurus/docs/dev-docs/backend-customization/requests-responses.md index 4f6dd30624..41016b344e 100644 --- a/docusaurus/docs/dev-docs/backend-customization/requests-responses.md +++ b/docusaurus/docs/dev-docs/backend-customization/requests-responses.md @@ -79,12 +79,12 @@ Given an API request sent to the `https://example.com:1337/api/restaurants?id=12 | -------------------------------------| --------------------------------------------------------------------------------------------------------------------------- | -------------------- | | `ctx.request.query`
`ctx.query` | The whole query object. | `Object` | | `ctx.request.query.sort` | Parameters to [sort the response](/dev-docs/api/rest/sort-pagination.md#sorting) | `String` or `Array` | -| `ctx.request.query.filters` | Parameters to [filter the response](/dev-docs/api/rest/filters-locale-publication#filtering) | `Object` | +| `ctx.request.query.filters` | Parameters to [filter the response](/dev-docs/api/rest/filters) | `Object` | | `ctx.request.query.populate` | Parameters to [populate relations, components, or dynamic zones](/dev-docs/api/rest/populate-select#population) | `String` or `Object` | | `ctx.request.query.fields` | Parameters to [select only specific fields to return with the response](/dev-docs/api/rest/populate-select#field-selection) | `Array` | | `ctx.request.query.pagination` | Parameter to [page through entries](/dev-docs/api/rest/sort-pagination.md#pagination) | `Object` | -| `ctx.request.query.publicationState` | Parameter to [select the Draft & Publish state](/dev-docs/api/rest/filters-locale-publication#status) | `String` | -| `ctx.request.query.locale` | Parameter to [select one or multiple locales](/dev-docs/api/rest/filters-locale-publication#locale) | `String` or `Array` | +| `ctx.request.query.publicationState` | Parameter to [select the Draft & Publish state](/dev-docs/api/rest/status) | `String` | +| `ctx.request.query.locale` | Parameter to [select one or multiple locales](/dev-docs/api/rest/locale) | `String` or `Array` | ## `ctx.state` diff --git a/docusaurus/docs/dev-docs/backend-customization/webhooks.md b/docusaurus/docs/dev-docs/backend-customization/webhooks.md index 859a637124..b8ada1a816 100644 --- a/docusaurus/docs/dev-docs/backend-customization/webhooks.md +++ b/docusaurus/docs/dev-docs/backend-customization/webhooks.md @@ -13,12 +13,8 @@ tags: - webhooks --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Webhooks - - Webhook is a construct used by an application to notify other applications that an event occurred. More precisely, webhook is a user-defined HTTP callback. Using a webhook is a good way to tell third party providers to start some processing (CI, build, deployment ...). The way a webhook works is by delivering information to a receiving application through HTTP requests (typically POST requests). @@ -210,7 +206,7 @@ By default Strapi webhooks can be triggered by the following events: | [`media.update`](#mediaupdate) | Triggered when a media is updated. | | [`media.delete`](#mediadelete) | Triggered when a media is deleted. | | [`review-workflows.updateEntryStage`](#review-workflowsupdateentrystage) | Triggered when content is moved between review stages (see [review workflows](/user-docs/settings/review-workflows)).
This event is only available with the edition of Strapi. | -| [`releases.publish`](#releases-publish) | Triggered when a Release is published (see [Releases](/user-docs/releases/introduction)).
This event is only available with the edition of Strapi and the plan for Strapi Cloud. | +| [`releases.publish`](#releases-publish) | Triggered when a Release is published (see [Releases](/user-docs/releases/introduction)).
This event is only available with the or plan of Strapi CMS and the plan for Strapi Cloud. | \*only when `draftAndPublish` is enabled on this Content Type. @@ -447,7 +443,7 @@ This event is triggered only when you delete a media through the media interface ### `review-workflows.updateEntryStage` -This event is only available with the edition of Strapi.
The event is triggered when content is moved to a new review stage (see [Review Workflows](/user-docs/settings/review-workflows)). +This event is only available with the plan of Strapi.
The event is triggered when content is moved to a new review stage (see [Review Workflows](/user-docs/settings/review-workflows)). **Example payload** @@ -477,7 +473,7 @@ This event is only available with the edition of Strapi.
+ The event is triggered when a [release](/user-docs/releases/introduction) is published. diff --git a/docusaurus/docs/dev-docs/cli.md b/docusaurus/docs/dev-docs/cli.md index 7e83fd6090..d8abb6d470 100644 --- a/docusaurus/docs/dev-docs/cli.md +++ b/docusaurus/docs/dev-docs/cli.md @@ -2,6 +2,7 @@ title: Command Line Interface displayed_sidebar: cmsSidebar description: Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds. +sidebar_label: Strapi CLI tags: - Command Line Interface (CLI) - strapi develop @@ -13,12 +14,8 @@ tags: - strapi report --- -import NotV5 from '/docs/snippets/\_not-updated-to-v5.md' - # Command Line Interface (CLI) - - Strapi comes with a full featured Command Line Interface (CLI) which lets you scaffold and manage your project in seconds. The CLI works with both the `yarn` and `npm` package managers. :::caution @@ -114,7 +111,7 @@ Deploys to Strapi Cloud (see [Cloud CLI](/cloud/cli/cloud-cli#strapi-deploy) doc ## strapi export -[Exports your project data](/dev-docs/data-management). The default settings create a `.tar` file, compressed using `gzip` and encrypted using `aes-128-ecb`. +[Exports your project data](/user-docs/features/data-management). The default settings create a `.tar` file, compressed using `gzip` and encrypted using `aes-128-ecb`. ```bash strapi export @@ -144,7 +141,7 @@ strapi export --no-encrypt ## strapi import -[Imports data](/dev-docs/data-management) into your project. The imported data must originate from another Strapi application. You must pass the `--file` option to specify the filename and location for the import action. +[Imports data](/user-docs/features/data-management) into your project. The imported data must originate from another Strapi application. You must pass the `--file` option to specify the filename and location for the import action. ```bash strapi import diff --git a/docusaurus/docs/dev-docs/community.md b/docusaurus/docs/dev-docs/community.md index 31ba8b81c2..a6a33ad1be 100644 --- a/docusaurus/docs/dev-docs/community.md +++ b/docusaurus/docs/dev-docs/community.md @@ -35,6 +35,6 @@ You can join [GitHub](https://github.com/strapi/strapi), the [Forum](https://for ## Support -Strapi is offered as free and open-source for users who wish to self-host the software. When having an issue or a question, the [forum](https://forum.strapi.io) is great first place to reach out for help. Both the Strapi community and core developers often check this platform and answer posts. +Strapi's Community plan is a free and open-source option for users who wish to self-host the software. If you have an issue or a question, the [forum](https://forum.strapi.io) is great first place to reach out for help. Both the Strapi community and core developers often check this platform and answer posts. -For enterprise support, please see our [Enterprise Support platform](https://support.strapi.io/support/home). Please note that you will need to have an active license to place tickets. +For customers on our paid plans, you can reference our [Support platform](https://support.strapi.io/support/home) to determine your support level and check out our Support platform for more information. Please note that you must have an active or plan to submit a ticket. diff --git a/docusaurus/docs/dev-docs/configurations.md b/docusaurus/docs/dev-docs/configurations.md index 29aeb007e4..541dcebba5 100644 --- a/docusaurus/docs/dev-docs/configurations.md +++ b/docusaurus/docs/dev-docs/configurations.md @@ -2,6 +2,7 @@ title: Configurations description: Learn how you can manage and customize the configuration of your Strapi application. displayed_sidebar: cmsSidebar +sidebar_label: Introduction pagination_prev: dev-docs/installation pagination_next: dev-docs/setup-deployment tags: diff --git a/docusaurus/docs/dev-docs/configurations/admin-panel.md b/docusaurus/docs/dev-docs/configurations/admin-panel.md index 3cc5367675..aea281cb38 100644 --- a/docusaurus/docs/dev-docs/configurations/admin-panel.md +++ b/docusaurus/docs/dev-docs/configurations/admin-panel.md @@ -13,12 +13,8 @@ tags: - password --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Admin panel configuration - - The `./config/admin.js` is used to define admin panel configuration for the Strapi application. ## Available options @@ -49,7 +45,7 @@ The `./config/admin.js` file can include the following parameters: | `flags.nps` | Enable/Disable the Net Promoter Score popup | boolean | `true` | | `flags.promoteEE` | Enable/Disable the promotion of Strapi Enterprise features | boolean | `true` | | `forgotPassword` | Settings to customize the forgot password email (see [Forgot Password Email](/user-docs/settings/configuring-users-permissions-plugin-settings#configuring-email-templates)) | object | {} | -| `forgotPassword.emailTemplate` | Email template as defined in [email plugin](/dev-docs/plugins/email#using-the-sendtemplatedemail-function) | object | [Default template](https://github.com/strapi/strapi/blob/main/packages/core/admin/server/config/email-templates/forgot-password.js) | +| `forgotPassword.emailTemplate` | Email template as defined in [email plugin](/user-docs/features/email#using-the-sendtemplatedemail-function) | object | [Default template](https://github.com/strapi/strapi/blob/main/packages/core/admin/server/config/email-templates/forgot-password.js) | | `forgotPassword.from` | Sender mail address | string | Default value defined in
your [provider configuration](/dev-docs/providers#configuring-providers) | | `forgotPassword.replyTo` | Default address or addresses the receiver is asked to reply to | string | Default value defined in
your [provider configuration](/dev-docs/providers#configuring-providers) | | `rateLimit` | Settings to customize the rate limiting of the admin panel's authentication endpoints, additional configuration options come from [`koa2-ratelimit`](https://www.npmjs.com/package/koa2-ratelimit) | object | {} | diff --git a/docusaurus/docs/dev-docs/configurations/api-tokens.md b/docusaurus/docs/dev-docs/configurations/api-tokens.md index 1b06f23085..3ae709e474 100644 --- a/docusaurus/docs/dev-docs/configurations/api-tokens.md +++ b/docusaurus/docs/dev-docs/configurations/api-tokens.md @@ -12,12 +12,8 @@ tags: - REST API --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # API tokens - - Authentication strategies in Strapi can either be based on the use of the [Users & Permissions plugin](/user-docs/users-roles-permissions) or on the built-in API token feature. Using API tokens allows executing a request on [REST API](/dev-docs/api/rest) or [GraphQL API](/dev-docs/api/graphql) endpoints as an authenticated user. diff --git a/docusaurus/docs/dev-docs/configurations/api.md b/docusaurus/docs/dev-docs/configurations/api.md index f1f575b416..16fef29d2d 100644 --- a/docusaurus/docs/dev-docs/configurations/api.md +++ b/docusaurus/docs/dev-docs/configurations/api.md @@ -8,12 +8,8 @@ tags: - REST API --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # API configuration - - General settings for API calls can be set in the `./config/api.js` file: | Property | Description | Type | Default | diff --git a/docusaurus/docs/dev-docs/configurations/cron.md b/docusaurus/docs/dev-docs/configurations/cron.md index 6a00d4ffe0..89bdf4aa83 100644 --- a/docusaurus/docs/dev-docs/configurations/cron.md +++ b/docusaurus/docs/dev-docs/configurations/cron.md @@ -8,12 +8,8 @@ tags: - cron job --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Cron jobs - - :::prerequisites The `cron.enabled` configuration option should be set to `true` in the `./config/server.js` (or `./config/server.ts` for TypeScript projects) [file](/dev-docs/configurations/server). ::: diff --git a/docusaurus/docs/dev-docs/configurations/environment.md b/docusaurus/docs/dev-docs/configurations/environment.md index 0f9446b452..87d39d47e0 100644 --- a/docusaurus/docs/dev-docs/configurations/environment.md +++ b/docusaurus/docs/dev-docs/configurations/environment.md @@ -8,12 +8,8 @@ tags: - environment --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Environment configuration and variables - - Strapi provides specific environment variable names. Defining them in an environment file (e.g., `.env`) will make these variables and their values available in your code. :::tip @@ -33,7 +29,7 @@ Strapi provides the following environment variables: | `NODE_ENV` | Type of environment where the application is running.

`production` enables specific behaviors (see [Node.js documentation](https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production) for details) | `String` | `'development'` | | `BROWSER` | Open the admin panel in the browser after startup | `Boolean` | `true` | | `ENV_PATH` | Path to the file that contains your environment variables | `String` | `'./.env'` | -| `STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE`

_Optional_ | Initialization locale for the application, if the [Internationalization (i18n) plugin](/dev-docs/i18n) is installed and enabled on Content-Types (see [Configuration of i18n in production environments](/dev-docs/i18n#configuration-of-the-default-locale)) | `String` | `'en'` | +| `STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE`

_Optional_ | Initialization locale for the application, if the [Internationalization (i18n) plugin](/user-docs/features/internationalization) is installed and enabled on Content-Types (see [Configuration of i18n in production environments](/user-docs/features/internationalization#configuration)) | `String` | `'en'` | | `STRAPI_ENFORCE_SOURCEMAPS` | Forces the bundler to emit source-maps, which is helpful for debugging errors in the admin app. | `boolean` | `false` | | `FAST_REFRESH` | _(Only applies to webpack)_
Use [react-refresh](https://github.com/pmmmwh/react-refresh-webpack-plugin) to enable "Fast Refresh" for near-instant feedback while developing the Strapi admin panel. | `boolean` | `true` | diff --git a/docusaurus/docs/dev-docs/configurations/functions.md b/docusaurus/docs/dev-docs/configurations/functions.md index 389b0745e0..75bdae11fa 100644 --- a/docusaurus/docs/dev-docs/configurations/functions.md +++ b/docusaurus/docs/dev-docs/configurations/functions.md @@ -167,7 +167,7 @@ It can be used to: - extend [content-types](/dev-docs/backend-customization/models) programmatically - load some [environment variables](/dev-docs/configurations/environment) - register a [custom field](/dev-docs/custom-fields) that would be used only by the current Strapi application, -- register a [custom provider for the Users & Permissions plugin](/dev-docs/plugins/users-permissions#creating-a-custom-provider). +- register a [custom provider for the Users & Permissions plugin](/dev-docs/configurations/users-and-permissions-providers/new-provider-guide). `register()` is the very first thing that happens when a Strapi application is starting. This happens _before_ any setup process and you don't have any access to database, routes, policies, or any other backend server elements within the `register()` function. diff --git a/docusaurus/docs/dev-docs/configurations/guides/access-cast-environment-variables.md b/docusaurus/docs/dev-docs/configurations/guides/access-cast-environment-variables.md index 1cefc94f9d..99b4376881 100644 --- a/docusaurus/docs/dev-docs/configurations/guides/access-cast-environment-variables.md +++ b/docusaurus/docs/dev-docs/configurations/guides/access-cast-environment-variables.md @@ -1,5 +1,5 @@ --- -title: Access and cast environment variables +title: Access and cast env variables description: Learn how to cast environment variables in Strapi 5 with the env() utility. displayed_sidebar: cmsSidebar tags: @@ -10,12 +10,8 @@ tags: - environment --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # How to access and cast environment variables - - In most use cases there will be different configurations between environments (e.g. database credentials). Instead of writing those credentials into configuration files, variables can be defined in a `.env` file at the root of the application: diff --git a/docusaurus/docs/dev-docs/configurations/guides/access-configuration-values.md b/docusaurus/docs/dev-docs/configurations/guides/access-configuration-values.md index fab9e214da..f237462968 100644 --- a/docusaurus/docs/dev-docs/configurations/guides/access-configuration-values.md +++ b/docusaurus/docs/dev-docs/configurations/guides/access-configuration-values.md @@ -1,5 +1,5 @@ --- -title: Access configuration values from the code +title: Access configuration values description: Learn how to access Strapi 5 configuration values from the code. displayed_sidebar: cmsSidebar tags: diff --git a/docusaurus/docs/dev-docs/configurations/guides/public-assets.md b/docusaurus/docs/dev-docs/configurations/guides/public-assets.md index f9aee8a585..36bc68acea 100644 --- a/docusaurus/docs/dev-docs/configurations/guides/public-assets.md +++ b/docusaurus/docs/dev-docs/configurations/guides/public-assets.md @@ -10,12 +10,8 @@ tags: - public assets --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # How to use public assets with Strapi - - Public assets are static files (e.g. images, video, CSS files, etc.) that you want to make accessible to the outside world. Because an API may need to serve static assets, every new Strapi project includes by default a folder named `/public`. Any file located in this directory is accessible if the request's path doesn't match any other defined route and if it matches a public file name (e.g. an image named `company-logo.png` in `./public/` is accessible through `/company-logo.png` URL). diff --git a/docusaurus/docs/dev-docs/configurations/guides/rbac.md b/docusaurus/docs/dev-docs/configurations/guides/rbac.md index 18513a8960..cc6d6493f5 100644 --- a/docusaurus/docs/dev-docs/configurations/guides/rbac.md +++ b/docusaurus/docs/dev-docs/configurations/guides/rbac.md @@ -13,12 +13,8 @@ tags: - Users, Roles & Permissions --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # How to create custom conditions for Role-Based Access Control (RBAC) - - Role-Based Access Control (RBAC) is an approach to restricting access to some users. In a Strapi application, users of the admin panel are administrators. Their roles and permissions are [configured in the admin panel](/user-docs/users-roles-permissions/configuring-administrator-roles). ## Declaring new conditions diff --git a/docusaurus/docs/dev-docs/configurations/guides/use-cron-jobs.md b/docusaurus/docs/dev-docs/configurations/guides/use-cron-jobs.md index 8c5749bd68..4826c0909a 100644 --- a/docusaurus/docs/dev-docs/configurations/guides/use-cron-jobs.md +++ b/docusaurus/docs/dev-docs/configurations/guides/use-cron-jobs.md @@ -1,5 +1,5 @@ --- -title: Use cron jobs in your code +title: Use cron jobs description: Learn how to use the strapi.cron object to list, add, or remove cron jobs from your code. tags: - configuration diff --git a/docusaurus/docs/dev-docs/configurations/middlewares.md b/docusaurus/docs/dev-docs/configurations/middlewares.md index e55f4bc868..ecb1c173a1 100644 --- a/docusaurus/docs/dev-docs/configurations/middlewares.md +++ b/docusaurus/docs/dev-docs/configurations/middlewares.md @@ -163,7 +163,7 @@ Strapi's core includes the following internal middlewares, mostly used for perfo ### `body` -The `body` middleware is based on [koa-body](https://github.com/koajs/koa-body). It accepts the following options: +The `body` middleware is based on [koa-body](https://github.com/koajs/koa-body). Tt uses the [`node-formidable`](https://github.com/felixge/node-formidable) library to process files. `body` accepts the following options: | Option | Description | Type | Default | |--------------|-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------|-------------| diff --git a/docusaurus/docs/dev-docs/configurations/plugins.md b/docusaurus/docs/dev-docs/configurations/plugins.md index efbf5249ec..059f6738b2 100644 --- a/docusaurus/docs/dev-docs/configurations/plugins.md +++ b/docusaurus/docs/dev-docs/configurations/plugins.md @@ -14,12 +14,8 @@ tags: --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Plugins configuration - - Plugin configurations are stored in `/config/plugins.js|ts` (see [project structure](/dev-docs/project-structure)). Each plugin can be configured with the following available parameters: | Parameter | Description | Type | @@ -162,79 +158,3 @@ export default () => ({ ## Upload configuration {#upload} - -The [Upload plugin](/dev-docs/plugins/upload) handles the [Media Library](/user-docs/media-library). When using the default upload provider, the following specific configuration options can be declared in an `upload.config` object within the `config/plugins` file. All parameters are optional: - -| Parameter | Description | Type | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- | ------- | -| `providerOptions.localServer` | Options that will be passed to [koa-static](https://github.com/koajs/static) upon which the Upload server is build.

(See [local server configuration](/dev-docs/plugins/upload#local-server) in Upload documentation for additional details) | Object | - | -| `sizeLimit` | Maximum file size in bytes.

(See [max file size configuration](/dev-docs/plugins/upload#max-file-size) in Upload plugin documentation for additional information) | Integer | `209715200`

(200 MB in bytes, i.e., 200 x 1024 x 1024 bytes) | -| `breakpoints` | Allows to override the breakpoints sizes at which responsive images are generated when the "Responsive friendly upload" option is set to `true`.

(See [responsive images configuration](/dev-docs/plugins/upload#responsive-images) in Upload plugin documentation for additional information) | Object | `{ large: 1000, medium: 750, small: 500 }` | - -:::note Notes -* Some configuration options can also be set directly from the Admin Panel (see [User Guide](/user-docs/settings/media-library-settings)). -* The Upload request timeout is defined in the server options, not in the Upload plugin options, as it's not specific to the Upload plugin but is applied to the whole Strapi server instance. See [upload request timeout configuration](/dev-docs/plugins/upload#upload-request-timeout) in the Upload documentation for additional details. -* When using a different upload provider, additional configuration options might be available. For Upload providers maintained by Strapi, see the [Amazon S3 provider](https://market.strapi.io/providers/@strapi-provider-upload-aws-s3) and [Cloudinary provider](https://market.strapi.io/providers/@strapi-provider-upload-cloudinary) documentations for additional information about available options. -::: - -**Example custom configuration**: - -The following is an example of a custom configuration for the Upload plugin when using the default upload provider: - - - - - -```js title="/config/plugins.js" - -module.exports = ({ env })=>({ - upload: { - config: { - providerOptions: { - localServer: { - maxage: 300000 - }, - }, - sizeLimit: 250 * 1024 * 1024, // 256mb in bytes - breakpoints: { - xlarge: 1920, - large: 1000, - medium: 750, - small: 500, - xsmall: 64 - }, - }, - }, -}); -``` - - - - - -```ts title="/config/plugins.ts" - -export default () => ({ - upload: { - config: { - providerOptions: { - localServer: { - maxage: 300000 - }, - }, - sizeLimit: 250 * 1024 * 1024, // 256mb in bytes - breakpoints: { - xlarge: 1920, - large: 1000, - medium: 750, - small: 500, - xsmall: 64 - }, - }, - }, -}) -``` - - - - diff --git a/docusaurus/docs/dev-docs/configurations/server.md b/docusaurus/docs/dev-docs/configurations/server.md index a9b774783c..b39783d7a8 100644 --- a/docusaurus/docs/dev-docs/configurations/server.md +++ b/docusaurus/docs/dev-docs/configurations/server.md @@ -12,12 +12,8 @@ tags: - port --- -import NotV5 from '/docs/snippets/\_not-updated-to-v5.md' - # Server configuration - - The `./config/server.js` file is used to define the server configuration for a Strapi application. :::caution diff --git a/docusaurus/docs/dev-docs/configurations/sso.md b/docusaurus/docs/dev-docs/configurations/sso.md index 2367322e01..e3afeeb636 100644 --- a/docusaurus/docs/dev-docs/configurations/sso.md +++ b/docusaurus/docs/dev-docs/configurations/sso.md @@ -17,8 +17,6 @@ import NotV5 from '/docs/snippets/_not-updated-to-v5.md' # Single Sign-On - - Single Sign-On on Strapi allows you to configure additional sign-in and sign-up methods for your administration panel. :::prerequisites diff --git a/docusaurus/docs/dev-docs/configurations/typescript.md b/docusaurus/docs/dev-docs/configurations/typescript.md index f00a3a3b28..d01d99e5fd 100644 --- a/docusaurus/docs/dev-docs/configurations/typescript.md +++ b/docusaurus/docs/dev-docs/configurations/typescript.md @@ -10,12 +10,8 @@ tags: - typescript --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # TypeScript configuration - - [TypeScript](/dev-docs/typescript)-enabled Strapi projects have a specific project structure and handle TypeScript project configuration through [`tsconfig.json` files](#project-structure-and-typescript-specific-configuration-files). Strapi also has dedicated TypeScript features that are configured [in the `config/typescript.js|ts` file](#strapi-specific-configuration-for-typescript). diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers.md new file mode 100644 index 0000000000..7fb1f25d44 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers.md @@ -0,0 +1,101 @@ +--- +title: Users & Permissions providers +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +# Users & Permissions providers + +Strapi comes with a predefined set of built-in providers for the [Users & Permissions feature](/user-docs/features/users-permissions). Custom providers can also be configured (see the [dedicated guide](/dev-docs/configurations/users-and-permissions-providers/new-provider-guide)). + +## Understanding the login flow + +[Grant](https://github.com/simov/grant) and [Purest](https://github.com/simov/purest) allow you to use OAuth and OAuth2 providers to enable authentication in your application. + +For a better understanding, review the following description of the login flow. The example uses `github` as the provider but it works the same for other providers. + +Let's say that: +* Strapi's backend is located at: `strapi.website.com`, and +* Your app frontend is located at: `website.com` + +1. The user goes on your frontend app (`https://website.com`) and clicks on your button `connect with Github`. +2. The frontend redirects the tab to the backend URL: `https://strapi.website.com/api/connect/github`. +3. The backend redirects the tab to the GitHub login page where the user logs in. +4. Once done, Github redirects the tab to the backend URL:`https://strapi.website.com/api/connect/github/callback?code=abcdef`. +5. The backend uses the given `code` to get an `access_token` from Github that can be used for a period of time to make authorized requests to Github to get the user info. +6. Then, the backend redirects the tab to the url of your choice with the param `access_token` (example: `http://website.com/connect/github/redirect?access_token=eyfvg`). +7. The frontend (`http://website.com/connect/github/redirect`) calls the backend with `https://strapi.website.com/api/auth/github/callback?access_token=eyfvg` that returns the Strapi user profile with its `jwt`.
(Under the hood, the backend asks Github for the user's profile and a match is done on Github user's email address and Strapi user's email address). +8. The frontend now possesses the user's `jwt`, which means the user is connected and the frontend can make authenticated requests to the backend! + +An example of a frontend app that handles this flow can be found here: [react login example application](https://github.com/strapi/strapi-examples/tree/master/examples/login-react). + +## Setting up the server URL + +Before setting up a provider you must specify the absolute URL of your backend in `/config/server`: + + + + + +```js title="/config/server.js" +module.exports = ({ env }) => ({ + host: env('HOST', '0.0.0.0'), + port: env.int('PORT', 1337), + url: env('', 'http://localhost:1337'), +}); +``` + + + + + +```ts title="/config/server.ts" +export default ({ env }) => ({ + host: env('HOST', '0.0.0.0'), + port: env.int('PORT', 1337), + url: env('', 'http://localhost:1337'), +}); +``` + + + + + +:::tip +Later you will give this URL to your provider.
For development, some providers accept the use of localhost urls but many don't. In this case we recommend to use [ngrok](https://ngrok.com/docs) (`ngrok http 1337`) that will make a proxy tunnel from a url it created to your localhost url (e.g., `url: env('', 'https://5299e8514242.ngrok.io'),`). +::: + +## Setting up the provider - Examples + +Instead of a generic explanation we decided to show an example for each provider. You can also [create your own custom provider](/dev-docs/configurations/users-and-permissions-providers/new-provider-guide). + +In the following examples, the frontend application will be the [react login example application](https://github.com/strapi/strapi-examples/tree/master/examples/login-react) running on `http://localhost:3000`, while Strapi (i.e., the backend server) will be running on `http://localhost:1337`. + + + + + + + + + + + + + + + + + + + +If you want to create and add a new custom provider, please refer to the following guide: + + + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/auth-zero.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/auth-zero.md new file mode 100644 index 0000000000..2056255bf8 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/auth-zero.md @@ -0,0 +1,53 @@ +--- +title: Auth0 provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Auth0 provider setup for Users & Permissions + +The present page explains how to setup the Auth0 provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Auth0 configuration + +:::note +AWS Cognito accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit your Auth0 tenant dashboard +2. In API section, create a new API +3. In application, create a `machine-to-machine` application and select the API that you have just created +4. In settings of this app set these values: + - **Allowed Callback URLs**: `http://localhost:1337/api/connect/auth0/callback` + - **Allowed Logout URLs**: `http://localhost:3000` + - **Allowed Web Origins**: `http://localhost:3000` +5. At the bottom of settings, show "Advanced Settings" and go to the "Grant Types". Ensure that these grants are checked/enabled: + - Implicit + - Authorization Code + - Refresh Token + - Client Credentials + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Auth0** provider +3. Fill the information: + - Enable: `ON` + - Client ID: `` + - Client Secret: `` + - Subdomain: ``, example it is the part in bold in the following url: https://**my-tenant.eu**.auth0.com/ + - The redirect URL to your front-end app: `http://localhost:3000/connect/auth0` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/aws-cognito.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/aws-cognito.md new file mode 100644 index 0000000000..3733171d6d --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/aws-cognito.md @@ -0,0 +1,54 @@ +--- +title: AWS Cognito provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# AWS Cognito provider setup for Users & Permissions + +The present page explains how to setup the AWS Cognito provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## AWS Cognito configuration + +:::note +AWS Cognito accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the AWS Management Console
[https://aws.amazon.com/console/](https://aws.amazon.com/console/) +2. If needed, select your **Region** in the top right corner next to the Support dropdown +3. Select the **Services** dropdown in the top left corner +4. Click on **Cognito** in the `Security, Identity & Compliance` section +5. Then click on the **Manage User Pools** button +6. If applicable either create or use an existing user pool. You will find hereafter a tutorial to create a User Pool
[https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html](https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html) +7. Go to the **App clients** section in your cognito user pool and create a new client with the name `Strapi Auth` and set all the parameters and then click on **Create app client** +8. You should now have an **App client id** and by clicking on the button **Show Details** you will be able to see the **App client secret**. Do copy those two values **App client id** and **App client secret** somewhere for later use when configuring the AWS Cognito provider in Strapi. +9. Go to the **App integration section** and click on **App client settings** +10. Look for your app client named `Strapi Auth` and enable Cognito User Pool by checking it in the **Enabled Identity Providers** section of your newly created App client +11. Fill in your callback URL and Sign out URL with the value `http://localhost:1337/api/connect/cognito/callback` or the one provided by your AWS Cognito provider in Strapi +12. In the **Oauth 2.0** section select `Authorization code grant` and `Implicit grant` for the **Allowed OAuth Flows** and select `email`, `openid` and `profile` for the **Allowed OAuth Scopes** +13. You can now click on **Save changes** and if you have already configured your domain name then you should be able to see a link to the **Launch Hosted UI**. You can click on it in order to display the AWS Cognito login page. In case you haven't yet configured your domain name, use the link **Choose domain name** at the bottom right of the page in order to configure your domain name. On that page you will have an `Amazon Cognito Domain` section where a `Domain prefix` is already setup. Type a domain prefix to use for the sign-up and sign-in pages that are hosted by Amazon Cognito, this domain prefix together with the `.auth.YOUR_REGION.amazoncognito.com` will be the **Host URI (Subdomain)** value for your strapi configuration later on. + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Cognito** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: fill in the **App client id** (`5bd7a786qdupjmi0b3s10vegdt`) + - **Client Secret**: fill in the **App client secret** (`19c5c78dsfsdfssfsdfhpdb4nkpb145vesdfdsfsffgh7vwd6g45jlipbpb`) + - **Host URI (Subdomain)**: fill in the URL value that you copied earlier (`myapp67b50345-67b50b17-local.auth.eu-central-1.amazoncognito.com`) + - **The redirect URL to your front-end app**: if you are using strapi react-login [https://github.com/strapi/strapi-examples/tree/master/examples/login-react/](https://github.com/strapi/strapi-examples/tree/master/examples/login-react/) use `http://localhost:3000/connect/cognito/redirect` but if you do not yet have a front-end app to test your Cognito configuration you can then use the following URL `http://localhost:1337/api/auth/cognito/callback` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/cas.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/cas.md new file mode 100644 index 0000000000..0b3e4000b6 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/cas.md @@ -0,0 +1,76 @@ +--- +title: CAS provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# CAS provider setup for Users & Permissions + +The present page explains how to setup the Auth0 provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## CAS configuration + +:::note +A remote CAS server can be configured to accept `localhost` URLs or you can run your own CAS server locally that accepts them. + +The use of `ngrok` is not needed. +::: + +- [CAS](https://github.com/apereo/cas) is an SSO server that supports many different methods of verifying a users identity, + retrieving attributes out the user and communicating that information to applications via protocols such as SAML, OIDC, and the CAS protocol. Strapi can use a CAS server for authentication if CAS is deployed with support for OIDC. +- [CAS](https://github.com/apereo/cas) could already be used by your company or organization or you can setup a local CAS server by cloning the [CAS Overlay](https://github.com/apereo/cas-overlay-template) project or using the newer [CAS Initializr](https://github.com/apereo/cas-initializr) to create an overlay project. +- The CAS server must be configured so it can act as an [OpenID Connect Provider](https://apereo.github.io/cas/6.6.x/installation/OIDC-Authentication.html) +- CAS version 6.3.x and higher is known to work with Strapi but older versions that support OIDC may work. +- Define a CAS OIDC service for Strapi and store it in whichever CAS service registry is being used. +- The CAS service definition might look something like this for a local strapi deployment: + +```json +{ + "@class": "org.apereo.cas.services.OidcRegisteredService", + "clientId": "thestrapiclientid", + "clientSecret": "thestrapiclientsecret", + "bypassApprovalPrompt": true, + "serviceId": "^http(|s)://localhost:1337/.*", + "name": "Local Strapi", + "id": 20201103, + "evaluationOrder": 50, + "attributeReleasePolicy": { + "@class": "org.apereo.cas.services.ReturnMappedAttributeReleasePolicy", + "allowedAttributes": { + "@class": "java.util.TreeMap", + "strapiemail": "groovy { return attributes['mail'].get(0) }", + "strapiusername": "groovy { return attributes['username'].get(0) }" + } + } +} +``` + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers) +2. Click on the **CAS** provider +3. Fill the information: + - **Enable**: `ON` + - **Client ID**: thestrapiclientid + - **Client Secret**: thestrapiclientsecret + - **The redirect URL to your front-end app**: `http://localhost:1337/api/connect/cas/redirect` + - **The Provider Subdomain such that the following URLs are correct for the CAS deployment you are targeting:** + ``` + authorize_url: https://[subdomain]/oidc/authorize + access_url: https://[subdomain]/oidc/token + profile_url: https://[subdomain]/oidc/profile + ``` + For example, if running CAS locally with a login URL of: `https://localhost:8443/cas/login`, the value for the provider subdomain would be `localhost:8443/cas`. + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/discord.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/discord.md new file mode 100644 index 0000000000..6df92f23b6 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/discord.md @@ -0,0 +1,48 @@ +--- +title: Discord provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Discord provider setup for Users & Permissions + +The present page explains how to setup the Discord provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Discord configuration + +:::note +Discord accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Apps list page on the developer portal at [https://discordapp.com/developers/applications/](https://discordapp.com/developers/applications/) +2. Click on **New application** button +3. Fill the **name** and create +4. Click on **OAuth2** in the left menu +5. And click on **Add redirect** button +6. Fill the **Redirect** input with `http://localhost:1337/api/connect/discord/callback` URL and save +7. Click on **General information** in the left menu +8. You should see your Application ID and secret, save them for later + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Discord** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: 665118465148846081 + - **Client Secret**: iJbr7mkyqyut-J2hGvvSDch_5Dw5U77J + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/discord/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/facebook.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/facebook.md new file mode 100644 index 0000000000..9012eea923 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/facebook.md @@ -0,0 +1,54 @@ +--- +title: Facebook provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Facebook provider setup for Users & Permissions + +The present page explains how to setup the Facebook provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Facebook configuration + +Facebook doesn't accept `localhost` urls.
+Use [ngrok](https://ngrok.com/docs) to serve the backend app (`ngrok http 1337`) that will make a proxy tunnel from a url it created to your localhost url (e.g., `url: env('', 'https://5299e8514242.ngrok.io'),`). + +``` +ngrok http 1337 +``` + +Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. + +1. Visit the Developer Apps list page at [https://developers.facebook.com/apps/](https://developers.facebook.com/apps/) +2. Click on **Add a New App** button +3. Fill the **Display Name** in the modal and create the app +4. Setup a **Facebook Login** product +5. Click on the **PRODUCTS > Facebook login > Settings** link in the left menu +6. Fill the information and save (replace with your own ngrok url): + - **Valid OAuth Redirect URIs**: `https://65e60559.ngrok.io/api/connect/facebook/callback` +7. Then, click on **Settings** in the left menu +8. Then on **Basic** link +9. You should see your Application ID and secret, save them for later + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Facebook** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: 2408954435875229 + - **Client Secret**: 4fe04b740b69f31ea410b9391ff3b5b0 + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/facebook/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/github.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/github.md new file mode 100644 index 0000000000..2d5a858617 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/github.md @@ -0,0 +1,51 @@ +--- +title: GitHub provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# GitHub provider setup for Users & Permissions + +The present page explains how to setup the GitHub provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## GitHub configuration + +:::note +Github doesn't accept `localhost` urls.
+Use `ngrok` to serve the backend app. +``` +ngrok http 1337 +``` +Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. +::: + +1. Visit the OAuth Apps list page [https://github.com/settings/developers](https://github.com/settings/developers) +2. Click on **New OAuth App** button +3. Fill the information (replace with your own ngrok url): + - **Application name**: Strapi GitHub auth + - **Homepage URL**: `https://65e60559.ngrok.io` + - **Application description**: Strapi provider auth description + - **Authorization callback URL**: `https://65e60559.ngrok.io/api/connect/github/callback` + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **GitHub** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: 53de5258f8472c140917 + - **Client Secret**: fb9d0fe1d345d9ac7f83d7a1e646b37c554dae8b + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/github/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/google.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/google.md new file mode 100644 index 0000000000..ec1110c01e --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/google.md @@ -0,0 +1,60 @@ +--- +title: Google provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Google provider setup for Users & Permissions + +The present page explains how to setup the Google provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Google configuration + +:::note +Google accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Google Developer Console at [https://console.developers.google.com/](https://console.developers.google.com/) +2. Click on the **Select a project** dropdown in the top menu +3. Then click **NEW PROJECT** button +4. Fill the **Project name** input and create + +Wait a few seconds while the application is created. + +5. On the project dropdown, select your new project +6. Click on **Go to APIs overview** under the **APIs** card +7. Then click on the **Credentials** link in the left menu +8. Click on **OAuth consent screen** button +9. Choose **External** and click on **create** +10. Fill the **Application name** and save +11. Then click on **Create credentials** button +12. Choose **OAuth client ID** option +13. Fill the information: + - **Name**: `Strapi Auth` + - **Authorized redirect URIs**: `http://localhost:1337/api/connect/google/callback` +14. Click on **OAuth 2.0 Client IDs** name of the client you just created +15. You should see your Application ID and secret, save them for later + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Google** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: 226437944084-o2mojv5i4lfnng9q8kq3jkf5v03avemk.apps.googleusercontent.com + - **Client Secret**: aiTbMoiuJQflSBy6uQrfgsni + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/google/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/instagram.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/instagram.md new file mode 100644 index 0000000000..ca4ed8d5d5 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/instagram.md @@ -0,0 +1,56 @@ +--- +title: Instagram provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Instagram provider setup for Users & Permissions + +The present page explains how to setup the Instagram provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Instagram configuration + +:::note +Facebook doesn't accept `localhost` urls.
+Use `ngrok` to serve the backend app. +``` +ngrok http 1337 +``` +Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/login-react)) with the generated ngrok url. +::: + +1. Visit the Developer Apps list page at [https://developers.facebook.com/apps/](https://developers.facebook.com/apps/) +2. Click on **Add a New App** button +3. Fill the **Display Name** in the modal and create the app +4. Setup an **Instagram** product +5. Click on the **PRODUCTS > Instagram > Basic Display** link in the left menu +6. Then click on the **Create new application** button (and valid the modal) +7. Fill the information (replace with your own ngrok url): + - **Valid OAuth Redirect URIs**: `https://65e60559.ngrok.io/api/connect/instagram/callback` + - **Deauthorize**: `https://65e60559.ngrok.io` + - **Data Deletion Requests**: `https://65e60559.ngrok.io` +8. On the **App Review for Instagram Basic Display** click on **Add to submission** for **instagram_graph_user_profile**. +9. You should see your Application ID and secret, save them for later + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Instagram** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: 563883201184965 + - **Client Secret**: f5ba10a7dd78c2410ab6b8a35ab28226 + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/instagram/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/keycloak.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/keycloak.md new file mode 100644 index 0000000000..600f199ff0 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/keycloak.md @@ -0,0 +1,51 @@ +--- +title: Keycloak provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Keycloak provider setup for Users & Permissions + +The present page explains how to setup the Keycloak provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Keycloak configuration + +:::note +Keycloak accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit your Keycloak admin dashboard +2. If you don't already have a realm, you'll want to create one +3. In the Clients section of your realm, create a new client +4. Under the capability config, ensure you set `Client Authentication` to on to ensure you can create a private key +5. Under the access settings, ensure you set the following values: + - **Valid redirect URIs**: `http://localhost:1337/api/connect/keycloak/callback` and `http://localhost:1337/api/connect/keycloak` + - **Allowed Web Origins**: `http://localhost:3000` and `http://localhost:1337` +6. In the Client Scopes section, ensure you have the `email` and `profile` scopes set to default +7. In the Client Scopes section, ensure you have the `openid` scope set to default, if you don't have this you will need to manually create it in the global Client Scopes + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Keycloak** provider +3. Fill the information: + - Enable: `ON` + - Client ID: `` + - Client Secret: `` + - Subdomain: ``, example is either `keycloak.example.com/realms/strapitest` or `keycloak.example.com/auth/realms/strapitest` **without the protocol before it** + - The redirect URL to your front-end app: `http://localhost:3000/connect/keycloak/redirect` + - (Optional) Set the JWKS URL if you have a custom JWKS URL, example is like `https://keycloak.example.com/auth/realms/strapitest/protocol/openid-connect/certs` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/linkedin.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/linkedin.md new file mode 100644 index 0000000000..0fd749f638 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/linkedin.md @@ -0,0 +1,52 @@ +--- +title: LinkedIn provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# LinkedIn provider setup for Users & Permissions + +The present page explains how to setup the LinkedIn provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## LinkedIn configuration + +:::note +LinkedIn accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Apps list page at [https://www.linkedin.com/developers/apps](https://www.linkedin.com/developers/apps) +2. Click on **Create app** button +3. Fill the information: + - **App name**: Strapi auth + - **LinkedIn Page**: Enter a LinkedIn page name to associate with the app or click **Create a new LinkedIn Page** to create a new one + - **App Logo**: Upload a square image that is at least 100x100 pixels. +4. Click on the **Create app** to create the app +5. On the app page click on **Auth** tab +6. Fill the information: + - **Authorized redirect URL**: `http://localhost:1337/api/connect/linkedin/callback` +7. On the app page click on **Products** tab. +8. Select `Sign In with LinkedIn` from the product list to enable it. + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **LinkedIn** provider +3. Fill the information: + - **Enable**: `ON` + - **Client ID**: 84witsxk641rlv + - **Client Secret**: HdXO7a7mkrU5a6WN + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/linkedin/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/new-provider-guide.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/new-provider-guide.md new file mode 100644 index 0000000000..8682c97794 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/new-provider-guide.md @@ -0,0 +1,326 @@ +--- +title: Creating and adding a custom Users & Permissions provider +description: todo +displayed_sidebar: cmsSidebar +tags: +- users & permissions +- providers +- configuration +- customization +--- + +# Creating and adding a custom Users & Permissions provider + +Strapi provides a list of [built-in providers](/dev-docs/configurations/users-and-permissions-providers#setting-up-the-provider---examples) for the [Users & Permissions feature](/user-docs/features/users-permissions). You can also create your own provider following this guide. + +:::prerequisites +You have read the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers) and understood the login flow. +::: + +## Creating a custom provider + +You can use [the `register` lifecycle function](/dev-docs/configurations/functions#register) to create your own custom provider in the `src/index.js|ts` file of your Strapi application. Use the following code example adjusted to your needs: + +```js title="/src/index.js" +module.exports = { + register({ strapi }) { + strapi + .plugin("users-permissions") + .service("providers-registry") + .add("example-provider-name", { + icon: "", + enabled: true, + grantConfig: { + key: "", + secret: "", + callback: `${strapi.config.server.url}/auth/example-provider-name/callback`, + scope: ["email"], + authorize_url: "https://awesome.com/authorize", + access_url: "https://awesome.com/token", + oauth: 2, + }, + async authCallback({ accessToken, providers, purest }) { + // use whatever you want here to get the user info + return { + username: "test", + email: "test", + }; + }, + }); + }, +}; +``` + +For additional information on parameters passed to `grantConfig`, please refer to the [`grant` documentation](https://github.com/simov/grant). For additional information about `purest` please refer to [`purest` documentation](https://github.com/simov/purest). + +### Frontend setup + +Once you have configured Strapi and the provider, in your frontend application you must: + +- Create a button that links to `GET STRAPI_BACKEND_URL/api/connect/${provider}` (e.g., `https://strapi.mywebsite/api/connect/github`). +- Create a frontend route like `FRONTEND_URL/connect/${provider}/redirect` that have to handle the `access_token` param and that have to request `STRAPI_BACKEND_URL/api/auth/${provider}/callback` with the `access_token` parameter.
+ The JSON request response will be `{ "jwt": "...", "user": {...} }`. + +Now you can make authenticated requests, as described in [token usage](/user-docs/features/users-permissions#token-usage). + +:::caution Troubleshooting + +- **Error 429**: It's most likely because your login flow fell into a loop. To make new requests to the backend, you need to wait a few minutes or restart the backend. +- **Grant: missing session or misconfigured provider**: It may be due to many things. + - **The redirect url can't be built**: Make sure you have set the backend url in `config/server.js`: [Setting up the server url](/dev-docs/configurations/users-and-permissions-providers#setting-up-the-server-url) + - **A session/cookie/cache problem**: You can try again in a private tab. + - **The incorrect use of a domain with ngrok**: Check your urls and make sure that you use the ngrok url instead of `http://localhost:1337`. Don't forget to check the backend url set in the example app at `src/config.js`. +- **You can't access your admin panel**: It's most likely because you built it with the backend url set with a ngrok url and you stopped/restarted ngrok. You need to replace the backend url with the new ngrok url and run `yarn build` or `npm run build` again. +::: + +### Reset password + +**Can only be used for users registered using the email provider.** + + + + + +The assumed general flow: + +1. The user goes to your **forgotten password page**. +2. The user enters their email address. +3. Your forgotten password page sends a request to the backend to send an email with the reset password link to the user. +4. The user receives the email and clicks on the special link. +5. The link redirects the user to your **reset password page**. +6. The user enters their new password. +7. The **reset password page** sends a request to the backend with the new password. +8. If the request contains the code contained in the link at step 3, the password is updated. +9. The user can log in with the new password. + +The following section details steps 3 and 7. + +#### Forgotten password: ask for the reset password link + +This action sends an email to a user with the link to your reset password page. The link will be enriched with the url param `code` that is needed for the [reset password](#reset-password) at step 7. + +First, you must specify the following: + +- In the admin panel: _Settings > USERS & PERMISSIONS PLUGIN > Advanced Settings > Reset Password_ page, the `url` to your reset password page. +- In the admin panel: _Settings > USERS & PERMISSIONS PLUGIN > Email Template_ page, the _Shipper email_. + +Then, your **forgotten password page** has to make the following request to your backend: + +```js +import axios from 'axios'; + +// Request API. +axios + .post('http://localhost:1337/api/auth/forgot-password', { + email: 'user@strapi.io', // user's email + }) + .then(response => { + console.log('Your user received an email'); + }) + .catch(error => { + console.log('An error occurred:', error.response); + }); +``` + +#### Reset Password: Send the new password + +This action will update the user password. +This also works with the [GraphQL Plugin](/dev-docs/plugins/graphql), with the `resetPassword` mutation. + +Your **reset password page** has to make the following request to your backend: + +```js +import axios from 'axios'; + +// Request API. +axios + .post('http://localhost:1337/api/auth/reset-password', { + code: 'privateCode', // code contained in the reset link of step 3. + password: 'userNewPassword', + passwordConfirmation: 'userNewPassword', + }) + .then(response => { + console.log("Your user's password has been reset."); + }) + .catch(error => { + console.log('An error occurred:', error.response); + }); +``` + + + + + +You can also update an authenticated user password through the `/change-password` API endpoint: + +```js +import axios from 'axios'; + +// Request API. +axios.post( + 'http://localhost:1337/api/auth/change-password', + { + currentPassword: 'currentPassword', + password: 'userNewPassword', + passwordConfirmation: 'userNewPassword', + }, + { + headers: { + Authorization: 'Bearer ', + }, + } +); +``` + + + + + +### Email validation + +:::note +In production, make sure the `url` config property is set. Otherwise the validation link will redirect to `localhost`. More info on the config [here](/dev-docs/configurations/server). +::: + +After registering, if you have set **Enable email confirmation** to **ON**, the user will receive a confirmation link by email. The user has to click on it to validate their registration. + +Example of the confirmation link: `https://yourwebsite.com/api/auth/email-confirmation?confirmation=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaWF0IjoxNTk0OTgxMTE3LCJleHAiOjE1OTc1NzMxMTd9.0WeB-mvuguMyr4eY8CypTZDkunR--vZYzZH6h6sChFg` + +If needed you can re-send the confirmation email by making the following request: + +```js +import axios from 'axios'; + +// Request API. +axios + .post(`http://localhost:1337/api/auth/send-email-confirmation`, { + email: 'user@strapi.io', // user's email + }) + .then(response => { + console.log('Your user received an email'); + }) + .catch(error => { + console.error('An error occurred:', error.response); + }); +``` + +## Adding a new provider to your Strapi application + +:::info +This documentation might not up-to-date with Strapi 5 and is a work in progress. In the meantime, [contributions](https://github.com/strapi/documentation/blob/main/CONTRIBUTING.md) are most welcome. +::: + +**[Grant](https://github.com/simov/grant) supplies configuration for a number of commonly used OAuth providers. [Custom](https://github.com/simov/grant#misc-custom-providers) providers are also supported**.
You can view and try out the 200+ supported providers here: [OAuth Playground](https://grant.outofindex.com/). + +### Prepare your files + +To add a new provider on Strapi, you will need to perform changes to the following files: + +``` +extensions/users-permissions/services/Providers.js +extensions/users-permissions/config/functions/bootstrap.js +``` + +If these files don't exist you will need to copy from your `node_modules` or the Strapi mono-repo. You can see [plugin extensions](/dev-docs/plugins-extension) for more information on how it works. + +We will go step by step. + +### Configure your Provider Request + +Configure the new provider in the `Provider.js` file at the `getProfile` function. + +The `getProfile` takes three params: + +- **provider**: The name of the used provider as a string. +- **query**: The query is the result of the provider callback. +- **callback**: The callback function who will continue the internal Strapi login logic. + +Here is an example that uses the `discord` provider. + +### Configure your oauth generic information + +```js +case 'discord': { + const discord = new Purest({ + provider: 'discord', + config: { + 'discord': { + 'https://discordapp.com/api/': { + '__domain': { + 'auth': { + 'auth': {'bearer': '[0]'} + } + }, + '{endpoint}': { + '__path': { + 'alias': '__default' + } + } + } + } + } + }); +} +``` + +This code creates a `Purest` object that gives us a generic way to interact with the provider's REST API. + +For more specs on using the `Purest` module, please refer to the [Official Purest Documentation](https://github.com/simov/purest) + +You may also want to take a look onto the numerous already made configurations [here](https://github.com/simov/purest-providers/blob/master/config/providers.json). + +### Retrieve your user's information + +For our Discord provider it will look like the following: + +```js + discord.query().get('users/@me').auth(access_token).request((err, res, body) => { + if (err) { + callback(err); + } else { + // Combine username and discriminator because discord username is not unique + const username = `${body.username}#${body.discriminator}`; + callback(null, { + username, + email: body.email + }); + } + }); + break; +} +``` + +Here is the next part of our switch. Now that we have properly configured our provider, we want to use it to retrieve +user information. + +Here you see the real power of `purest`, you can simply make a get request on the desired URL, using the `access_token` +from the `query` parameter to authenticate. + +That way, you should be able to retrieve the user info you need. + +Now, you can simply call the `callback` function with the username and email of your user. That way, Strapi will be able +to retrieve your user from the database and log you in. + +### Configure the new provider model onto database + +Now, we need to configure our 'model' for our new provider. That way, our settings can be stored in the database, and +managed from the admin panel. + +Open the file `packages/strapi-plugin-users-permissions/config/functions/bootstrap.js` + +Add the fields your provider needs into the `grantConfig` object. +For our discord provider it will look like: + +```js +discord: { + enabled: false, // make this provider disabled by default + icon: 'comments', // The icon to use on the UI + key: '', // our provider app id (leave it blank, you will fill it with the Content Manager) + secret: '', // our provider secret key (leave it blank, you will fill it with the Content Manager) + callback: '/auth/discord/callback', // the callback endpoint of our provider + scope: [ // the scope that we need from our user to retrieve information + 'identify', + 'email' + ] +}, +``` diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/patreon.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/patreon.md new file mode 100644 index 0000000000..f9818cbd00 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/patreon.md @@ -0,0 +1,55 @@ +--- +title: Patreon provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Patreon provider setup for Users & Permissions + +The present page explains how to setup the Patreon provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Patreon configuration + +:::note +Patreon does not accept `localhost` urls.
+Use `ngrok` to serve the backend app. +```bash +ngrok http 1337 +``` +Don't forget to update the server url in the Strapi config file `./config/server.js` and the server URL in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok URL. +::: + +1. You must be a Patreon Creator in order to register an Oauth client. +2. Go to the [Patreon developer portal](https://www.patreon.com/portal) +3. Click on [Clients & API Keys](https://www.patreon.com/portal/registration/register-clients) +4. Click on "Create Client" +5. Enter the details of your organization and website. +6. There is a drop-down for "App Category" but no explanation of what the different categories mean. +"Community" seems to work fine. +7. You can choose either version 1 or version 2 of the API - neither are actively developed. +Version 2 is probably the best choice. See their +[developer docs](https://docs.patreon.com/#introduction) for more detail. +8. Under "Redirect URI's" enter `https://your-site.com/api/connect/patreon/callback` +9. Save the client details and you will then see the Client ID and Client Secret. + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Patreon** provider +3. Fill the information: + - Enable: `ON` + - Client ID: `` - as above + - Client Secret: `` - as above + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/reddit.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/reddit.md new file mode 100644 index 0000000000..030ba63bb2 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/reddit.md @@ -0,0 +1,46 @@ +--- +title: Reddit provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Reddit provider setup for Users & Permissions + +The present page explains how to setup the Reddit provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Reddit configuration + +:::note +Reddit accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Reddit authorized applications preferences page at [https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps) +2. Click on the **create another app...** button near the bottom +3. Select **web app** for the type +4. Fill the **name** and **redirect uri** input in +5. Click the **create app** button +6. Note that the **Client ID** is located under the app type (web app) + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Reddit** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: hmxSBOit0SCjSQ + - **Client Secret**: gwR9hCjK_PMYVYNGeDLS4WLB8g7xqg + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/reddit/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitch.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitch.md new file mode 100644 index 0000000000..e12023b075 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitch.md @@ -0,0 +1,49 @@ +--- +title: Twitch provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Twitch provider setup for Users & Permissions + +The present page explains how to setup the Twitch provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Twitch configuration + +:::note +Twitch accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Apps list page on the developer console at [https://dev.twitch.tv/console/apps](https://dev.twitch.tv/console/apps) +2. Click on **Register Your Application** button +3. Fill the information: + - **Name**: Strapi auth + - **OAuth Redirect URLs**: `http://localhost:1337/api/connect/twitch/callback` + - **Category**: Choose a category +4. Click on **Manage** button of your new app +5. Generate a new **Client Secret** with the **New Secret** button +6. You should see your Application ID and secret, save them for later + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Twitch** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **Client ID**: amuy279g8wt68qlht3u4gek4oykh5j + - **Client Secret**: dapssh10uo97gg2l25qufr8wen3yr6 + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/twitch/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitter.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitter.md new file mode 100644 index 0000000000..4fe64b22d1 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/twitter.md @@ -0,0 +1,58 @@ +--- +title: Twitter provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# Twitter provider setup for Users & Permissions + +The present page explains how to setup the Twitter provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## Twitter configuration + +:::note +Twitter doesn't accept `localhost` urls.
+Use `ngrok` to serve the backend app. +``` +ngrok http 1337 +``` +Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. +::: + +1. Visit the Apps list page at [https://developer.twitter.com/en/apps](https://developer.twitter.com/en/apps) +2. Click on **Create an app** button +3. Fill the information (replace with your own ngrok url): + - **App name**: Strapi Twitter auth + - **Application description**: This is a demo app for Strapi auth + - **Tell us how this app will be used**: - here write a message enough long - +4. At the end of the process you should see your Application ID and secret, save them for later +5. Go to you app setting and click on edit **Authentication settings** +6. Enable **3rd party authentication** AND **Request email address from users** +7. Fill the information (replace with your own ngrok url): + - **Callback URLs**: `https://65e60559.ngrok.io/api/connect/twitter/callback` + - **Website URL**: `https://65e60559.ngrok.io` + - **Privacy policy**: `https://d73e70e88872.ngrok.io` + - **Terms of service**: `https://d73e70e88872.ngrok.io` + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **Twitter** provider +3. Fill the information (replace with your own client ID and secret): + - **Enable**: `ON` + - **API Key**: yfN4ycGGmKXiS1njtIYxuN5IH + - **Api Secret**: Nag1en8S4VwqurBvlW5OaFyKlzqrXFeyWhph6CZlpGA2V3VR3T + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/twitter/redirect` + + diff --git a/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/vk.md b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/vk.md new file mode 100644 index 0000000000..781278eb62 --- /dev/null +++ b/docusaurus/docs/dev-docs/configurations/users-and-permissions-providers/vk.md @@ -0,0 +1,51 @@ +--- +title: VK provider setup for Users & Permissions +# description: todo +displayed_sidebar: cmsSidebar +tags: +- users and permissions +- providers +- configuration +- customization +--- + +import ConfigDone from '/docs/snippets/u-and-p-provider-config-done.md' + +# VK provider setup for Users & Permissions + +The present page explains how to setup the VK provider for the [Users & Permissions feature](/user-docs/features/users-permissions). + +:::prerequisites +You have the [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers). +::: + +## VK configuration + +:::note +VK accepts the `localhost` urls.
+The use of `ngrok` is not needed. +::: + +1. Visit the Apps list page at [https://vk.com/apps?act=manage](https://vk.com/apps?act=manage) +2. Click on **Create app** button +3. Fill the information: + - **Title**: Strapi auth + - **Platform**: Choose **Website** option + - **Website address**: `http://localhost:1337` + - **Base domain**: `localhost` +4. Click on the **Settings** link in the left menu +5. Click on the **Open API** link to enable this option +6. Fill the information: + - **Authorized redirect URL**: `http://localhost:1337/api/connect/vk/callback` + +## Strapi configuration + +1. Visit the User & Permissions provider settings page at [http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) +2. Click on the **VK** provider +3. Fill the information: + - **Enable**: `ON` + - **Client ID**: 7276416 + - **Client Secret**: cFBUSghLXGuxqnCyw1N3 + - **The redirect URL to your front-end app**: `http://localhost:3000/connect/vk/redirect` + + diff --git a/docusaurus/docs/dev-docs/custom-fields.md b/docusaurus/docs/dev-docs/custom-fields.md index 6bda888595..48e63fe5d8 100644 --- a/docusaurus/docs/dev-docs/custom-fields.md +++ b/docusaurus/docs/dev-docs/custom-fields.md @@ -13,12 +13,9 @@ tags: --- import CustomFieldRequiresPlugin from '/docs/snippets/custom-field-requires-plugin.md' -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' # Custom fields - - Custom fields extend Strapi’s capabilities by adding new types of fields to content-types and components. Once created or added to Strapi via plugins, custom fields can be used in the Content-Type Builder and Content Manager just like built-in fields. The present documentation is intended for custom field creators: it describes which APIs and functions developers must use to create a new custom field. The [User Guide](/user-docs/plugins/introduction-to-plugins.md#custom-fields) describes how to add and use custom fields from Strapi's admin panel. diff --git a/docusaurus/docs/dev-docs/customization.md b/docusaurus/docs/dev-docs/customization.md index 70ca48189d..bd901bba52 100644 --- a/docusaurus/docs/dev-docs/customization.md +++ b/docusaurus/docs/dev-docs/customization.md @@ -2,6 +2,7 @@ title: Customization description: Learn more about Strapi 5 customization possibilities displayed_sidebar: cmsSidebar +sidebar_label: Customization pagination_prev: dev-docs/advanced-features pagination_next: dev-docs/plugins tags: diff --git a/docusaurus/docs/dev-docs/data-management.md b/docusaurus/docs/dev-docs/data-management.md deleted file mode 100644 index a2e2db7fb2..0000000000 --- a/docusaurus/docs/dev-docs/data-management.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: Data management system -description: Import, export, and transfer data using the Strapi CLI -displayed_sidebar: cmsSidebar -keywords: - - DEITS -tags: -- data management system -- introduction -- strapi export -- strapi import -- strapi transfer ---- - -# Data Management System - -Occasionally, you need to move data out of or into a Strapi instance. This is possible with the data management system which uses CLI-based commands: - -- Use [`strapi export`](/dev-docs/data-management/export) to create a data backup, for archive purposes or to import it in another instance. -- Use [`strapi import`](/dev-docs/data-management/import) to restore data from a backup. -- Use [`strapi transfer`](/dev-docs/data-management/transfer) to transfer data between local and/or remote instances. - -The following documentation gives explanations and examples for the export, import, and transfer commands, while the [CLI reference documentation](/dev-docs/cli#strapi-export) lists all available flags in a condensed format. - -:::caution -Interactive CLI commands do not currently work with the `npm` package manager. For `strapi export` and `strapi import` this means the encryption key prompt is not visible in the CLI. In the meantime consider using the `yarn` package manager. -::: diff --git a/docusaurus/docs/dev-docs/data-management/export.md b/docusaurus/docs/dev-docs/data-management/export.md index 782fdb99f7..f16f25f5c3 100644 --- a/docusaurus/docs/dev-docs/data-management/export.md +++ b/docusaurus/docs/dev-docs/data-management/export.md @@ -15,13 +15,9 @@ tags: - tar.gz.enc file --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Data export - - -The `strapi export` command is used to export data from a local Strapi instance. By default, the `strapi export` command exports data as an encrypted and compressed `tar.gz.enc` file which includes: +The `strapi export` command is part of the [Data Management feature](/user-docs/features/data-management) and used to export data from a local Strapi instance. By default, the `strapi export` command exports data as an encrypted and compressed `tar.gz.enc` file which includes: - the project configuration, - entities: all of your content, diff --git a/docusaurus/docs/dev-docs/data-management/import.md b/docusaurus/docs/dev-docs/data-management/import.md index 9c9d9eaf54..684015aeb3 100644 --- a/docusaurus/docs/dev-docs/data-management/import.md +++ b/docusaurus/docs/dev-docs/data-management/import.md @@ -13,13 +13,9 @@ tags: - tar.gz.enc file --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Data import - - -The `strapi import` command is used to import data from a file. By default, the `strapi import` command imports data from an encrypted and compressed `tar.gz.enc` file which includes: +The `strapi import` command is part of the [Data Management feature](/user-docs/features/data-management) and used to import data from a file. By default, the `strapi import` command imports data from an encrypted and compressed `tar.gz.enc` file which includes: - the project configuration, - entities: all of your content, diff --git a/docusaurus/docs/dev-docs/data-management/transfer.md b/docusaurus/docs/dev-docs/data-management/transfer.md index e965a90800..1e79a70d62 100644 --- a/docusaurus/docs/dev-docs/data-management/transfer.md +++ b/docusaurus/docs/dev-docs/data-management/transfer.md @@ -10,13 +10,9 @@ tags: - environment --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Data transfer - - -The `strapi transfer` command streams your data from one Strapi instance to another Strapi instance. The `transfer` command uses strict schema matching, meaning your two Strapi instances need to be exact copies of each other except for the contained data. The default `transfer` command transfers your content (entities and relations), files (assets), project configuration, and schemas. The command allows you to transfer data: +The `strapi transfer` command is part of the [Data Management feature](/user-docs/features/data-management) and streams your data from one Strapi instance to another Strapi instance. The `transfer` command uses strict schema matching, meaning your two Strapi instances need to be exact copies of each other except for the contained data. The default `transfer` command transfers your content (entities and relations), files (assets), project configuration, and schemas. The command allows you to transfer data: - from a local Strapi instance to a remote Strapi instance - from a remote Strapi instance to a local Strapi instance diff --git a/docusaurus/docs/dev-docs/database-migrations.md b/docusaurus/docs/dev-docs/database-migrations.md index f3f3d209cb..e1da96bb54 100644 --- a/docusaurus/docs/dev-docs/database-migrations.md +++ b/docusaurus/docs/dev-docs/database-migrations.md @@ -3,12 +3,8 @@ title: Database migrations description: Strapi database migrations are ways to modify the database --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Database migrations - - Database migrations exist to run one-time queries against the database, typically to modify the tables structure or the data when upgrading the Strapi application. These migrations are run automatically when the application starts and are executed before the automated schema migrations that Strapi also performs on boot. :::callout 🚧 Experimental feature diff --git a/docusaurus/docs/dev-docs/deployment.md b/docusaurus/docs/dev-docs/deployment.md index 0ac9756ec0..3175479618 100644 --- a/docusaurus/docs/dev-docs/deployment.md +++ b/docusaurus/docs/dev-docs/deployment.md @@ -26,7 +26,7 @@ You can use [Strapi Cloud](/cloud/intro) to quickly deploy and host your project ::: :::tip -If you already created a data structure with the Content-Type Builder and added some data through the Content Manager to your local (development) Strapi instance, you can leverage the [data management system](/dev-docs/data-management) to transfer data from a Strapi instance to another one. +If you already created a data structure with the Content-Type Builder and added some data through the Content Manager to your local (development) Strapi instance, you can leverage the [data management system](/user-docs/features/data-management) to transfer data from a Strapi instance to another one. Another possible workflow is to first create the data structure locally, push your project to a git-based repository, deploy the changes to production, and only then add content to the production instance. ::: diff --git a/docusaurus/docs/dev-docs/error-handling.md b/docusaurus/docs/dev-docs/error-handling.md index 7c30d8cbae..badf1ee258 100644 --- a/docusaurus/docs/dev-docs/error-handling.md +++ b/docusaurus/docs/dev-docs/error-handling.md @@ -14,12 +14,8 @@ tags: - strapi-utils --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Error handling - - Strapi is natively handling errors with a standard format. There are 2 use cases for error handling: diff --git a/docusaurus/docs/dev-docs/faq.md b/docusaurus/docs/dev-docs/faq.md index 5bfbc61937..29649adb55 100644 --- a/docusaurus/docs/dev-docs/faq.md +++ b/docusaurus/docs/dev-docs/faq.md @@ -19,12 +19,8 @@ tags: --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Frequently Asked Questions - - Below are answers and solutions to most common issues that you may experience when working with Strapi. ## Why can't I create or update content-types in production/staging? @@ -82,7 +78,7 @@ Strapi uses a system called [extension](/dev-docs/plugins-extension) as plugins ## Can I add my own 3rd party auth provider? -Yes, you can either follow the following [documentation](/dev-docs/plugins/users-permissions#providers) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/plugins/users-permissions) code and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers. +Yes, you can either follow the following [documentation](/dev-docs/configurations/users-and-permissions-providers/new-provider-guide) or you can take a look at the [users-permissions](https://github.com/strapi/strapi/tree/master/packages/plugins/users-permissions) code and submit a pull request to include the provider for everyone. Eventually Strapi does plan to move from the current grant/purest provider to a split natured system similar to the upload providers. There is currently no ETA on this migration however. diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service.md index 9fd5911577..a2bafc12c9 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service.md @@ -1,7 +1,7 @@ --- title: From Entity Service API to Document Service API description: Learn how to transition from the Entity Service API of Strapi v4 to the Document Service API in Strapi 5 -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - document service API - upgrade to Strapi 5 diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/introduction.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/introduction.md index 678443f9d4..75ae5a4b55 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/introduction.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/introduction.md @@ -1,7 +1,8 @@ --- title: Additional resources for migrating to Strapi 5 +sidebar_label: Additional resources pagination_next: dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - upgrade to Strapi 5 --- diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/plugins-migration.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/plugins-migration.md index 8d68d9a025..da12319cfb 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/plugins-migration.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/additional-resources/plugins-migration.md @@ -1,6 +1,6 @@ --- title: Plugins upgrade summary -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - plugins - plugins development diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes.md index c9fa8363be..1f510b81b7 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes.md @@ -1,7 +1,7 @@ --- title: Breaking changes description: View the list of all breaking changes introduced between Strapi v4 and v5. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar pagination_prev: dev-docs/migration/v4-to-v5/step-by-step pagination_next: dev-docs/migration/v4-to-v5/additional-resources/introduction tags: diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/admin-panel-rbac-store-updated.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/admin-panel-rbac-store-updated.md index 621b394a20..cab92e11bd 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/admin-panel-rbac-store-updated.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/admin-panel-rbac-store-updated.md @@ -2,7 +2,7 @@ title: The admin panel RBAC system has been updated description: In Strapi 5, there is no `content-manager_rbacManager` anymore, and the regular permissions system is used instead. sidebar_label: content-manager_rbacManager removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content manager diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved.md index a7da7fb018..2a349704a1 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/attributes-and-content-types-names-reserved.md @@ -2,7 +2,7 @@ title: Reserved attributes and content-types names description: In Strapi 5, some attributes and content types names are reserved, and all fields or content types using the reserved names should be renamed before migrating to prevent data loss. sidebar_label: Reserved names -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - models diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/components-and-dynamic-zones-do-not-return-id.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/components-and-dynamic-zones-do-not-return-id.md index f1dc615698..77e310e025 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/components-and-dynamic-zones-do-not-return-id.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/components-and-dynamic-zones-do-not-return-id.md @@ -2,7 +2,7 @@ title: Components and dynamic zones do not return an id description: In Strapi 5, components and dynamic zones do not return an `id` with REST API requests so it's not possible to partially update them. sidebar_label: Components and dynamic zones do not return an id -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar unlisted: true tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/core-service-methods-use-document-service.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/core-service-methods-use-document-service.md index 01e8d5a141..fb9041e2e2 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/core-service-methods-use-document-service.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/core-service-methods-use-document-service.md @@ -2,7 +2,7 @@ title: Core service methods use the Document Service API description: In Strapi 5, core service methods use the Document Service API instead of the Entity Service API. sidebar_label: Core service methods use Document Service API -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - document service API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-columns.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-columns.md index bcacde383c..523d0d020f 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-columns.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-columns.md @@ -1,7 +1,7 @@ --- title: Database columns description: Content types always have feature columns -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - database diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-identifiers-shortened.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-identifiers-shortened.md index 9ce790a849..68e32c0da6 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-identifiers-shortened.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/database-identifiers-shortened.md @@ -2,7 +2,7 @@ title: Database identifiers shortened in v5 description: Database identifiers are shortened in Strapi v5 and can't be longer than 55 characters to avoid issues with identifiers that are too long. sidebar_label: Database identifiers shortened -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - database diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-index-removed.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-index-removed.md index a482679b92..3ed5cf77bf 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-index-removed.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-index-removed.md @@ -2,7 +2,7 @@ title: defaultIndex removed description: In Strapi 5, the 'defaultIndex' option is removed from the 'public' middleware. sidebar_label: defaultIndex removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - middlewares diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-input-validation.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-input-validation.md index 739fb758d3..3ba9d0c9d4 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-input-validation.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/default-input-validation.md @@ -2,7 +2,7 @@ title: REST API input is validated by default in controllers description: In Strapi 5, REST API input is validated by default in controllers, instead of accepting invalid data and sanitizing it silently. sidebar_label: Default input validation -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - controllers diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/edit-view-layout-and-list-view-layout-rewritten.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/edit-view-layout-and-list-view-layout-rewritten.md index 049ff7c10c..d06bbcf9fc 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/edit-view-layout-and-list-view-layout-rewritten.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/edit-view-layout-and-list-view-layout-rewritten.md @@ -2,7 +2,7 @@ title: The `EditViewLayout` and `ListViewLayout` have been rewritten description: In Strapi 5, some admin panel hooks have been removed from the Redux store and a new `useDocumentLayout` hook is introduced. sidebar_label: EditViewLayout and ListViewLayout refactored -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content manager diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/entity-service-deprecated.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/entity-service-deprecated.md index 0ec1b89b9a..c8f9c399b8 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/entity-service-deprecated.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/entity-service-deprecated.md @@ -2,7 +2,7 @@ title: Entity Service deprecated description: In Strapi 5, the Entity Service API is deprecated in favor of the new Document Service API. sidebar_label: Entity Service deprecated -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Entity Service API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/fetch.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/fetch.md index b46698a751..09970dbf45 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/fetch.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/fetch.md @@ -2,7 +2,7 @@ title: strapi.fetch uses native fetch() API description: In Strapi 5, the `strapi.fetch` object is now wrapping node Fetch API instead of node-fetch. sidebar_label: strapi.fetch uses native fetch() -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - fetch diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/get-where-removed.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/get-where-removed.md index 3ecabf35ab..1c3281a2ae 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/get-where-removed.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/get-where-removed.md @@ -2,7 +2,7 @@ title: The getWhere() method for permission provider instances has been removed description: In Strapi 5, the getWhere() for permission provider instances has been removed, and users should use provider.values().filter() to replace it. sidebar_label: getWhere removed from permission provider -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - providers diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/graphql-api-updated.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/graphql-api-updated.md index bf5a6184aa..66acbe8b66 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/graphql-api-updated.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/graphql-api-updated.md @@ -2,7 +2,7 @@ title: The GraphQL API has been updated description: In Strapi 5, the GraphQL API has been updated. It handles the new, flattened response format, and can also now accept Relay-style queries. sidebar_label: GraphQL API updated -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/helper-plugin-deprecated.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/helper-plugin-deprecated.md index c875f40913..dcbc65448b 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/helper-plugin-deprecated.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/helper-plugin-deprecated.md @@ -2,7 +2,7 @@ title: helper-plugin removed description: In Strapi 5, the `helper-plugin` is removed. A whole migration reference is available for plugin developers, and codemods will automatically handle some changes. sidebar_label: helper-plugin removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - plugins development diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale.md index be8cfcdafa..5bb9e2b436 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/i18n-content-manager-locale.md @@ -2,7 +2,7 @@ title: Internationalization (i18n) is now part of the strapi core description: Internationalization (i18n) is now part of the Strapi core and no longer a plugin, and this impacts how the locale parameter is sent and accessed. sidebar_label: i18n part of strapi core -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Internationalization (i18n) diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/inject-content-manager-component.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/inject-content-manager-component.md index 83f949f1e6..e6ee744fca 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/inject-content-manager-component.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/inject-content-manager-component.md @@ -2,7 +2,7 @@ title: injectContentManagerComponent() removed description: In Strapi 5, the Content Manager is a plugin, which affects the injectContentManagerComponent() method, replaced by getPlugin('content-manager').injectComponent(). sidebar_label: injectContentManagerComponent() removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content manager diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/is-supported-image-removed.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/is-supported-image-removed.md index 9ff65e705a..06dbdaf36c 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/is-supported-image-removed.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/is-supported-image-removed.md @@ -2,7 +2,7 @@ title: The isSupportedImage method is removed in Strapi 5 description: The `isSupportedImage` method is removed in Strapi 5. Users should use `isImage` or `isOptimizableImage` instead. sidebar_label: isSupportedImage removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - upload plugin diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/koa-body-v6.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/koa-body-v6.md index 0892e51a31..3621c90185 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/koa-body-v6.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/koa-body-v6.md @@ -2,7 +2,7 @@ title: Strapi 5 uses koa-body v6 description: Strapi 5 uses koa-body v6, which updates node formidable to v2. sidebar_label: koa-body v6 and formidable v2 -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - body middleware diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/license-only.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/license-only.md index 5887184e30..febed34487 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/license-only.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/license-only.md @@ -2,7 +2,7 @@ title: lockIcon replaced by licenseOnly description: In Strapi 5, the lockIcon property is replaced by licenseOnly, which affects how the addMenuLink(), addSettingsLink(), and addSettingsLinks() methods from the Admin Panel API work. sidebar_label: lockIcon replaced by licenseOnly -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - plugins development @@ -64,4 +64,4 @@ A similar result can be achieved in Strapi v4 by adding the `lockIcon` property. ### Manual migration -If your custom Strapi v4 code uses the `lockIcon` property to highlight a paid feature that requires an license, search and replace `lockIcon: true` by `licenseOnly: true`. +If your custom Strapi v4 code uses the `lockIcon` property to highlight a paid feature that requires a or an plan, search and replace `lockIcon: true` by `licenseOnly: true`. diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service.md index 36595c2e43..a3855ad863 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/lifecycle-hooks-document-service.md @@ -2,7 +2,7 @@ title: Database lifecycle hooks are triggered differently with the Document Service API methods description: In Strapi 5, database lifecycle hooks are triggered differently with the various Document Service API methods. sidebar_label: Lifecycle hooks -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Document Service API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mailgun-provider-variables.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mailgun-provider-variables.md index 2055f23560..061422789d 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mailgun-provider-variables.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mailgun-provider-variables.md @@ -2,7 +2,7 @@ title: Some Mailgun provider legacy variables are not supported description: In Strapi 5, some variables have been renamed for the Mailgun provider options, dropping support for some legacy variables that were deprecated in Strapi v4. sidebar_label: Mailgun provider options -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - providers diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/model-config-path-uses-uid.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/model-config-path-uses-uid.md index b9c65135eb..a952040bfe 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/model-config-path-uses-uid.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/model-config-path-uses-uid.md @@ -2,7 +2,7 @@ title: Model config path uses uid instead of dot notation description: Modules like `api::myapi` and `plugin::upload` should no longer be accessed in the Strapi config using `api.myapi` and `plugin.upload`, but instead using `api::myapi` and `plugin::upload`. sidebar_label: Model config path uses uid -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - configuration diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mysql5-unsupported.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mysql5-unsupported.md index cc1db30c41..b78d025ca7 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mysql5-unsupported.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/mysql5-unsupported.md @@ -1,7 +1,7 @@ --- title: MySQL v5 unsupported description: MySQL v5 is not supported in Strapi v5 anymore. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - database diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/new-response-format.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/new-response-format.md index af9f7bcbfa..7b416fc4c4 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/new-response-format.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/new-response-format.md @@ -2,7 +2,7 @@ title: Strapi 5 has a new, flattened response format for API calls description: In Strapi 5, the response format has been simplified and flattened, and attributes of requested content are no longer wrapped in an attributes object. sidebar_label: New response format -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service.md index 875d292805..b5f3052351 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service.md @@ -1,7 +1,7 @@ --- title: No findPage() in Document Service API description: In Strapi 5, the Entity Service API is deprecated, and for the findPage() method you should use the Document Service API's findMany() method instead. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Document Service API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-locale-all.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-locale-all.md index afefa298d7..71b5a3b6a8 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-locale-all.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-locale-all.md @@ -2,7 +2,7 @@ title: locale=all can not be used to query all locales description: In Strapi 5, it's no longer possible to get all localized versions with the '?locale=all' parameter. sidebar_label: No locale=all support -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - locale @@ -54,7 +54,7 @@ Getting documents (collection types or single types) in all locales at the same ### Notes -Additional information on what is possible to do with `locale` in Strapi 5 is available in the [REST API](/dev-docs/i18n#rest), [GraphQL API](/dev-docs/i18n#graphql), and [Document Service API](/dev-docs/api/document-service/locale) reference documentations. +Additional information on what is possible to do with `locale` in Strapi 5 is available in the [REST API](/dev-docs/api/rest/locale), [GraphQL API](/dev-docs/api/graphql#locale), and [Document Service API](/dev-docs/api/document-service/locale) reference documentations. ### Manual procedure diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-shared-population-strategy-components-dynamic-zones.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-shared-population-strategy-components-dynamic-zones.md index 480e5ff15e..85833343cc 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-shared-population-strategy-components-dynamic-zones.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-shared-population-strategy-components-dynamic-zones.md @@ -2,7 +2,7 @@ title: No shared population strategy for components & dynamic zones description: In Strapi 5, the shared population strategy is not supported anymore, so components and dynamic zones must be explicitly populated using `on` fragments. sidebar_label: No shared population strategy -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-upload-at-entry-creation.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-upload-at-entry-creation.md index 4a7a5c8f02..000cc80d31 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-upload-at-entry-creation.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/no-upload-at-entry-creation.md @@ -1,7 +1,7 @@ --- title: Upload a file at entry creation no longer supported description: In Strapi 5, it is not possible to upload a file while creating an entry, so users must upload the file first, and then create the entry with the created file id. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - upload diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-better-sqlite3-for-sqlite.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-better-sqlite3-for-sqlite.md index ebfba7a464..1ce2a28ac7 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-better-sqlite3-for-sqlite.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-better-sqlite3-for-sqlite.md @@ -2,7 +2,7 @@ title: Only the `better-sqlite3` package is supported for the SQLite client description: In Strapi 5, users can only use the `better-sqlite3` package for SQLite databases, and the `client` value for it must be set to `sqlite`. sidebar_label: Only better-sqlite3 for sqlite -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar unlisted: true tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-mysql2-package-for-mysql.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-mysql2-package-for-mysql.md index e9bb9bc90c..39fc54c105 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-mysql2-package-for-mysql.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/only-mysql2-package-for-mysql.md @@ -2,7 +2,7 @@ title: Only the mysql2 package is supported for the MySQL client description: In Strapi 5, only the mysql2 package is supported for MySQL databases. sidebar_label: Only mysql2 for MySQL -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar unlisted: true tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed.md index af381f556c..04e96b4fee 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publication-state-removed.md @@ -2,7 +2,7 @@ title: publicationState is removed and replaced by status description: In Strapi 5, 'publicationState' can no longer be used in Content API calls. The new status parameter can be used and accepts 2 different values, draft and published. sidebar_label: status instead of publicationState -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Content API @@ -61,7 +61,7 @@ In Strapi 5, the [Draft & Publish feature](/user-docs/content-manager/saving-and ### Notes * There are no fallbacks to return by default the published version, and return the draft version if no published version is found. -* Additional information about how to use the new `status` parameter can be found in the [REST API](/dev-docs/api/rest/filters-locale-publication#status), [GraphQL API](/dev-docs/api/graphql#status), and [Document Service API](/dev-docs/api/document-service/status) documentation. +* Additional information about how to use the new `status` parameter can be found in the [REST API](/dev-docs/api/rest/status), [GraphQL API](/dev-docs/api/graphql#status), and [Document Service API](/dev-docs/api/document-service/status) documentation. ### Migration procedure diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled.md index 1025accbad..7afd1763d7 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled.md @@ -2,7 +2,7 @@ title: Content types with Draft & Publish disabled always have the publishedAt value set to a date description: In Strapi 5, content-types with Draft & Publish disabled always have the publishedAt value set to a date. sidebar_label: publishedAt always exists -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - draft & publish diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/react-router-dom-6.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/react-router-dom-6.md index 1b9419e8f5..097bfcaa57 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/react-router-dom-6.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/react-router-dom-6.md @@ -2,7 +2,7 @@ title: Strapi 5 uses React Router DOM 6 description: Strapi 5 uses react-router-dom v6. This impacts the links added to Global Settings or to the Menu using the Admin Panel API. sidebar_label: React Router DOM 6 -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - react-router diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/redux-content-manager-app-state.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/redux-content-manager-app-state.md index 1d48a0394a..1c826f16ce 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/redux-content-manager-app-state.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/redux-content-manager-app-state.md @@ -2,7 +2,7 @@ title: The ContentManagerAppState redux is modified description: In Strapi 5, the redux store for the Content Manager has been changed and some redux actions were removed. sidebar_label: ContentManagerAppState redux modified -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Content Manager diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/register-allowed-fields.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/register-allowed-fields.md index 5a4a61a3f8..620cee082d 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/register-allowed-fields.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/register-allowed-fields.md @@ -2,7 +2,7 @@ title: The Users & Permissions plugin's register.allowedFields configuration option defaults to [] description: In Strapi 5, The Users & Permissions plugin's `register.allowedFields` configuration option defaults to []. sidebar_label: register.allowedFields defaults to [] -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - users & permissions @@ -55,4 +55,4 @@ An undefined `allowedFields` is treated as an empty array, and no fields are acc ### Manual procedure -A codemod should handle this migration. If not, please refer to the documentation on how to [register allowed fields for the Users & Permissions plugin](/dev-docs/plugins/users-permissions#registration). +A codemod should handle this migration. If not, please refer to the documentation on how to [register allowed fields for the Users & Permissions plugin](/user-docs/features/users-permissions#registration-configuration). diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/remove-webhook-populate-relations.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/remove-webhook-populate-relations.md index 218b4dd009..67efe1e6c5 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/remove-webhook-populate-relations.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/remove-webhook-populate-relations.md @@ -2,7 +2,7 @@ title: The 'webhooks.populateRelations' server configuration is removed description: In Strapi 5, webhooks have been refactored and the `webhook.populateRelations` option will become redundant. This might affect lifecycles expecting the returned relations of create, update and delete to be populated. sidebar_label: No webhooks.populateRelations configuration -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - webhooks diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options.md index 4221564374..184910f4fc 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/removed-support-for-some-env-options.md @@ -1,7 +1,7 @@ --- title: Some env-only configuration options are handled by the server configuration description: In Strapi 5, some env-only configuration options are handled by the server configuration -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar sidebar_label: Env options moved to server configuration tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-default-log-level.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-default-log-level.md index c6c78a9719..f3f35ff3c4 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-default-log-level.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-default-log-level.md @@ -1,7 +1,7 @@ --- title: Server log level is `http` description: The default log level of the middleware logger in Strapi 5 is 'http'. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - configuration diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-proxy.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-proxy.md index d55ad1e9ed..157176369e 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-proxy.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/server-proxy.md @@ -1,7 +1,7 @@ --- title: Server proxy configuration description: In Strapi 5, all proxy configuration options are now configured through the 'server.proxy' object in the '/config/server.js|ts' instead of having various option names such as 'globalProxy' and 'proxy' in Strapi v4. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - configuration diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/sort-by-id.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/sort-by-id.md index b822e846a0..35d9141d3e 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/sort-by-id.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/sort-by-id.md @@ -2,7 +2,7 @@ title: Sorting by id is no longer possible to sort by chronological order description: In Strapi 5, sorting by id is no longer possible to sort by chronological order, and you should use createdAt instead. sidebar_label: Sort chronologically with createdAt -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-container.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-container.md index fd99cabc40..e0a131ffb8 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-container.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-container.md @@ -2,7 +2,7 @@ title: Strapi is a subclass of Container description: In Strapi 5, container methods can be accessed directly from the strapi class. sidebar_label: Strapi subclass of Container -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar unlisted: true tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-imports.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-imports.md index 486804cea8..30fbc63841 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-imports.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-imports.md @@ -2,7 +2,7 @@ title: Strapi factories import have been updated description: In Strapi 5, the way import are done, through the application init function or through factories, has been updated. sidebar_label: Use strapiFactory in imports -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar unlisted: true tags: - breaking changes diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-utils-refactored.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-utils-refactored.md index d7b4568782..801ea70d24 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-utils-refactored.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strapi-utils-refactored.md @@ -2,7 +2,7 @@ title: strapi-utils is refactored description: In Strapi 5, the 'strapi-utils' core package has been refactored. This page lists the additions, removals, and other updates. sidebar_label: strapi-utils refactored -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - strapi-utils diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strict-requirements-config-files.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strict-requirements-config-files.md index 8ff427b4cf..49d6c593bc 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strict-requirements-config-files.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/strict-requirements-config-files.md @@ -1,7 +1,7 @@ --- title: Strict requirements for configuration filenames description: Strapi 5 has strict requirements on the configuration filenames allowed to be loaded. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - configuration diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/templates.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/templates.md index a52a52c8ae..ae53cd7210 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/templates.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/templates.md @@ -1,7 +1,7 @@ --- title: Templates are now regular, standalone Strapi applications description: Templates have been fully rewritten in Strapi 5 and now are standalone, regular Strapi applications, making it easier to create, distribute, and re-use them. -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - templates diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/upgrade-to-apollov4.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/upgrade-to-apollov4.md index 9a32229282..25fad9a615 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/upgrade-to-apollov4.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/upgrade-to-apollov4.md @@ -2,7 +2,7 @@ title: Apollo Server v3 upgraded to Apollo Server v4 description: The upgrade from Apollo Server v3 to v4 and graphql ^15 to ^16. sidebar_label: Upgrade to Apollo Server v4 -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - Content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/use-document-id.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/use-document-id.md index e448795690..f00a280bf1 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/use-document-id.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/use-document-id.md @@ -2,7 +2,7 @@ title: documentId should be used instead of id in API calls description: Documents should be called by their documentId in Content API calls (REST API & GraphQL). sidebar_label: documentId instead of id -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - content API diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/vite.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/vite.md index 8cde43a1af..252eb7c288 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/vite.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/vite.md @@ -2,7 +2,7 @@ title: Vite is the default bundler description: In Strapi 5, Vite is the default bundler and replaces webpack. sidebar_label: Vite as default bundler -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - dependencies diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/webpack-aliases-removed.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/webpack-aliases-removed.md index e97b340a2d..e2eddf3c93 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/webpack-aliases-removed.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/webpack-aliases-removed.md @@ -2,7 +2,7 @@ title: Webpack Aliases are removed description: A simplified approach of aliasing in Strapi v5. sidebar_label: Webpack Aliases removed -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - dependencies diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/yarn-not-default.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/yarn-not-default.md index 409c1a1ea1..3cf5ea2c8e 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/yarn-not-default.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/breaking-changes/yarn-not-default.md @@ -2,7 +2,7 @@ title: The CLI default package manager is not yarn anymore description: Strapi 5 detects what package manager you are using to run the CLI, and uses this package manager to install dependencies. sidebar_label: yarn not the default package manager -displayed_sidebar: devDocsMigrationV5Sidebar +displayed_sidebar: cmsSidebar tags: - breaking changes - dependencies diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md index 4e458abcb4..25a8ea6143 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/introduction-and-faq.md @@ -1,6 +1,7 @@ --- title: Upgrading to Strapi 5 - Introduction and FAQ description: Learn more about how to upgrade to Strapi 5 +sidebar_label: Introduction and FAQ pagination_prev: dev-docs/upgrades pagination_next: dev-docs/migration/v4-to-v5/step-by-step tags: diff --git a/docusaurus/docs/dev-docs/migration/v4-to-v5/step-by-step.md b/docusaurus/docs/dev-docs/migration/v4-to-v5/step-by-step.md index b7534e74f1..30d19850c0 100644 --- a/docusaurus/docs/dev-docs/migration/v4-to-v5/step-by-step.md +++ b/docusaurus/docs/dev-docs/migration/v4-to-v5/step-by-step.md @@ -1,6 +1,7 @@ --- title: Step-by-step guide to upgrade to Strapi 5 description: Follow this step-by-step guide to upgrade from Strapi v4 to Strapi 5 +sidebar_label: Step-by-step guide tags: - upgrade to Strapi 5 - upgrade tool diff --git a/docusaurus/docs/dev-docs/plugins-extension.md b/docusaurus/docs/dev-docs/plugins-extension.md index 046de1679e..e38b1a7a1c 100644 --- a/docusaurus/docs/dev-docs/plugins-extension.md +++ b/docusaurus/docs/dev-docs/plugins-extension.md @@ -12,12 +12,8 @@ tags: - services --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Plugins extension - - Strapi comes with [plugins](/dev-docs/plugins) that can be installed from the [Marketplace](/user-docs/plugins/installing-plugins-via-marketplace#installing-marketplace-plugins-and-providers) or as npm packages. You can also create your own plugins (see [plugins development](/dev-docs/plugins/developing-plugins)) or extend the existing ones. :::warning diff --git a/docusaurus/docs/dev-docs/plugins/documentation.md b/docusaurus/docs/dev-docs/plugins/documentation.md index 422d056153..9bd6c721d8 100644 --- a/docusaurus/docs/dev-docs/plugins/documentation.md +++ b/docusaurus/docs/dev-docs/plugins/documentation.md @@ -2,6 +2,7 @@ title: Documentation plugin displayed_sidebar: cmsSidebar description: By using Swagger UI, the API documentation plugin takes out most of your pain to generate your documentation. +toc_max_heading_level: 5 tags: - admin panel - excludeFromGeneration function @@ -13,21 +14,25 @@ tags: - Swagger UI --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Documentation plugin - +The Documentation plugin automates your API documentation creation. It basically generates a swagger file. It follows the [Open API specification version](https://swagger.io/specification/). + +:::prerequisites Identity Card of the Plugin + **Location:** Usable via the admin panel. Configured through both admin panel and server code, with different sets of options.
+ **Package name:** `@strapi/plugin-documentation`
+ **Additional resources:** [Strapi Marketplace page](https://market.strapi.io/plugins/@strapi-plugin-documentation)
+::: -The Documentation plugin is useful to document the available endpoints once you created an API. + If installed, the Documentation plugin will inspect content types and routes found on all APIs in your project and any plugin specified in the configuration. The plugin will then programmatically generate documentation to match the [OpenAPI specification](https://swagger.io/specification/). The Documentation plugin generates the [paths objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#paths-object) and [schema objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema-object) and converts all Strapi types to [OpenAPI data types](https://swagger.io/docs/specification/data-models/data-types/). -The generated documentation can be found in your application at the following path: `src/extensions/documentation/documentation//full_documentation.json` +The generated documentation JSON file can be found in your application at the following path: `src/extensions/documentation/documentation//full_documentation.json` ## Installation -To install the plugin run following command in your terminal: +To install the documentation plugin, run following command in your terminal: @@ -49,29 +54,24 @@ npm install @strapi/plugin-documentation -Once the plugin is installed, starting the application generates the API documentation. - -## Swagger UI - -The Documentation plugin visualizes your API using [Swagger UI](https://swagger.io/tools/swagger-ui/). To access the UI, select *Plugins > Documentation* in the main navigation of the admin panel. Then click **Open documentation** to open the Swagger UI. Using the Swagger UI you can view all of the endpoints available on your API and trigger API calls. +Once the plugin is installed, starting Strapi generates the API documentation. -:::tip -Once installed, the Documentation plugin UI can be accessed at the following URL: -`:/documentation/` -(e.g., [`localhost:1337/documentation/v1.0.0`](http://localhost:1337/documentation/v1.0.0)). -::: +## Configuration -### Authenticated requests +Most configuration options for the Documentation plugin are handled via your Strapi project's code. A few settings are available in the admin panel. -Strapi is secured by default, which means that most of your end-points require the user to be authorized. If the action has not been set to public in users and permission then you must provide your JWT. To do this, click the “Authorize” button and paste your JWT. +### Admin panel settings -## Administration panel +The Documentation plugin affects multiple parts of the admin panel. The following table lists all the additional options and settings that are added to a Strapi application once the plugin has been installed: -This plugin comes with an interface that is available in your administration panel and a configuration file. +| Section impacted | Options and settings | +|------------------|-------------------------------------------------------------| +| Documentation |
    Addition of a new Documentation option in the main navigation ![Documentation plugin icon](/img/assets/icons/v5/info.svg) which shows a panel with buttons to ![Eye icon](/img/assets/icons/v5/Eye.svg) open and ![Regenerate icon](/img/assets/icons/v5/ArrowClockwise.svg) regenerate the documentation.
| +| Settings |
  • Addition of a "Documentation plugin" setting section, which controls whether the documentation endpoint is private or not (see [restricting access](#restricting-access)).
    👉 Path reminder: ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Documentation plugin*

  • Activation of role based access control for accessing, updating, deleting, and regenerating the documentation. Administrators can authorize different access levels to different types of users in the *Plugins* tab and the *Settings* tab (see [Users & Permissions documentation](/user-docs/users-roles-permissions/configuring-administrator-roles#editing-a-role)).
    👉 Path reminder: ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Administration Panel > Roles*
| -### Restrict the access to your API documentation +#### Restricting access to your API documentation {#restricting-access} -By default, your documentation will be accessible by anyone. +By default, your API documentation will be accessible by anyone. To restrict API documentation access, enable the **Restricted Access** option from the admin panel: @@ -81,98 +81,91 @@ To restrict API documentation access, enable the **Restricted Access** option 4. Define a password in the `password` input. 5. Save the settings. -### Regenerate documentation +### Code-based configuration -There are 2 ways to update the documentation after making changes to your API: +To configure the Documentation plugin, create a `settings.json` file in the `src/extensions/documentation/config` folder. In this file, you can specify all your environment variables, licenses, external documentation links, and all the entries listed in the [specification](https://swagger.io/specification/). -- restart your application to regenerate the version of the documentation specified in the Documentation plugin's configuration, -- or go to the Documentation plugin page and click the **regenerate** button for the documentation version you want to regenerate. - -## Configuration +The following is an example configuration: -The Documentation plugin is initialized with the following configuration, where all properties can be altered by providing new values to the documentation plugin's configuration object in `config/plugins.js`: - -```js -module.exports = { - documentation: { - enabled: true, - config: { - openapi: '3.0.0', - info: { - version: '1.0.0', - title: 'DOCUMENTATION', - description: '', - termsOfService: 'YOUR_TERMS_OF_SERVICE_URL', - contact: { - name: 'TEAM', - email: 'contact-email@something.io', - url: 'mywebsite.io' - }, - license: { - name: 'Apache 2.0', - url: 'https://www.apache.org/licenses/LICENSE-2.0.html' - }, - }, - 'x-strapi-config': { - // Leave empty to ignore plugins during generation - plugins: [ 'upload', 'users-permissions'], - path: '/documentation', - }, - servers: [{ url: 'http://localhost:1337/api', description: 'Development server' }], - externalDocs: { - description: 'Find out more', - url: 'https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html' - }, - security: [ { bearerAuth: [] } ] +```json title="src/extensions/documentation/config/settings.json" +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "DOCUMENTATION", + "description": "", + "termsOfService": "YOUR_TERMS_OF_SERVICE_URL", + "contact": { + "name": "TEAM", + "email": "contact-email@something.io", + "url": "mywebsite.io" + }, + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" } - } + }, + "x-strapi-config": { + "plugins": ["upload", "users-permissions"], + "path": "/documentation" + }, + "servers": [ + { + "url": "http://localhost:1337/api", + "description": "Development server" + } + ], + "externalDocs": { + "description": "Find out more", + "url": "https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html" + }, + "security": [ + { + "bearerAuth": [] + } + ] } ``` -### Create a new version of the documentation +:::tip +If you need to add a custom key, prefix it by `x-` (e.g., `x-strapi-something`). +::: -To create a new version of your documentation, update the `version` key as follows: +#### Creating a new version of the documentation -```js title="config/plugins.js" +To create a new version, change the `info.version` key in the `settings.json` file: -module.exports = { - documentation: { - enabled: true, - config: { - info: { version: "2.0.0" }, - }, - }, -}; +```json title="src/extensions/documentation/config/settings.json" +{ + "info": { + "version": "2.0.0" + } +} ``` -### Indicate which plugins need documentation generated - -If you want plugins to be included in documentation generation, they should be included in the `plugins` array on the `x-strapi-config`. By default, the array is initialized with `["upload", "users-permissions"]`. +This will automatically create a new version. -Similarly, if you do not want plugins to be included in documentation generation, provide an empty array: +#### Defining which plugins need documentation generated -```js title="config/plugins.js" +If you want plugins to be included in documentation generation, they should be included in the `plugins` array in the `x-strapi-config` object. By default, the array is initialized with `["upload", "users-permissions"]`: -module.exports = { - documentation: { - enabled: true, - config: { - "x-strapi-config": { - // Default - plugins: ["upload", "users-permissions"], - // Custom - plugins: ["upload"], - // Do not generate for plugins - plugins: [], - }, - }, - }, -}; +```json title="src/extensions/documentation/config/settings.json" +{ + "x-strapi-config": { + "plugins": ["upload", "users-permissions"] + } +} ``` -## Overriding the generated documentation +To add more plugins, such as your custom plugins, add their name to the array. + +If you do not want plugins to be included in documentation generation, provide an empty array (i.e., `plugins: []`). + +#### Overriding the generated documentation + +The Documentation plugins comes with 3 methods to override the generated documentation: [`excludeFromGeneration`](#exclude-from-generation), [`registerOverride`](#register-override), and [`mutateDocumentation`](#mutate-documentation). -### Excluding from generation +##### excludeFromGeneration() {#exclude-from-generation} To exclude certain APIs or plugins from being generated, use the `excludeFromGeneration` found on the documentation plugin’s `override` service in your application or plugin's [`register` lifecycle](/dev-docs/plugins/admin-panel-api#register). @@ -182,7 +175,7 @@ To exclude certain APIs or plugins from being generated, use the `excludeFromGen For example, pluginA might create several new APIs while pluginB may only want to generate documentation for some of those APIs. In that case, pluginB could still benefit from the generated documentation it does need by excluding only what it does not need. ::: -**`excludeFromGeneration()`** +***** | Parameter | Type | Description | | --------- | -------------------------- | -------------------------------------------------------- | @@ -205,7 +198,7 @@ module.exports = { } ``` -### Providing replacement documentation +##### registerOverride() {#register-override} If the Documentation plugin fails to generate what you expect, it is possible to replace what has been generated. @@ -213,8 +206,6 @@ The Documentation plugin exposes an API that allows you to replace what was gene To provide an override, use the `registerOverride` function found on the Documentation plugin’s `override` service in your application or plugin's [`register` lifecycle](/dev-docs/plugins/admin-panel-api#register). -**`registerOverride()`** - | Parameter | Type | Description | | ----------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------- | | `override` | Object | OpenAPI object including any of the following keys paths, tags, components. Accepts JavaScript, JSON, or yaml | @@ -265,9 +256,9 @@ module.exports = { The overrides system is provided to try and simplify amending the generated documentation. It is the only way a plugin can add or modify the generated documentation. -The Documentation plugin’s configuration also accepts a `mutateDocumentation` function on `info['x-strapi-config']`. This function receives a draft state of the generated documentation that be can be mutated. It should only be applied from an application and has the final say in the OpenAPI schema. +##### mutateDocumentation() {#mutate-documentation} -**`mutateDocumentation()`** +The Documentation plugin’s configuration also accepts a `mutateDocumentation` function on `info['x-strapi-config']`. This function receives a draft state of the generated documentation that be can be mutated. It should only be applied from an application and has the final say in the OpenAPI schema. | Parameter | Type | Description | | --------------------------- | ------ | ---------------------------------------------------------------------- | @@ -289,3 +280,24 @@ module.exports = { }, }; ``` + +## Usage + +The Documentation plugin visualizes your API using [Swagger UI](https://swagger.io/tools/swagger-ui/). To access the UI, select ![Documentation plugin icon](/img/assets/icons/v5/info.svg) in the main navigation of the admin panel. Then click **Open documentation** to open the Swagger UI. Using the Swagger UI you can view all of the endpoints available on your API and trigger API calls. + +:::tip +Once the plugin is installed, the plugin user interface can be accessed at the following URL: +`:/documentation/` +(e.g., [`localhost:1337/documentation/v1.0.0`](http://localhost:1337/documentation/v1.0.0)). +::: + +### Regenerating documentation + +There are 2 ways to update the documentation after making changes to your API: + +- restart your application to regenerate the version of the documentation specified in the Documentation plugin's configuration, +- or go to the Documentation plugin page and click the **regenerate** button for the documentation version you want to regenerate. + +### Authenticating requests + +Strapi is secured by default, which means that most of your endpoints require the user to be authorized. If the CRUD action has not been set to Public in the [Users & Permissions plugin](/user-docs/features/users-permissions#configuring-end-user-roles) then you must provide your JSON web token (JWT). To do this, while viewing the API Documentation, click the **Authorize** button and paste your JWT in the _bearerAuth_ _value_ field. diff --git a/docusaurus/docs/dev-docs/plugins/email.md b/docusaurus/docs/dev-docs/plugins/email.md deleted file mode 100644 index 146820ede7..0000000000 --- a/docusaurus/docs/dev-docs/plugins/email.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: Email plugin -displayed_sidebar: cmsSidebar -description: Send email from your server or externals providers. -tags: -- admin panel -- controllers -- email plugin -- lifecycle hooks -- plugins -- services -- send() function -- sendTemplatedEmail() function ---- - -# Email plugin - -The Email plugin enables applications to send emails from a server or an external provider. The Email plugin uses the Strapi global API, meaning it can be called from anywhere inside a Strapi application. Two of the most common use cases are in the Strapi back end and in the admin panel. The following documentation describes how to use the Email plugin in a controller or service for back-end use cases and using a lifecycle hook for admin panel use cases. - -:::prerequisites - -The Email plugin requires a provider and a provider configuration in the `config/plugins.js` file or `config/plugins.ts` file. See the [Providers](/dev-docs/providers) documentation for detailed installation and configuration instructions. - -::: - -:::note -[`Sendmail`](https://www.npmjs.com/package/sendmail) is the default email provider in the Strapi Email plugin. It provides functionality for the local development environment but is not production-ready in the default configuration. For production stage applications you need to further configure `Sendmail` or change providers. The [Providers](/dev-docs/providers) documentation has instructions for changing providers, configuring providers, and creating a new email provider. -::: - -## Sending emails with a controller or service - -The Email plugin has an `email` [service](/dev-docs/backend-customization/services) that contains 2 functions to send emails: - -* `send()` directly contains the email contents, -* `sendTemplatedEmail()` consumes data from the Content Manager to populate emails, streamlining programmatic emails. - -### Using the `send()` function - -To trigger an email in response to a user action add the `send()` function to a [controller](/dev-docs/backend-customization/controllers) or [service](/dev-docs/backend-customization/services). The send function has the following properties: - -| Property | Type | Format | Description | -|-----------|----------|---------------|-------------------------------------------------------| -| `from` | `string` | email address | If not specified, uses `defaultFrom` in `plugins.js`. | -| `to` | `string` | email address | Required | -| `cc` | `string` | email address | Optional | -| `bcc` | `string` | email address | Optional | -| `replyTo` | `string` | email address | Optional | -| `subject` | `string` | - | Required | -| `text` | `string` | - | Either `text` or `html` is required. | -| `html` | `string` | HTML | Either `text` or `html` is required. | - -```js title="This code example can be used in a controller or a service path: ./src/api/{api name}/controllers/{api name}.js or ./src/api/{api name}/services/{api name}.js" - - await strapi.plugins['email'].services.email.send({ - to: 'valid email address', - from: 'your verified email address', //e.g. single sender verification in SendGrid - cc: 'valid email address', - bcc: 'valid email address', - replyTo: 'valid email address', - subject: 'The Strapi Email plugin worked successfully', - text: 'Hello world!', - html: 'Hello world!', - }), -``` - -### Using the `sendTemplatedEmail()` function - -The `sendTemplatedEmail()` function is used to compose emails from a template. The function compiles the email from the available properties and then sends the email. To use the `sendTemplatedEmail()` function, define the `emailTemplate` object and add the function to a controller or service. The function calls the `emailTemplate` object, and can optionally call the `emailOptions` and `data` objects: - -| Parameter | Description | Type | Default | -|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------|---------| -| `emailOptions`
Optional | Contains email addressing properties: `to`, `from`, `replyTo`, `cc`, and `bcc` | `object` | { } | -| `emailTemplate` | Contains email content properties: `subject`, `text`, and `html` using [Lodash string templates](https://lodash.com/docs/4.17.15#template) | `object` | { } | -| `data`
Optional | Contains the data used to compile the templates | `object` | { } | - -```js title="This code example can be used in a controller or a service path: ./src/api/{api name}/controllers/{api name}.js or ./src/api/{api name}/services/{api name}.js" - - -const emailTemplate = { - subject: 'Welcome <%= user.firstname %>', - text: `Welcome to mywebsite.fr! - Your account is now linked with: <%= user.email %>.`, - html: `

Welcome to mywebsite.fr!

-

Your account is now linked with: <%= user.email %>.

`, -}; - -await strapi.plugins['email'].services.email.sendTemplatedEmail( - { - to: user.email, - // from: is not specified, the defaultFrom is used. - }, - emailTemplate, - { - user: _.pick(user, ['username', 'email', 'firstname', 'lastname']), - } -); -``` - -## Sending emails from a lifecycle hook - - To trigger an email based on administrator actions in the admin panel use [lifecycle hooks](/dev-docs/backend-customization/models#lifecycle-hooks) and the [`send()` function](#using-the-send-function). For example, to send an email each time a new content entry is added in the Content Manager use the `afterCreate` lifecycle hook: - - - - - -```js title="./src/api/{api-name}/content-types/{content-type-name}/lifecycles.js" - -module.exports = { - async afterCreate(event) { // Connected to "Save" button in admin panel - const { result } = event; - - try{ - await strapi.plugin('email').service('email').send({ // you could also do: await strapi.service('plugin:email.email').send({ - to: 'valid email address', - from: 'your verified email address', // e.g. single sender verification in SendGrid - cc: 'valid email address', - bcc: 'valid email address', - replyTo: 'valid email address', - subject: 'The Strapi Email plugin worked successfully', - text: '${fieldName}', // Replace with a valid field ID - html: 'Hello world!', - - }) - } catch(err) { - console.log(err); - } - } -} -``` - - - - - -```ts title="./src/api/{api-name}/content-types/{content-type-name}/lifecycles.js" - -export default { - async afterCreate(event) { // Connected to "Save" button in admin panel - const { result } = event; - - try{ - await strapi.plugins['email'].services.email.send({ - to: 'valid email address', - from: 'your verified email address', // e.g. single sender verification in SendGrid - cc: 'valid email address', - bcc: 'valid email address', - replyTo: 'valid email address', - subject: 'The Strapi Email plugin worked successfully', - text: '${fieldName}', // Replace with a valid field ID - html: 'Hello world!', - - }) - } catch(err) { - console.log(err); - } - } -} - -``` - - - - diff --git a/docusaurus/docs/dev-docs/plugins/graphql.md b/docusaurus/docs/dev-docs/plugins/graphql.md index 8c74445686..5e916b1004 100644 --- a/docusaurus/docs/dev-docs/plugins/graphql.md +++ b/docusaurus/docs/dev-docs/plugins/graphql.md @@ -1,7 +1,7 @@ --- title: GraphQL plugin displayed_sidebar: cmsSidebar -toc_max_heading_level: 5 +toc_max_heading_level: 6 description: Use a GraphQL endpoint in your Strapi project to fetch and mutate your content. tags: - admin panel @@ -17,35 +17,39 @@ tags: --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # GraphQL plugin - - -By default Strapi create [REST endpoints](/dev-docs/api/rest#endpoints) for each of your content-types. With the GraphQL plugin, you will be able to add a GraphQL endpoint to fetch and mutate your content. +By default Strapi create [REST endpoints](/dev-docs/api/rest#endpoints) for each of your content-types. The GraphQL plugin adds a GraphQL endpoint to fetch and mutate your content. With the GraphQL plugin installed, you can use the Apollo Server-based GraphQL Playground to interactively build your queries and mutations and read documentation tailored to your content types. -:::strapi Looking for the GraphQL API documentation? -The [GraphQL API reference](/dev-docs/api/graphql) describes queries, mutations and parameters you can use to interact with your API using Strapi's GraphQL plugin. +:::prerequisites Identity Card of the Plugin + **Location:** Usable via the admin panel. Configured through both admin panel and server code, with different sets of options.
+ **Package name:** `@strapi/plugin-graphql`
+ **Additional resources:** [Strapi Marketplace page](https://market.strapi.io/plugins/@strapi-plugin-graphql)
::: -## Usage + -To get started with GraphQL in your application, please install the plugin first. To do that, open your terminal and run the following command: +## Installation - +To install the GraphQL plugin, run the following command in your terminal: - + + -```bash +```sh yarn add @strapi/plugin-graphql ``` + - - -```bash +```sh npm install @strapi/plugin-graphql ``` @@ -53,27 +57,37 @@ npm install @strapi/plugin-graphql -Then, start your app and open your browser at [http://localhost:1337/graphql](http://localhost:1337/graphql). You should now be able to access the **GraphQL Playground** that will help you to write your GraphQL queries and mutations. +Once installed, the GraphQL playground is accessible at the `/graphql` URL and can be used to interactively build your queries and mutations and read documentation tailored to your content-types. -:::note -The GraphQL Playground is enabled by default for both the development and staging environments, but disabled in production environments. Set the `playgroundAlways` configuration option to `true` to also enable the GraphQL Playground in production environments (see [plugins configuration documentation](/dev-docs/configurations/plugins#graphql)). -::: +Once the plugin is installed, the **GraphQL Playground** is accessible at the `/graphql` route (e.g., [localhost:1337/graphql](http://localhost:1337/graphql)) when your Strapi application server is running. ## Configuration +Most configuration options for the Documentation plugin are handled via your Strapi project's code, though the GraphQL playground also offers some non-specific Strapi settings. + +### Admin panel settings + +The Strapi admin panel does not provide Strapi-specific settings for the GraphQL plugin. However, the GraphQL Playground accessible at the `/graphql` route is an embedded Apollo Server playground, so it includes all configuration and settings available with such an instance. Please refer to the official [GraphQL playground documentation](https://www.apollographql.com/docs/apollo-server/v2/testing/graphql-playground) for details. + +### Code-based configuration + Plugins configuration are defined in the `config/plugins.js` file. This configuration file can include a `graphql.config` object to define specific configurations for the GraphQL plugin (see [plugins configuration documentation](/dev-docs/configurations/plugins#graphql)). -[Apollo Server](https://www.apollographql.com/docs/apollo-server/api/apollo-server/#apolloserver) options can be set with the `graphql.config.apolloServer` [configuration object](/dev-docs/configurations/plugins#graphql). Apollo Server options can be used for instance to enable the [tracing feature](https://www.apollographql.com/docs/federation/metrics/), which is supported by the GraphQL playground to track the response time of each part of your query. From `Apollo Server` version 3.9 default cache option is `cache: 'bounded'`. You can change it in the `apolloServer` configuration. For more information visit [Apollo Server Docs](https://www.apollographql.com/docs/apollo-server/performance/cache-backends/). +Apollo Server options can be set with the `graphql.config.apolloServer` [configuration object](/dev-docs/configurations/plugins#graphql). Apollo Server options can be used for instance to enable the [tracing feature](https://www.apollographql.com/docs/federation/metrics/), which is supported by the GraphQL playground to track the response time of each part of your query. From `Apollo Server` version 3.9 default cache option is `cache: 'bounded'`. You can change it in the `apolloServer` configuration (for details, see [Apollo Server Docs](https://www.apollographql.com/docs/apollo-server/performance/cache-backends/)). :::caution The maximum number of items returned by the response is limited to 100 by default. This value can be changed using the `amountLimit` configuration option, but should only be changed after careful consideration: a large query can cause a DDoS (Distributed Denial of Service) and may cause abnormal load on your Strapi server, as well as your database server. ::: +:::note +The GraphQL Playground is enabled by default for both the development and staging environments, but disabled in production environments. Set the `playgroundAlways` configuration option to `true` to also enable the GraphQL Playground in production environments (see [plugins configuration documentation](/dev-docs/configurations/plugins#graphql)). +::: + -```js title="./config/plugins.js" +```js title="/config/plugins.js" module.exports = { // @@ -96,7 +110,7 @@ module.exports = { -```ts title="./config/plugins.ts" +```ts title="/config/plugins.ts" export default { // @@ -119,7 +133,7 @@ export default { -## Shadow CRUD +#### Shadow CRUD To simplify and automate the build of the GraphQL schema, we introduced the Shadow CRUD feature. It automatically generates the type definitions, queries, mutations and resolvers based on your models. @@ -127,7 +141,7 @@ To simplify and automate the build of the GraphQL schema, we introduced the Shad If you've generated an API called `Document` using [the interactive `strapi generate` CLI](/dev-docs/cli#strapi-generate) or the administration panel, your model looks like this: -```json title="./src/api/[api-name]/content-types/document/schema.json" +```json title="/src/api/[api-name]/content-types/document/schema.json" { "kind": "collectionType", @@ -230,7 +244,7 @@ type Mutation {

-## Customization +#### Customization Strapi provides a programmatic API to customize GraphQL, which allows: @@ -245,7 +259,7 @@ Strapi provides a programmatic API to customize GraphQL, which allows: -```js title="./src/index.js" +```js title="/src/index.js" module.exports = { /** @@ -311,7 +325,7 @@ module.exports = { -```ts title="./src/index.ts" +```ts title="/src/index.ts" export default { /** @@ -377,11 +391,9 @@ export default { - -
-### Disabling operations in the Shadow CRUD +##### Disabling operations in the Shadow CRUD The `extension` [service](/dev-docs/backend-customization/services) provided with the GraphQL plugin exposes functions that can be used to disable operations on Content-Types: @@ -421,7 +433,7 @@ strapi .disable() ``` -### Using getters +##### Using getters The following getters can be used to retrieve information about operations allowed on content-types: @@ -446,7 +458,7 @@ The following getters can be used to retrieve information about operations allow | `hasOutputEnabled()` | Returns whether a field has output enabled | | `hasFiltersEnabled()` | Returns whether a field has filtering enabled | -### Extending the schema +###### Extending the schema The schema generated by the Content API can be extended by registering an extension. @@ -472,7 +484,7 @@ The `types` and `plugins` parameters are based on [Nexus](https://nexusjs.org/). -```js title="./src/index.js" +```js title="/src/index.js" module.exports = { register({ strapi }) { @@ -527,7 +539,7 @@ export default {
::: -#### Custom configuration for resolvers +###### Custom configuration for resolvers A resolver is a GraphQL query or mutation handler (i.e. a function, or a collection of functions, that generate(s) a response for a GraphQL query or mutation). Each field has a default resolver. @@ -537,7 +549,7 @@ When [extending the GraphQL schema](#extending-the-schema), the `resolversConfig * [policies with the `policies`](#policies) key * and [middlewares with the `middlewares`](#middlewares) key -##### Authorization configuration +###### Authorization configuration By default, the authorization of a GraphQL request is handled by the registered authorization strategy that can be either [API token](/dev-docs/configurations/api-tokens) or through the [Users & Permissions plugin](#usage-with-the-users--permissions-plugin). The Users & Permissions plugin offers a more granular control. @@ -565,7 +577,7 @@ To change how the authorization is configured, use the resolver configuration de -```js title="./src/index.js" +```js title="/src/index.js" module.exports = { register({ strapi }) { @@ -602,7 +614,7 @@ module.exports = { -```ts title="./src/index.ts" +```ts title="/src/index.ts" export default { register({ strapi }) { @@ -640,7 +652,7 @@ export default {
-##### Policies +###### Policies [Policies](/dev-docs/backend-customization/policies) can be applied to a GraphQL resolver through the `resolversConfig.[MyResolverName].policies` key. @@ -659,7 +671,7 @@ The `context` object gives access to: -```js title="./src/index.js" +```js title="/src/index.js" module.exports = { register({ strapi }) { @@ -699,7 +711,7 @@ module.exports = { -```ts title="./src/index.ts" +```ts title="/src/index.ts" export default { register({ strapi }) { @@ -741,7 +753,7 @@ export default {
-##### Middlewares +###### Middlewares [Middlewares](/dev-docs/backend-customization/middlewares) can be applied to a GraphQL resolver through the `resolversConfig.[MyResolverName].middlewares` key. The only difference between the GraphQL and REST implementations is that the `config` key becomes `options`. @@ -760,7 +772,7 @@ Middlewares with GraphQL can even act on nested resolvers, which offer a more gr -```js title"./src/index.js" +```js title"/src/index.js" module.exports = { register({ strapi }) { @@ -827,7 +839,7 @@ module.exports = { -```ts title"./src/index.ts" +```ts title"/src/index.ts" export default { register({ strapi }) { @@ -897,11 +909,32 @@ export default {
-## Usage with the Users & Permissions plugin +##### Security + +GraphQL is a query language allowing users to use a broader panel of inputs than traditional REST APIs. GraphQL APIs are inherently prone to security risks, such as credential leakage and denial of service attacks, that can be reduced by taking appropriate precautions. + +###### Disable introspection and playground in production + +In production environments, disabling the GraphQL Playground and the introspection query is recommended. +If you haven't edited the [configuration file](/dev-docs/configurations/plugins#graphql), it is already disabled in production by default. + +###### Limit max depth and complexity + +A malicious user could send a query with a very high depth, which could overload your server. Use the `depthLimit` [configuration parameter](/dev-docs/configurations/plugins#graphql) to limit the maximum number of nested fields that can be queried in a single request. By default, `depthLimit` is set to 10 but can be set to a higher value during testing and development. + +:::tip +To increase GraphQL security even further, 3rd-party tools can be used. See the guide about [using GraphQL Armor with Strapi on the forum](https://forum.strapi.io/t/use-graphql-armor-with-strapi/). +::: + +## Usage + +The GraphQL plugin adds a GraphQL endpoint accessible and provides access to a GraphQL playground, accessing at the `/graphql` route of the Strapi admin panel, to interactively build your queries and mutations and read documentation tailored to your content types. For detailed instructions on how to use the GraphQL Playground, please refer to the official [Apollo Server documentation](https://www.apollographql.com/docs/apollo-server/v2/testing/graphql-playground). + +### Usage with the Users & Permissions plugin The [Users & Permissions plugin](/dev-docs/plugins/users-permissions) is an optional plugin that allows protecting the API with a full authentication process. -### Registration +#### Registration Usually you need to sign up or register before being recognized as a user then perform authorized requests. @@ -924,7 +957,7 @@ mutation { You should see a new user is created in the `Users` collection type in your Strapi admin panel. -### Authentication +#### Authentication To perform authorized requests, you must first get a JWT: @@ -942,8 +975,7 @@ mutation { Then on each request, send along an `Authorization` header in the form of `{ "Authorization": "Bearer YOUR_JWT_GOES_HERE" }`. This can be set in the HTTP Headers section of your GraphQL Playground. - -## API tokens +#### Usage with API tokens To use API tokens for authentication, pass the token in the `Authorization` header using the format `Bearer your-api-token`. @@ -959,20 +991,10 @@ Using API tokens in the the GraphQL playground requires adding the authorization Replace `` with your API token generated in the Strapi Admin panel. ::: -## Security - -GraphQL is a query language allowing users to use a broader panel of inputs than traditional REST APIs. GraphQL APIs are inherently prone to security risks, such as credential leakage and denial of service attacks, that can be reduced by taking appropriate precautions. - +### GraphQL API -### Disable introspection and playground in production - -In production environments, disabling the GraphQL Playground and the introspection query is recommended. -If you haven't edited the [configuration file](/dev-docs/configurations/plugins#graphql), it is already disabled in production by default. +The GraphQL plugin adds a GraphQL endpoint that can accessed through Strapi's GraphQL API: -### Limit max depth and complexity - -A malicious user could send a query with a very high depth, which could overload your server. Use the `depthLimit` [configuration parameter](/dev-docs/configurations/plugins#graphql) to limit the maximum number of nested fields that can be queried in a single request. By default, `depthLimit` is set to 10 but can be set to a higher value during testing and development. - -:::tip -To increase GraphQL security even further, 3rd-party tools can be used. See the guide about [using GraphQL Armor with Strapi on the forum](https://forum.strapi.io/t/use-graphql-armor-with-strapi/). -::: + + + diff --git a/docusaurus/docs/dev-docs/plugins/sentry.md b/docusaurus/docs/dev-docs/plugins/sentry.md index 261e84de98..93bfd618e2 100644 --- a/docusaurus/docs/dev-docs/plugins/sentry.md +++ b/docusaurus/docs/dev-docs/plugins/sentry.md @@ -10,16 +10,20 @@ tags: # Sentry plugin -This plugin enables you to track errors in your Strapi application using [Sentry](https://sentry.io/welcome/). +This plugin enables you to track errors in your Strapi application using Sentry. + +:::prerequisites Identity Card of the Plugin + **Location:** Only usable and configurable via server code.
+ **Package name:** `@strapi/plugin-sentry`
+ **Additional resources:** [Strapi Marketplace page](https://market.strapi.io/plugins/@strapi-plugin-sentry), [Sentry page](https://sentry.io/)
+::: By using the Sentry plugin you can: * Initialize a Sentry instance upon startup of a Strapi application * Send Strapi application errors as events to Sentry * Include additional metadata in Sentry events to assist in debugging -* Expose a [global Sentry service](#global-sentry-service-access) - -Begin by first [installing](#installation) the Sentry plugin, and then [configuring](#configuration) the plugin to enable your Strapi application to send events to the Sentry instance. +* Expose a global Sentry service usable by the Strapi server ## Installation @@ -47,21 +51,21 @@ npm install @strapi/plugin-sentry ## Configuration -Create or edit your `./config/plugins.js` file to configure the Sentry plugin. The following properties are available: +Create or edit your `/config/plugins` file to configure the Sentry plugin. The following properties are available: | Property | Type | Default Value | Description | | -------- | ---- | ------------- |------------ | | `dsn` | string | `null` | Your Sentry [data source name](https://docs.sentry.io/product/sentry-basics/dsn-explainer/). | -| `sendMetadata` | boolean | `true` | Whether the plugin should attach additional information (e.g. OS, browser, etc.) to the events sent to Sentry. | -| `init` | object | `{}` | A config object that is passed directly to Sentry during initialization. See the official [Sentry documentation](https://docs.sentry.io/platforms/node/configuration/options/) for all available options. | +| `sendMetadata` | boolean | `true` | Whether the plugin should attach additional information (e.g., OS, browser, etc.) to the events sent to Sentry. | +| `init` | object | `{}` | A config object that is passed directly to Sentry during initialization (see official [Sentry documentation](https://docs.sentry.io/platforms/node/configuration/options/) for available options). | -An example configuration: +The following is an example basic configuration: -```js title="./config/plugins.js" +```js title="/config/plugins.js" module.exports = ({ env }) => ({ // ... @@ -80,7 +84,7 @@ module.exports = ({ env }) => ({ -```ts title="./config/plugins.ts" +```ts title="/config/plugins.ts" export default ({ env }) => ({ // ... @@ -99,22 +103,29 @@ export default ({ env }) => ({ -### Environment configuration +### Disabling for non-production environments + +If the `dsn` property is set to a nil value (`null` or `undefined`) while `sentry.enabled` is true, the Sentry plugin will be available to use in the running Strapi instance, but the service will not actually send errors to Sentry. That allows you to write code that runs on every environment without additional checks, but only send errors to Sentry in production. + +When you start Strapi with a nil `dsn` config property, the plugin will print the following warning:
`info: @strapi/plugin-sentry is disabled because no Sentry DSN was provided` -Using the [`env` utility](/dev-docs/configurations/guides/access-cast-environment-variables), you can enable or disable the Sentry plugin based on the environment. For example, to only enable the plugin in your `production` environment: +You can make use of that by using the [`env` utility](/dev-docs/configurations/guides/access-cast-environment-variables) to set the `dsn` configuration property depending on the environment. -```js title="config/plugins.js" - +```js title="/config/plugins.js" module.exports = ({ env }) => ({ - // ... + // … sentry: { - enabled: env('NODE_ENV') === 'production', + enabled: true, + config: { + // Only set `dsn` property in production + dsn: env('NODE_ENV') === 'production' ? env('SENTRY_DSN') : null, + }, }, - // ... + // … }); ``` @@ -122,14 +133,17 @@ module.exports = ({ env }) => ({ -```ts title="./config/plugins.ts" - +```ts title="/config/plugins.ts" export default ({ env }) => ({ - // ... + // … sentry: { - enabled: env('NODE_ENV') === 'production', + enabled: true, + config: { + // Only set `dsn` property in production + dsn: env('NODE_ENV') === 'production' ? env('SENTRY_DSN') : null, + }, }, - // ... + // … }); ``` @@ -137,7 +151,42 @@ export default ({ env }) => ({ -## Global Sentry service access +### Disabling the plugin completely + +Like every other Strapi plugin, you can also disable this plugin in the plugins configuration file. This will cause `strapi.plugins('sentry')` to return `undefined`: + + + + + +```js title="/config/plugins.js" +module.exports = ({ env }) => ({ + // … + sentry: { + enabled: false, + }, + // … +}); +``` + + + + + +```ts title="/config/plugins.ts" +export default ({ env }) => ({ + // … + sentry: { + enabled: false, + }, + // … +}); +``` + + + + +## Usage After installing and configuring the plugin, you can access a Sentry service in your Strapi application as follows: @@ -150,14 +199,9 @@ This service exposes the following methods: | Method | Description | Parameters | | ------ | ----------- | ---------- | | `sendError()` | Manually send errors to Sentry. |
  • error: The error to be sent.
  • configureScope: Optional. Enables you to customize the error event.
See the official [Sentry documentation](https://docs.sentry.io/platforms/node/enriching-events/scopes/#configuring-the-scope) for more details. | -| `getInstance()` | Used for direct access to the Sentry instance. | | - - -Below are examples for each method. +| `getInstance()` | Used for direct access to the Sentry instance. | - | - - - +The `sendError()` method can be used as follows: ```js try { @@ -181,9 +225,7 @@ try { } ``` - - - +The `getInstance()` method is accessible as follows: ```js const sentryInstance = strapi @@ -191,6 +233,3 @@ const sentryInstance = strapi .service('sentry') .getInstance(); ``` - - - diff --git a/docusaurus/docs/dev-docs/plugins/upload.md b/docusaurus/docs/dev-docs/plugins/upload.md index 01ca4c6c0d..21a0263e8a 100644 --- a/docusaurus/docs/dev-docs/plugins/upload.md +++ b/docusaurus/docs/dev-docs/plugins/upload.md @@ -11,12 +11,8 @@ tags: --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Upload plugin - - The Upload plugin is the backend powering the Media Library available by default in the Strapi admin panel. The Upload plugin is installed by default and can not be uninstalled. Using either the Media Library from the admin panel or the upload API directly, you can upload any kind of file for use in your Strapi application. By default Strapi provides a [provider](/dev-docs/providers) that uploads files to a local directory, which by default will be `public/uploads/` in your Strapi project. Additional providers are available should you want to upload your files to another location. diff --git a/docusaurus/docs/dev-docs/plugins/users-permissions.md b/docusaurus/docs/dev-docs/plugins/users-permissions.md index 2e5f919c38..e69de29bb2 100644 --- a/docusaurus/docs/dev-docs/plugins/users-permissions.md +++ b/docusaurus/docs/dev-docs/plugins/users-permissions.md @@ -1,1356 +0,0 @@ ---- -title: Users & Permissions plugin -displayed_sidebar: cmsSidebar -toc_max_heading_level: 5 -description: Protect your API with a full authentication process based on JWT and manage the permissions between the groups of users. -tags: -- authenticated role -- JSON Web Tokens (JWT) -- JWT configuration -- keycloak -- ngrok -- plugins -- provider -- public role -- password -- Users, Roles & Permissions ---- - -# Users & Permissions plugin - -The Users & Permissions plugin provides a full authentication process based on [JSON Web Tokens (JWT)](https://en.wikipedia.org/wiki/JSON_Web_Token) to protect your API, and an access-control list (ACL) strategy that enables you to manage permissions between groups of users. The Users & Permissions plugin is installed by default and can not be uninstalled. - -The user guide describes how to use the [Users & Permissions plugin](/user-docs/users-roles-permissions) from the admin panel. The present page is more about the developer-related aspects of using the Users & Permissions plugin. - -## Concept - -The Users & Permissions plugin adds an access layer to your application. -The plugin uses `JWTs` to authenticate users. Your JWT contains your user ID, which is matched to the group your user is in and used to determine whether to allow access to the route. - -Each time an API request is sent the server checks if an `Authorization` header is present and verifies if the user making the request has access to the resource. - -## Manage role permissions - -### Public role - -This is the default role used when the server receives a request without an `Authorization` header. Any permissions (i.e. accessible endpoints) granted to this role will be accessible by anyone. - -It is common practice to select `find` / `findOne` endpoints when you want your front-end application to access all the content without requiring user authentication and authorization. - -### Authenticated role - -This is the default role that is given to every **new user** at creation if no role is provided. In this role you define routes that a user can access. - -### Permissions management - -By clicking on the **Role** name, you can see all functions available in your application (with these functions related to the specific route displayed). - -If you check a function name, it makes this route accessible by the current role you are editing. On the right sidebar you can see the URL related to this function. - -### Update the default role - -When you create a user without a role, or if you use the `/api/auth/local/register` route, the `authenticated` role is given to the user. - -To change the default role, go to the `Advanced settings` tab and update the `Default role for authenticated users` option. - -## Authentication - -### Login - -Submit the user's identifier and password credentials for authentication. On successful authentication the response data will have the user's information along with an authentication token. - -#### Local - -The `identifier` param can be an **email** or **username**. - - - - - -```js -import axios from 'axios'; - -// Request API. -axios - .post('http://localhost:1337/api/auth/local', { - identifier: 'user@strapi.io', - password: 'strapiPassword', - }) - .then(response => { - // Handle success. - console.log('Well done!'); - console.log('User profile', response.data.user); - console.log('User token', response.data.jwt); - }) - .catch(error => { - // Handle error. - console.log('An error occurred:', error.response); - }); -``` - - - - - -If you use **Postman**, set the **body** to **raw** and select **JSON** as your data format: - -```json -{ - "identifier": "user@strapi.io", - "password": "strapiPassword" -} -``` - -If the request is successful you will receive the **user's JWT** in the `jwt` key: - -```json -{ - "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTc2OTM4MTUwLCJleHAiOjE1Nzk1MzAxNTB9.UgsjjXkAZ-anD257BF7y1hbjuY3ogNceKfTAQtzDEsU", - "user": { - "id": 1, - "username": "user", - ... - } -} -``` - - - - -### Token usage - -The `jwt` may then be used for making permission-restricted API requests. To make an API request as a user place the JWT into an `Authorization` header of the `GET` request. - -Any request without a token will assume the `public` role permissions by default. Modify the permissions of each user's role in the admin dashboard. - -Authentication failures return a `401 (unauthorized)` error. - -#### Usage - -The `token` variable is the `data.jwt` received when logging in or registering. - -```js -import axios from 'axios'; - -const token = 'YOUR_TOKEN_HERE'; - -// Request API. -axios - .get('http://localhost:1337/posts', { - headers: { - Authorization: `Bearer ${token}`, - }, - }) - .then(response => { - // Handle success. - console.log('Data: ', response.data); - }) - .catch(error => { - // Handle error. - console.log('An error occurred:', error.response); - }); -``` - -### JWT configuration - -You can configure the JWT generation by using the [plugins configuration file](/dev-docs/configurations/plugins). - -Strapi uses [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken) to generate the JWT. - -Available options: - -- `jwtSecret`: random string used to create new JWTs, typically set using the `JWT_SECRET` [environment variable](/dev-docs/configurations/environment#strapi). -- `jwt.expiresIn`: expressed in seconds or a string describing a time span.
- Eg: 60, "45m", "10h", "2 days", "7d", "2y". A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (minutes, hours, days, years, etc), otherwise milliseconds unit is used by default ("120" is equal to "120ms"). - - - - - -```js title="./config/plugins.js" - -module.exports = ({ env }) => ({ - // ... - 'users-permissions': { - config: { - jwt: { - expiresIn: '7d', - }, - }, - }, - // ... -}); -``` - - - - - -```ts title="./config/plugins.ts" - -export default ({ env }) => ({ - // ... - 'users-permissions': { - config: { - jwt: { - expiresIn: '7d', - }, - }, - }, - // ... -}); -``` - - - - - -:::warning -Setting JWT expiry for more than 30 days is **not recommended** due to security concerns. -::: - -### Registration - -#### Configuration - -If you have added any additional fields to your user model that need to be accepted on registration, they need to be added to the list of allowed fields in the `register` configuration option, otherwise they will not be accepted. - -For example, if you have added a field called "nickname" that you wish to accept from the API on user registration: - - - - - -```js title="./config/plugins.js" -module.exports = ({ env }) => ({ - // ... - "users-permissions": { - config: { - register: { - allowedFields: ["nickname"], - }, - }, - }, - // ... -}); -``` - - - - - -```ts title="./config/plugins.ts" -export default ({ env }) => ({ - // ... - "users-permissions": { - config: { - register: { - allowedFields: ["nickname"], - }, - }, - }, - // ... -}); -``` - - - - - - -#### Usage - -Creates a new user in the database with a default role as 'registered'. - -```js -import axios from 'axios'; - -// Request API. -// Add your own code here to customize or restrict how the public can register new users. -axios - .post('http://localhost:1337/api/auth/local/register', { - username: 'Strapi user', - email: 'user@strapi.io', - password: 'strapiPassword', - }) - .then(response => { - // Handle success. - console.log('Well done!'); - console.log('User profile', response.data.user); - console.log('User token', response.data.jwt); - }) - .catch(error => { - // Handle error. - console.log('An error occurred:', error.response); - }); -``` - -### Providers - - [Grant](https://github.com/simov/grant) and [Purest](https://github.com/simov/purest) allow you to use OAuth and OAuth2 providers to enable authentication in your application. - -For a better understanding, review the following description of the login flow. The example uses `github` as the provider but it works the same for other providers. - -#### Understanding the login flow - -Let's say that: -* Strapi's backend is located at: `strapi.website.com`, and -* Your app frontend is located at: `website.com` - -1. The user goes on your frontend app (`https://website.com`) and clicks on your button `connect with Github`. -2. The frontend redirects the tab to the backend URL: `https://strapi.website.com/api/connect/github`. -3. The backend redirects the tab to the GitHub login page where the user logs in. -4. Once done, Github redirects the tab to the backend URL:`https://strapi.website.com/api/connect/github/callback?code=abcdef`. -5. The backend uses the given `code` to get an `access_token` from Github that can be used for a period of time to make authorized requests to Github to get the user info. -6. Then, the backend redirects the tab to the url of your choice with the param `access_token` (example: `http://website.com/connect/github/redirect?access_token=eyfvg`). -7. The frontend (`http://website.com/connect/github/redirect`) calls the backend with `https://strapi.website.com/api/auth/github/callback?access_token=eyfvg` that returns the Strapi user profile with its `jwt`.
(Under the hood, the backend asks Github for the user's profile and a match is done on Github user's email address and Strapi user's email address). -8. The frontend now possesses the user's `jwt`, which means the user is connected and the frontend can make authenticated requests to the backend! - -An example of a frontend app that handles this flow can be found here: [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react). - -#### Setting up the server url - -Before setting up a provider you must specify the absolute url of your backend in `server.js`. - -**example -** `config/server.js` - - - - - -```js title="config/server.js" - -module.exports = ({ env }) => ({ - host: env('HOST', '0.0.0.0'), - port: env.int('PORT', 1337), - url: env('', 'http://localhost:1337'), -}); -``` - - - - - -```ts title="config/server.ts" - -export default ({ env }) => ({ - host: env('HOST', '0.0.0.0'), - port: env.int('PORT', 1337), - url: env('', 'http://localhost:1337'), -}); -``` - - - - - - -:::tip -Later you will give this url to your provider.
For development, some providers accept the use of localhost urls but many don't. In this case we recommend to use [ngrok](https://ngrok.com/docs) (`ngrok http 1337`) that will make a proxy tunnel from a url it created to your localhost url (ex: `url: env('', 'https://5299e8514242.ngrok.io'),`). -::: - -#### Setting up the provider - examples - -Instead of a generic explanation we decided to show an example for each provider. You can also [create your own custom provider](#creating-a-custom-provider). - -In the following examples, the frontend app will be the [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react).
-It (the frontend app) will be running on `http://localhost:3000`.
-Strapi (the backend) will be running on `http://localhost:1337`. - - - - - -

Using ngrok

- -Github doesn't accept `localhost` urls.
-Use `ngrok` to serve the backend app. - -``` -ngrok http 1337 -``` - -Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. - -

Github configuration

- -- Visit the OAuth Apps list page [https://github.com/settings/developers](https://github.com/settings/developers) -- Click on **New OAuth App** button -- Fill the information (replace with your own ngrok url): - - **Application name**: Strapi GitHub auth - - **Homepage URL**: `https://65e60559.ngrok.io` - - **Application description**: Strapi provider auth description - - **Authorization callback URL**: `https://65e60559.ngrok.io/api/connect/github/callback` - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **GitHub** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: 53de5258f8472c140917 - - **Client Secret**: fb9d0fe1d345d9ac7f83d7a1e646b37c554dae8b - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/github/redirect` - -
- - - - -

Using ngrok

- -Facebook doesn't accept `localhost` urls.
-Use `ngrok` to serve the backend app. - -``` -ngrok http 1337 -``` - -Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. - -

Facebook configuration

- -- Visit the Developer Apps list page
[https://developers.facebook.com/apps/](https://developers.facebook.com/apps/) -- Click on **Add a New App** button -- Fill the **Display Name** in the modal and create the app -- Setup a **Facebook Login** product -- Click on the **PRODUCTS > Facebook login > Settings** link in the left menu -- Fill the information and save (replace with your own ngrok url): - - **Valid OAuth Redirect URIs**: `https://65e60559.ngrok.io/api/connect/facebook/callback` -- Then, click on **Settings** in the left menu -- Then on **Basic** link -- You should see your Application ID and secret, save them for later - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Facebook** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: 2408954435875229 - - **Client Secret**: 4fe04b740b69f31ea410b9391ff3b5b0 - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/facebook/redirect` - -
- - - -

Using ngrok

- -Google accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Google configuration

- -- Visit the Google Developer Console
[https://console.developers.google.com/](https://console.developers.google.com/) -- Click on the **Select a project** dropdown in the top menu -- Then click **NEW PROJECT** button -- Fill the **Project name** input and create - -Wait a few seconds while the application is created. - -- On the project dropdown, select your new project -- Click on **Go to APIs overview** under the **APIs** card -- Then click on the **Credentials** link in the left menu -- Click on **OAuth consent screen** button -- Choose **External** and click on **create** -- Fill the **Application name** and save -- Then click on **Create credentials** button -- Choose **OAuth client ID** option -- Fill the information: - - **Name**: `Strapi Auth` - - **Authorized redirect URIs**: `http://localhost:1337/api/connect/google/callback` -- Click on **OAuth 2.0 Client IDs** name of the client you just created -- You should see your Application ID and secret, save them for later - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Google** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: 226437944084-o2mojv5i4lfnng9q8kq3jkf5v03avemk.apps.googleusercontent.com - - **Client Secret**: aiTbMoiuJQflSBy6uQrfgsni - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/google/redirect` - -
- - - -

Using ngrok

- -AWS Cognito accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

AWS Cognito configuration

- -- Visit the AWS Management Console
[https://aws.amazon.com/console/](https://aws.amazon.com/console/) -- If needed, select your **Region** in the top right corner next to the Support dropdown -- Select the **Services** dropdown in the top left corner -- Click on **Cognito** in the `Security, Identity & Compliance` section -- Then click on the **Manage User Pools** button -- If applicable either create or use an existing user pool. You will find hereafter a tutorial to create a User Pool
[https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html](https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html) -- Go to the **App clients** section in your cognito user pool and create a new client with the name `Strapi Auth` and set all the parameters and then click on **Create app client** -- You should now have an **App client id** and by clicking on the button **Show Details** you will be able to see the **App client secret**. Do copy those two values **App client id** and **App client secret** somewhere for later use when configuring the AWS Cognito provider in Strapi. -- Go to the **App integration section** and click on **App client settings** -- Look for your app client named `Strapi Auth` and enable Cognito User Pool by checking it in the **Enabled Identity Providers** section of your newly created App client -- Fill in your callback URL and Sign out URL with the value `http://localhost:1337/api/connect/cognito/callback` or the one provided by your AWS Cognito provider in Strapi -- In the **Oauth 2.0** section select `Authorization code grant` and `Implicit grant` for the **Allowed OAuth Flows** and select `email`, `openid` and `profile` for the **Allowed OAuth Scopes** -- You can now click on **Save changes** and if you have already configured your domain name then you should be able to see a link to the **Launch Hosted UI**. You can click on it in order to display the AWS Cognito login page. In case you haven't yet configured your domain name, use the link **Choose domain name** at the bottom right of the page in order to configure your domain name. On that page you will have an `Amazon Cognito Domain` section where a `Domain prefix` is already setup. Type a domain prefix to use for the sign-up and sign-in pages that are hosted by Amazon Cognito, this domain prefix together with the `.auth.YOUR_REGION.amazoncognito.com` will be the **Host URI (Subdomain)** value for your strapi configuration later on. - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Cognito** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: fill in the **App client id** (`5bd7a786qdupjmi0b3s10vegdt`) - - **Client Secret**: fill in the **App client secret** (`19c5c78dsfsdfssfsdfhpdb4nkpb145vesdfdsfsffgh7vwd6g45jlipbpb`) - - **Host URI (Subdomain)**: fill in the URL value that you copied earlier (`myapp67b50345-67b50b17-local.auth.eu-central-1.amazoncognito.com`) - - **The redirect URL to your front-end app**: if you are using strapi react-login [https://github.com/strapi/strapi-examples/tree/master/examples/login-react/](https://github.com/strapi/strapi-examples/tree/master/examples/login-react/) use `http://localhost:3000/connect/cognito/redirect` but if you do not yet have a front-end app to test your Cognito configuration you can then use the following URL `http://localhost:1337/api/auth/cognito/callback` - -
- - - -

Using ngrok

- -Twitter doesn't accept `localhost` urls.
-Use `ngrok` to serve the backend app. - -``` -ngrok http 1337 -``` - -Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok url. - -

Twitter configuration

- -- Visit the Apps list page
[https://developer.twitter.com/en/apps](https://developer.twitter.com/en/apps) -- Click on **Create an app** button -- Fill the information (replace with your own ngrok url): - - **App name**: Strapi Twitter auth - - **Application description**: This is a demo app for Strapi auth - - **Tell us how this app will be used**: - here write a message enough long - -- At the end of the process you should see your Application ID and secret, save them for later -- Go to you app setting and click on edit **Authentication settings** -- Enable **3rd party authentication** AND **Request email address from users** -- Fill the information (replace with your own ngrok url): - - **Callback URLs**: `https://65e60559.ngrok.io/api/connect/twitter/callback` - - **Website URL**: `https://65e60559.ngrok.io` - - **Privacy policy**: `https://d73e70e88872.ngrok.io` - - **Terms of service**: `https://d73e70e88872.ngrok.io` - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Twitter** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **API Key**: yfN4ycGGmKXiS1njtIYxuN5IH - - **Api Secret**: Nag1en8S4VwqurBvlW5OaFyKlzqrXFeyWhph6CZlpGA2V3VR3T - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/twitter/redirect` - -
- - - -

Using ngrok

- -Discord accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Discord configuration

- -- Visit the Apps list page on the developer portal
[https://discordapp.com/developers/applications/](https://discordapp.com/developers/applications/) -- Click on **New application** button -- Fill the **name** and create -- Click on **OAuth2** in the left menu -- And click on **Add redirect** button -- Fill the **Redirect** input with `http://localhost:1337/api/connect/discord/callback` URL and save -- Click on **General information** in the left menu -- You should see your Application ID and secret, save them for later - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Discord** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: 665118465148846081 - - **Client Secret**: iJbr7mkyqyut-J2hGvvSDch_5Dw5U77J - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/discord/redirect` - -
- - - -

Using ngrok

- -Twitch accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Twitch configuration

- -- Visit the Apps list page on the developer console
[https://dev.twitch.tv/console/apps](https://dev.twitch.tv/console/apps) -- Click on **Register Your Application** button -- Fill the information: - - **Name**: Strapi auth - - **OAuth Redirect URLs**: `http://localhost:1337/api/connect/twitch/callback` - - **Category**: Choose a category -- Click on **Manage** button of your new app -- Generate a new **Client Secret** with the **New Secret** button -- You should see your Application ID and secret, save them for later - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Twitch** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: amuy279g8wt68qlht3u4gek4oykh5j - - **Client Secret**: dapssh10uo97gg2l25qufr8wen3yr6 - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/twitch/redirect` - -
- - - -

Using ngrok

- -Facebook doesn't accept `localhost` urls.
-Use `ngrok` to serve the backend app. - -``` -ngrok http 1337 -``` - -Don't forget to update the server url in the backend config file `config/server.js` and the server url in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/login-react)) with the generated ngrok url. - -

Instagram configuration

- -- Visit the Developer Apps list page
[https://developers.facebook.com/apps/](https://developers.facebook.com/apps/) -- Click on **Add a New App** button -- Fill the **Display Name** in the modal and create the app -- Setup an **Instagram** product -- Click on the **PRODUCTS > Instagram > Basic Display** link in the left menu -- Then click on the **Create new application** button (and valid the modal) -- Fill the information (replace with your own ngrok url): - - **Valid OAuth Redirect URIs**: `https://65e60559.ngrok.io/api/connect/instagram/callback` - - **Deauthorize**: `https://65e60559.ngrok.io` - - **Data Deletion Requests**: `https://65e60559.ngrok.io` -- On the **App Review for Instagram Basic Display** click on **Add to submission** for **instagram_graph_user_profile**. -- You should see your Application ID and secret, save them for later - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Instagram** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: 563883201184965 - - **Client Secret**: f5ba10a7dd78c2410ab6b8a35ab28226 - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/instagram/redirect` - -
- - - -

Using ngrok

- -VK accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

VK configuration

- -- Visit the Apps list page
[https://vk.com/apps?act=manage](https://vk.com/apps?act=manage) -- Click on **Create app** button -- Fill the information: - - **Title**: Strapi auth - - **Platform**: Choose **Website** option - - **Website address**: `http://localhost:1337` - - **Base domain**: `localhost` -- Click on the **Settings** link in the left menu -- Click on the **Open API** link to enable this option -- Fill the information: - - **Authorized redirect URL**: `http://localhost:1337/api/connect/vk/callback` - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **VK** provider -- Fill the information: - - **Enable**: `ON` - - **Client ID**: 7276416 - - **Client Secret**: cFBUSghLXGuxqnCyw1N3 - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/vk/redirect` - -
- - - -

Using ngrok

- -LinkedIn accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

LinkedIn configuration

- -- Visit the Apps list page
[https://www.linkedin.com/developers/apps](https://www.linkedin.com/developers/apps) -- Click on **Create app** button -- Fill the information: - - **App name**: Strapi auth - - **LinkedIn Page**: Enter a LinkedIn page name to associate with the app or click **Create a new LinkedIn Page** to create a new one - - **App Logo**: Upload a square image that is at least 100x100 pixels. -- Click on the **Create app** to create the app -- On the app page click on **Auth** tab -- Fill the information: - - **Authorized redirect URL**: `http://localhost:1337/api/connect/linkedin/callback` -- On the app page click on **Products** tab. -- Select `Sign In with LinkedIn` from the product list to enable it. - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **LinkedIn** provider -- Fill the information: - - **Enable**: `ON` - - **Client ID**: 84witsxk641rlv - - **Client Secret**: HdXO7a7mkrU5a6WN - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/linkedin/redirect` - -
- - - -

Using ngrok

- -A remote CAS server can be configured to accept `localhost` URLs or you can run your own CAS server locally that accepts them. - -The use of `ngrok` is not needed. - -

CAS configuration

- -- [CAS](https://github.com/apereo/cas) is an SSO server that supports many different methods of verifying a users identity, - retrieving attributes out the user and communicating that information to applications via protocols such as SAML, OIDC, and the CAS protocol. Strapi can use a CAS server for authentication if CAS is deployed with support for OIDC. -- [CAS](https://github.com/apereo/cas) could already be used by your company or organization or you can setup a local CAS server by cloning the [CAS Overlay](https://github.com/apereo/cas-overlay-template) project or using the newer [CAS Initializr](https://github.com/apereo/cas-initializr) to create an overlay project. -- The CAS server must be configured so it can act as an [OpenID Connect Provider](https://apereo.github.io/cas/6.6.x/installation/OIDC-Authentication.html) -- CAS version 6.3.x and higher is known to work with Strapi but older versions that support OIDC may work. -- Define a CAS OIDC service for Strapi and store it in whichever CAS service registry is being used. -- The CAS service definition might look something like this for a local strapi deployment: - -```json -{ - "@class": "org.apereo.cas.services.OidcRegisteredService", - "clientId": "thestrapiclientid", - "clientSecret": "thestrapiclientsecret", - "bypassApprovalPrompt": true, - "serviceId": "^http(|s)://localhost:1337/.*", - "name": "Local Strapi", - "id": 20201103, - "evaluationOrder": 50, - "attributeReleasePolicy": { - "@class": "org.apereo.cas.services.ReturnMappedAttributeReleasePolicy", - "allowedAttributes": { - "@class": "java.util.TreeMap", - "strapiemail": "groovy { return attributes['mail'].get(0) }", - "strapiusername": "groovy { return attributes['username'].get(0) }" - } - } -} -``` - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/plugins/users-permissions/providers](http://localhost:1337/admin/plugins/users-permissions/providers) -- Click on the **Cas** provider -- Fill the information: - - **Enable**: `ON` - - **Client ID**: thestrapiclientid - - **Client Secret**: thestrapiclientsecret - - **The redirect URL to your front-end app**: `http://localhost:1337/api/connect/cas/redirect` - - **The Provider Subdomain such that the following URLs are correct for the CAS deployment you are targeting:** - ``` - authorize_url: https://[subdomain]/oidc/authorize - access_url: https://[subdomain]/oidc/token - profile_url: https://[subdomain]/oidc/profile - ``` - For example, if running CAS locally with a login URL of: `https://localhost:8443/cas/login`, the value for the provider subdomain would be `localhost:8443/cas`. - -
- - - -

Using ngrok

- -Reddit accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Reddit configuration

- -- Visit the Reddit authorized applications preferences page
[https://www.reddit.com/prefs/apps](https://www.reddit.com/prefs/apps) -- Click on the **create another app...** button near the bottom -- Select **web app** for the type -- Fill the **name** and **redirect uri** input in -- Click the **create app** button -- Note that the **Client ID** is located under the app type (web app) - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Reddit** provider -- Fill the information (replace with your own client ID and secret): - - **Enable**: `ON` - - **Client ID**: hmxSBOit0SCjSQ - - **Client Secret**: gwR9hCjK_PMYVYNGeDLS4WLB8g7xqg - - **The redirect URL to your front-end app**: `http://localhost:3000/connect/reddit/redirect` - -
- - - -

Using ngrok

- -Auth0 accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Auth0 configuration

- -- Visit your Auth0 tenant dashboard -- In API section, create a new API -- In application, create a `machine-to-machine` application and select the API that you have just created -- In settings of this app set these values: - - **Allowed Callback URLs**: `http://localhost:1337/api/connect/auth0/callback` - - **Allowed Logout URLs**: `http://localhost:3000` - - **Allowed Web Origins**: `http://localhost:3000` -- At the bottom of settings, show "Advanced Settings" and go to the "Grant Types". Ensure that these grants are checked/enabled: - - Implicit - - Authorization Code - - Refresh Token - - Client Credentials - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Auth0** provider -- Fill the information: - - Enable: `ON` - - Client ID: `` - - Client Secret: `` - - Subdomain: ``, example it is the part in bold in the following url: https://**my-tenant.eu**.auth0.com/ - - The redirect URL to your front-end app: `http://localhost:3000/connect/auth0` - -
- - - -

Using ngrok

- -Patreon does not accept `localhost` urls.
-Use `ngrok` to serve the backend app. - -```bash -ngrok http 1337 -``` - -Don't forget to update the server url in the Strapi config file `./config/server.js` and the server URL in your frontend app (environment variable `REACT_APP_BACKEND_URL` if you use [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react)) with the generated ngrok URL. - -

Patreon configuration

- -- You must be a Patreon Creator in order to register an Oauth client. -- Go to the [Patreon developer portal](https://www.patreon.com/portal) -- Click on [Clients & API Keys](https://www.patreon.com/portal/registration/register-clients) -- Click on "Create Client" -- Enter the details of your organization and website. -- There is a drop-down for "App Category" but no explanation of what the different categories mean. -"Community" seems to work fine. -- You can choose either version 1 or version 2 of the API - neither are actively developed. -Version 2 is probably the best choice. See their -[developer docs](https://docs.patreon.com/#introduction) for more detail. -- Under "Redirect URI's" enter `https://your-site.com/api/connect/patreon/callback` -- Save the client details and you will then see the Client ID and Client Secret. - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Patreon** provider -- Fill the information: - - Enable: `ON` - - Client ID: `` - as above - - Client Secret: `` - as above - -
- - - -

Using ngrok

- -Keycloak accepts the `localhost` urls.
-The use of `ngrok` is not needed. - -

Keycloak configuration

- -- Visit your Keycloak admin dashboard -- If you don't already have a realm, you'll want to create one -- In the Clients section of your realm, create a new client -- Under the capability config, ensure you set `Client Authentication` to on to ensure you can create a private key -- Under the access settings, ensure you set the following values: - - **Valid redirect URIs**: `http://localhost:1337/api/connect/keycloak/callback` and `http://localhost:1337/api/connect/keycloak` - - **Allowed Web Origins**: `http://localhost:3000` and `http://localhost:1337` -- In the Client Scopes section, ensure you have the `email` and `profile` scopes set to default -- In the Client Scopes section, ensure you have the `openid` scope set to default, if you don't have this you will need to manually create it in the global Client Scopes - -

Strapi configuration

- -- Visit the User Permissions provider settings page
[http://localhost:1337/admin/settings/users-permissions/providers](http://localhost:1337/admin/settings/users-permissions/providers) -- Click on the **Keycloak** provider -- Fill the information: - - Enable: `ON` - - Client ID: `` - - Client Secret: `` - - Subdomain: ``, example is either `keycloak.example.com/realms/strapitest` or `keycloak.example.com/auth/realms/strapitest` **without the protocol before it** - - The redirect URL to your front-end app: `http://localhost:3000/connect/keycloak/redirect` - - (Optional) Set the JWKS URL if you have a custom JWKS URL, example is like `https://keycloak.example.com/auth/realms/strapitest/protocol/openid-connect/certs` - -
-
- -Your configuration is done. -Launch the backend and the [react login example app](https://github.com/strapi/strapi-examples/tree/master/examples/login-react), go to `http://localhost:3000` and try to connect to the provider your configured. - -##### Creating a custom provider - -You can also use the `register` lifecycle function to create your own custom provider in the `src/index.js|ts` file of your Strapi application. Use the following code example adjusted to your needs: - -```js title="/src/index.js" -module.exports = { - register({ strapi }) { - strapi - .plugin("users-permissions") - .service("providers-registry") - .add("example-provider-name", { - icon: "", - enabled: true, - grantConfig: { - key: "", - secret: "", - callback: `${strapi.config.server.url}/auth/example-provider-name/callback`, - scope: ["email"], - authorize_url: "https://awesome.com/authorize", - access_url: "https://awesome.com/token", - oauth: 2, - }, - async authCallback({ accessToken, providers, purest }) { - // use whatever you want here to get the user info - return { - username: "test", - email: "test", - }; - }, - }); - }, -}; -``` - -For additional information on parameters passed to `grantConfig`, please refer to the [`grant` documentation](https://github.com/simov/grant). For additional information about `purest` please refer to [`purest` documentation](https://github.com/simov/purest). - -#### Setup the frontend - -Once you have configured strapi and the provider, in your frontend app you have to : - -- Create a button that links to `GET STRAPI_BACKEND_URL/api/connect/${provider}` (ex: `https://strapi.mywebsite/api/connect/github`). -- Create a frontend route like `FRONTEND_URL/connect/${provider}/redirect` that have to handle the `access_token` param and that have to request `STRAPI_BACKEND_URL/api/auth/${provider}/callback` with the `access_token` parameter.
- The JSON request response will be `{ "jwt": "...", "user": {...} }`. - -Now you can make authenticated requests. More info here: [token usage](#token-usage). - -:::caution Troubleshooting - -- **Error 429**: It's most likely because your login flow fell into a loop. To make new requests to the backend, you need to wait a few minutes or restart the backend. -- **Grant: missing session or misconfigured provider**: It may be due to many things. - - **The redirect url can't be built**: Make sure you have set the backend url in `config/server.js`: [Setting up the server url](#setting-up-the-server-url) - - **A session/cookie/cache problem**: You can try again in a private tab. - - **The incorrect use of a domain with ngrok**: Check your urls and make sure that you use the ngrok url instead of `http://localhost:1337`. Don't forget to check the backend url set in the example app at `src/config.js`. -- **You can't access your admin panel**: It's most likely because you built it with the backend url set with a ngrok url and you stopped/restarted ngrok. You need to replace the backend url with the new ngrok url and run `yarn build` or `npm run build` again. -::: - -### Reset password - -**Can only be used for users registered using the email provider.** - - - - - -The assumed general flow: - -1. The user goes to your **forgotten password page**. -2. The user enters their email address. -3. Your forgotten password page sends a request to the backend to send an email with the reset password link to the user. -4. The user receives the email and clicks on the special link. -5. The link redirects the user to your **reset password page**. -6. The user enters their new password. -7. The **reset password page** sends a request to the backend with the new password. -8. If the request contains the code contained in the link at step 3, the password is updated. -9. The user can log in with the new password. - -The following section details steps 3 and 7. - -#### Forgotten password: ask for the reset password link - -This action sends an email to a user with the link to your reset password page. The link will be enriched with the url param `code` that is needed for the [reset password](#reset-password) at step 7. - -First, you must specify the following: - -- In the admin panel: **Settings > USERS & PERMISSIONS PLUGIN > Advanced Settings > Reset Password** page, the `url` to your reset password page. -- In the admin panel: **Settings > USERS & PERMISSIONS PLUGIN > Email Template** page, the **Shipper email**. - -Then, your **forgotten password page** has to make the following request to your backend: - -```js -import axios from 'axios'; - -// Request API. -axios - .post('http://localhost:1337/api/auth/forgot-password', { - email: 'user@strapi.io', // user's email - }) - .then(response => { - console.log('Your user received an email'); - }) - .catch(error => { - console.log('An error occurred:', error.response); - }); -``` - -#### Reset Password: send the new password - -This action will update the user password. -This also works with the [GraphQL Plugin](./graphql), with the `resetPassword` mutation. - -Your **reset password page** has to make the following request to your backend: - -```js -import axios from 'axios'; - -// Request API. -axios - .post('http://localhost:1337/api/auth/reset-password', { - code: 'privateCode', // code contained in the reset link of step 3. - password: 'userNewPassword', - passwordConfirmation: 'userNewPassword', - }) - .then(response => { - console.log("Your user's password has been reset."); - }) - .catch(error => { - console.log('An error occurred:', error.response); - }); -``` - - - - - -You can also update an authenticated user password through the `/change-password` API endpoint: - -```js -import axios from 'axios'; - -// Request API. -axios.post( - 'http://localhost:1337/api/auth/change-password', - { - currentPassword: 'currentPassword', - password: 'userNewPassword', - passwordConfirmation: 'userNewPassword', - }, - { - headers: { - Authorization: 'Bearer ', - }, - } -); -``` - - - - - -### Email validation - -:::note -In production, make sure the `url` config property is set. Otherwise the validation link will redirect to `localhost`. More info on the config [here](/dev-docs/configurations/server). -::: - -After registering, if you have set **Enable email confirmation** to **ON**, the user will receive a confirmation link by email. The user has to click on it to validate their registration. - -Example of the confirmation link: `https://yourwebsite.com/api/auth/email-confirmation?confirmation=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MywiaWF0IjoxNTk0OTgxMTE3LCJleHAiOjE1OTc1NzMxMTd9.0WeB-mvuguMyr4eY8CypTZDkunR--vZYzZH6h6sChFg` - -If needed you can re-send the confirmation email by making the following request: - -```js -import axios from 'axios'; - -// Request API. -axios - .post(`http://localhost:1337/api/auth/send-email-confirmation`, { - email: 'user@strapi.io', // user's email - }) - .then(response => { - console.log('Your user received an email'); - }) - .catch(error => { - console.error('An error occurred:', error.response); - }); -``` - -## User object in Strapi context - -The `user` object is available to successfully authenticated requests. - -The authenticated `user` object is a property of `ctx.state`. - -```js -create: async ctx => { - const { id } = ctx.state.user; - - const depositObj = { - ...ctx.request.body, - depositor: id, - }; - - const data = await strapi.services.deposit.add(depositObj); - - // Send 201 `created` - ctx.created(data); -}; -``` - - - -## Templating emails - -By default this plugin comes with two templates: reset password and email address confirmation. The templates use Lodash's `template()` method to populate the variables. - -You can update these templates under **Plugins** > **Roles & Permissions** > **Email Templates** tab in the admin panel. - -### Reset Password - -- `USER` (object) - - `username` - - `email` -- `TOKEN` corresponds to the token generated to be able to reset the password. -- `URL` is the link where the user will be redirected after clicking on it in the email. -- `SERVER_URL` is the absolute server url (configured in server configuration). - -### Email address confirmation - -- `USER` (object) - - `username` - - `email` -- `CODE` corresponds to the CODE generated to be able confirm the user email. -- `URL` is the Strapi backend URL that confirms the code (by default `/auth/email-confirmation`). -- `SERVER_URL` is the absolute server url (configured in server configuration). - -## Security configuration - -JWTs can be verified and trusted because the information is digitally signed. To sign a token a _secret_ is required. By default Strapi generates and stores it in `./extensions/users-permissions/config/jwt.js`. - -This is useful during development but for security reasons it is recommended to set a custom token via an environment variable `JWT_SECRET` when deploying to production. - -By default you can set a `JWT_SECRET` environment variable and it will be used as secret. If you want to use another variable you can update the configuration file. - - - - - -```js title="./extensions/users-permissions/config/jwt.js" - -module.exports = { - jwtSecret: process.env.SOME_ENV_VAR, -}; -``` - - - - - -```ts title="./extensions/users-permissions/config/jwt.ts" - -export default { - jwtSecret: process.env.SOME_ENV_VAR, -}; -``` - - - - - -:::tip -You can learn more about configuration [here](/dev-docs/configurations). -::: - -### Creating a custom callback validator - -By default, Strapi SSO only redirects to the redirect URL that is exactly equal to the url in the configuration: - - - -If you need to configure a custom handler to accept other URLs, you can create a callback `validate` function in your plugins.js for the `users-permissions` plugin. - -```tsx title="/config/plugins.js|ts" - // ... other plugins configuration ... - // Users & Permissions configuration - 'users-permissions': { - enabled: true, - config: { - callback: { - validate: (cbUrl, options) => { - // cbUrl is where Strapi is being asked to redirect the auth info - // that was received from the provider to - - // in this case, we will only validate that the - // if using a base url, you should always include the trailing slash - // although in real-world usage you should also include the full paths - if (cbUrl.startsWith('https://myproxy.mysite.com/') || - cbUrl.startsWith('https://mysite.com/')) { - return; - } - - // Note that you MUST throw an error to fail validation - // return values are not checked - throw new Error('Invalid callback url'); - }, - }, - }, - }, -``` diff --git a/docusaurus/docs/dev-docs/plugins/using-plugins.md b/docusaurus/docs/dev-docs/plugins/using-plugins.md index 575cc9adce..f37867155d 100644 --- a/docusaurus/docs/dev-docs/plugins/using-plugins.md +++ b/docusaurus/docs/dev-docs/plugins/using-plugins.md @@ -21,7 +21,7 @@ Strapi comes with the following built-in plugins that are officially maintained - + diff --git a/docusaurus/docs/dev-docs/providers.md b/docusaurus/docs/dev-docs/providers.md index 136c9bffc0..a9b6603a42 100644 --- a/docusaurus/docs/dev-docs/providers.md +++ b/docusaurus/docs/dev-docs/providers.md @@ -3,23 +3,17 @@ title: Providers description: Install and use providers to extend the functionality of available plugins. tags: - environment -- provider -- local providers -- private providers +- providers --- -# Providers +# Email and Upload Providers -Certain [plugins](../../../user-docs/plugins) can be extended via the installation and configuration of additional [providers](../../../user-docs/plugins#providers). +2 Strapi features, [Email](/user-docs/features/email) and the [Media Library](/user-docs/features/media-library), can be extended via the installation and configuration of additional providers. Providers add an extension to the core capabilities of the plugin, for example to upload media files to AWS S3 instead of the local server, or using Amazon SES for emails instead of Sendmail. -:::note -Only the [Upload](/dev-docs/plugins/upload) and [Email](/dev-docs/plugins/email) plugins are currently designed to work with providers. -::: - -For the relevant plugins, there are both official providers maintained by Strapi — discoverable via the [Marketplace](../../../user-docs/plugins/installing-plugins-via-marketplace) — and many community maintained providers available via [npm](https://www.npmjs.com/). +There are both official providers maintained by Strapi — discoverable via the [Marketplace](../../../user-docs/plugins/installing-plugins-via-marketplace) — and many community maintained providers available via [npm](https://www.npmjs.com/). A provider can be configured to be [private](#creating-private-providers) to ensure asset URLs will be signed for secure access. @@ -33,28 +27,32 @@ For example: -```bash -#Install the AWS S3 provider for the Upload plugin +Install the AWS S3 provider for the Upload (Media Library) feature: +```bash yarn add @strapi/provider-upload-aws-s3 +``` -# Install the Sendgrid provider for the Email plugin -yarn add @strapi/provider-email-sendgrid --save +Install the Sendgrid provider for the Email feature: +```bash +yarn add @strapi/provider-email-sendgrid ``` -```bash -#Install the AWS S3 provider for the Upload plugin +Install the AWS S3 provider for the Upload (Media Library) feature: +```bash npm install @strapi/provider-upload-aws-s3 --save +``` -# Install the Sendgrid provider for the Email plugin -npm install @strapi/provider-email-sendgrid --save +Install the Sendgrid provider for the Email feature: +```bash +npm install @strapi/provider-email-sendgrid --save ``` @@ -63,21 +61,21 @@ npm install @strapi/provider-email-sendgrid --save ## Configuring providers -Newly installed providers are enabled and configured in the `./config/plugins.js` file. If this file does not exist you must create it. +Newly installed providers are enabled and configured in [the `/config/plugins` file](/dev-docs/configurations/plugins). If this file does not exist you must create it. Each provider will have different configuration settings available. Review the respective entry for that provider in the [Marketplace](../../../user-docs/plugins/installing-plugins-via-marketplace) or [npm](https://www.npmjs.com/) to learn more. -Below are example configurations for the Upload and Email plugins. +The following are example configurations for the Upload (Media Library) and Email features: - + -```js title="./config/plugins.js" +```js title="/config/plugins.js" module.exports = ({ env }) => ({ // ... @@ -115,7 +113,7 @@ module.exports = ({ env }) => ({ -```ts title="./config/plugins.ts" +```ts title="/config/plugins.ts" export default ({ env }) => ({ // ... @@ -147,13 +145,13 @@ Strapi has a default [`security` middleware](/dev-docs/configurations/middleware - + -```js title="./config/plugins.js" +```js title="/config/plugins.js" module.exports = ({ env }) => ({ // ... @@ -178,7 +176,7 @@ module.exports = ({ env }) => ({ -```ts title="./config/plugins.ts" +```ts title="/config/plugins.ts" export default ({ env }) => ({ // ... @@ -205,8 +203,8 @@ export default ({ env }) => ({ :::note -* When using a different provider per environment, specify the correct configuration in `./config/env/${yourEnvironment}/plugins.js` (See [Environments](/dev-docs/configurations/environment)). -* Only one email provider will be active at a time. If the email provider setting isn't picked up by Strapi, verify the `plugins.js` file is in the correct folder. +* When using a different provider per environment, specify the correct configuration in `/config/env/${yourEnvironment}/plugins.js|ts` (See [Environments](/dev-docs/configurations/environment)). +* Only one email provider will be active at a time. If the email provider setting isn't picked up by Strapi, verify the `plugins.js|ts` file is in the correct folder. * When testing the new email provider with those two email templates created during strapi setup, the _shipper email_ on the template defaults to `no-reply@strapi.io` and needs to be updated according to your email provider, otherwise it will fail the test (See [Configure templates locally](/user-docs/settings/configuring-users-permissions-plugin-settings#configuring-email-templates)). ::: @@ -218,16 +216,16 @@ export default ({ env }) => ({ When configuring your provider you might want to change the configuration based on the `NODE_ENV` environment variable or use environment specific credentials. -You can set a specific configuration in the `./config/env/{env}/plugins.js` configuration file and it will be used to overwrite the default configuration. +You can set a specific configuration in the `/config/env/{env}/plugins.js|ts` configuration file and it will be used to overwrite the default configuration. ## Creating providers To implement your own custom provider you must [create a Node.js module](https://docs.npmjs.com/creating-node-js-modules). -The interface that must be exported depends on the plugin you are developing the provider for. Below are templates for the Upload and Email plugins: +The interface that must be exported depends on the plugin you are developing the provider for. The following are templates for the Upload (Media Library) and Email features: - + @@ -319,7 +317,7 @@ export default { - + @@ -358,8 +356,8 @@ export { In the send function you will have access to: -* `providerOptions` that contains configurations written in `plugins.js` -* `settings` that contains configurations written in `plugins.js` +* `providerOptions` that contains configurations written in `plugins.js|ts` +* `settings` that contains configurations written in `plugins.js|ts` * `options` that contains options you send when you call the send function from the email plugin service You can review the [Strapi maintained providers](https://github.com/strapi/strapi/tree/master/packages/providers) for example implementations. @@ -371,7 +369,7 @@ After creating your new provider you can [publish it to npm](https://docs.npmjs. If you want to create your own provider without publishing it on npm you can follow these steps: 1. Create a `providers` folder in your application. -2. Create your provider (e.g. `./providers/strapi-provider--`) +2. Create your provider (e.g. `/providers/strapi-provider--`) 3. Then update your `package.json` to link your `strapi-provider--` dependency to the [local path](https://docs.npmjs.com/files/package.json#local-paths) of your new provider. ```json @@ -385,10 +383,10 @@ If you want to create your own provider without publishing it on npm you can fol } ``` -4. Update your `./config/plugins.js` file to [configure the provider](#configuring-providers). -5. Finally, run `yarn install` or `npm install` to install your new custom provider. +4. Update your `/config/plugins.js|ts` file to [configure the provider](#configuring-providers). +5. Finally, run `yarn` or `npm install` to install your new custom provider. -## Creating private providers +### Creating private providers You can set up a private provider, meaning that every asset URL displayed in the Content Manager will be signed for secure access. @@ -404,7 +402,7 @@ Note that for security reasons, the content API will not provide any signed URLs To create a private `aws-s3` provider: -1. Create a `./providers/aws-s3` folder in your application. See [Local Providers](#local-providers) for more information. +1. Create a `/providers/aws-s3` folder in your application. See [Local Providers](#local-providers) for more information. 2. Implement the `isPrivate()` method in the `aws-s3` provider to return `true`. 3. Implement the `getSignedUrl(file)` method in the `aws-s3` provider to generate a signed URL for the given file. @@ -412,7 +410,7 @@ To create a private `aws-s3` provider: -```js title="./providers/aws-s3/index.js" +```js title="/providers/aws-s3/index.js" // aws-s3 provider module.exports = { @@ -451,7 +449,7 @@ module.exports = { -```ts title="./providers/aws-s3/index.ts" +```ts title="/providers/aws-s3/index.ts" // aws-s3 provider export = { diff --git a/docusaurus/docs/dev-docs/quick-start.md b/docusaurus/docs/dev-docs/quick-start.md index 14b9fd345d..e16e7b6c3a 100644 --- a/docusaurus/docs/dev-docs/quick-start.md +++ b/docusaurus/docs/dev-docs/quick-start.md @@ -16,8 +16,6 @@ import InstallPrerequisites from '/docs/snippets/installation-prerequisites.md' # Quick Start Guide - - Strapi offers a lot of flexibility. Whether you want to go fast and quickly see the final result, or would rather dive deeper into the product, we got you covered. For this tutorial, we'll go for the DIY approach and build a project and data structure from scratch, then deploy your project to Strapi Cloud to add data from there. *Estimated completion time: 5-10 minutes* @@ -34,7 +32,7 @@ We will first create a new Strapi project on your machine by running a command i Follow the steps below by clicking on the togglable content to read more instructions. -
+
Step 1: Run the installation script and create a Strapi Cloud account ### Step 1: Run the installation script and create a Strapi Cloud account @@ -444,7 +442,7 @@ Keep on creating amazing content! ::: :::tip Tip: Transfer data between your local and Strapi Cloud projects -The databases for your Strapi Cloud project and your local project are different. This means that data is not automatically synchronized between your Strapi Cloud and local projects. You can use the [data management system](/dev-docs/data-management) to transfer data between projects. +The databases for your Strapi Cloud project and your local project are different. This means that data is not automatically synchronized between your Strapi Cloud and local projects. You can use the [data management system](/user-docs/features/data-management) to transfer data between projects. ::: ## What to do next? diff --git a/docusaurus/docs/dev-docs/testing.md b/docusaurus/docs/dev-docs/testing.md index d4a6adeac2..703050bf50 100644 --- a/docusaurus/docs/dev-docs/testing.md +++ b/docusaurus/docs/dev-docs/testing.md @@ -8,12 +8,8 @@ tags: - environment --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Unit testing - - :::strapi The Strapi blog has a tutorial on how to implement [API testing with Jest and Supertest](https://strapi.io/blog/automated-testing-for-strapi-api-with-jest-and-supertest) and [how to add unit tests to your Strapi plugin](https://strapi.io/blog/how-to-add-unit-tests-to-your-strapi-plugin). ::: diff --git a/docusaurus/docs/dev-docs/typescript/development.md b/docusaurus/docs/dev-docs/typescript/development.md index 220fa2e704..daa3926b96 100644 --- a/docusaurus/docs/dev-docs/typescript/development.md +++ b/docusaurus/docs/dev-docs/typescript/development.md @@ -9,12 +9,8 @@ tags: --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # TypeScript Development with Strapi - - While developing a [TypeScript](/dev-docs/typescript)-based application with Strapi, you can: - access [typings for the `Strapi`](#use-strapi-typescript-typings) class with autocompletion, diff --git a/docusaurus/docs/snippets/u-and-p-provider-config-done.md b/docusaurus/docs/snippets/u-and-p-provider-config-done.md new file mode 100644 index 0000000000..02e78acda2 --- /dev/null +++ b/docusaurus/docs/snippets/u-and-p-provider-config-done.md @@ -0,0 +1,2 @@ +Your configuration is done. +Launch the backend and the [react login example application](https://github.com/strapi/strapi-examples/tree/master/examples/login-react), go to `http://localhost:3000` and try to connect to the provider you configured. diff --git a/docusaurus/docs/user-docs/content-manager/adding-content-to-releases.md b/docusaurus/docs/user-docs/content-manager/adding-content-to-releases.md index ff5db35bd6..edfc1f9ccc 100644 --- a/docusaurus/docs/user-docs/content-manager/adding-content-to-releases.md +++ b/docusaurus/docs/user-docs/content-manager/adding-content-to-releases.md @@ -9,10 +9,8 @@ tags: - Strapi Cloud --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Including content in a release {#add-to-release} - + Using the [Releases](/user-docs/releases/introduction) feature, you can group several entries to publish them altogether. Adding entries to a release is done from the Content Manager. You can also remove an entry from a release while updating the entry. diff --git a/docusaurus/docs/user-docs/content-manager/configuring-view-of-content-type.md b/docusaurus/docs/user-docs/content-manager/configuring-view-of-content-type.md index fa5d40f619..f8ce17fc36 100644 --- a/docusaurus/docs/user-docs/content-manager/configuring-view-of-content-type.md +++ b/docusaurus/docs/user-docs/content-manager/configuring-view-of-content-type.md @@ -10,8 +10,6 @@ tags: - Content-type edit view --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring the views of a content-type Depending on their type, content-types can be divided into 2 interfaces: the list view and the edit view. Both interfaces can be configured. diff --git a/docusaurus/docs/user-docs/content-manager/introduction-to-content-manager.md b/docusaurus/docs/user-docs/content-manager/introduction-to-content-manager.md index ed2cbc15a1..b8c912e081 100644 --- a/docusaurus/docs/user-docs/content-manager/introduction-to-content-manager.md +++ b/docusaurus/docs/user-docs/content-manager/introduction-to-content-manager.md @@ -13,7 +13,6 @@ tags: - introduction --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Introduction to the Content Manager diff --git a/docusaurus/docs/user-docs/content-manager/reviewing-content.md b/docusaurus/docs/user-docs/content-manager/reviewing-content.md index 654a4fe866..8541c775bf 100644 --- a/docusaurus/docs/user-docs/content-manager/reviewing-content.md +++ b/docusaurus/docs/user-docs/content-manager/reviewing-content.md @@ -7,8 +7,6 @@ tags: - review workflows --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Reviewing content diff --git a/docusaurus/docs/user-docs/content-manager/saving-and-publishing-content.md b/docusaurus/docs/user-docs/content-manager/saving-and-publishing-content.md index 60870c6806..abc310c1ea 100644 --- a/docusaurus/docs/user-docs/content-manager/saving-and-publishing-content.md +++ b/docusaurus/docs/user-docs/content-manager/saving-and-publishing-content.md @@ -10,8 +10,6 @@ tags: - unpublishing content --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Saving, publishing and deleting content Strapi allows you to manage your content throughout its whole lifecycle, whether you are working on its draft version, about to finish it and share it with the world, or wanting to delete it when it's obsolete. diff --git a/docusaurus/docs/user-docs/content-manager/translating-content.md b/docusaurus/docs/user-docs/content-manager/translating-content.md index 077b22f8d7..9df3feee8f 100644 --- a/docusaurus/docs/user-docs/content-manager/translating-content.md +++ b/docusaurus/docs/user-docs/content-manager/translating-content.md @@ -12,8 +12,6 @@ tags: - single type --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Translating content With the [Internationalization feature](/user-docs/plugins/strapi-plugins#i18n) enabled for a content-type, it is possible to manage content in more than one language, called "locale". To manage content in a specific locale, the latter must be added beforehand through the Internationalization settings (see [Configuring Internationalization locales](../settings/internationalization)). diff --git a/docusaurus/docs/user-docs/content-manager/working-with-content-history.md b/docusaurus/docs/user-docs/content-manager/working-with-content-history.md index cca9940a55..0becc3472b 100644 --- a/docusaurus/docs/user-docs/content-manager/working-with-content-history.md +++ b/docusaurus/docs/user-docs/content-manager/working-with-content-history.md @@ -8,7 +8,7 @@ tags: --- # Content History - + The Content History feature of the Content Manager gives you the ability to browse and restore previous versions of documents created with the Content Manager. diff --git a/docusaurus/docs/user-docs/content-type-builder/configuring-fields-content-type.md b/docusaurus/docs/user-docs/content-type-builder/configuring-fields-content-type.md index 0412ed9777..7d2af128e0 100644 --- a/docusaurus/docs/user-docs/content-type-builder/configuring-fields-content-type.md +++ b/docusaurus/docs/user-docs/content-type-builder/configuring-fields-content-type.md @@ -12,8 +12,6 @@ tags: - password --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring fields for content-types :::note Development-only diff --git a/docusaurus/docs/user-docs/content-type-builder/creating-new-content-type.md b/docusaurus/docs/user-docs/content-type-builder/creating-new-content-type.md index 337a64a83a..8545959148 100644 --- a/docusaurus/docs/user-docs/content-type-builder/creating-new-content-type.md +++ b/docusaurus/docs/user-docs/content-type-builder/creating-new-content-type.md @@ -9,8 +9,6 @@ tags: - single type --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Creating content-types :::note Development-only diff --git a/docusaurus/docs/user-docs/content-type-builder/introduction-to-content-types-builder.md b/docusaurus/docs/user-docs/content-type-builder/introduction-to-content-types-builder.md index b56cc4a551..4700458743 100644 --- a/docusaurus/docs/user-docs/content-type-builder/introduction-to-content-types-builder.md +++ b/docusaurus/docs/user-docs/content-type-builder/introduction-to-content-types-builder.md @@ -11,8 +11,6 @@ tags: pagination_next: user-docs/content-type-builder/creating-new-content-type --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Introduction to the Content-type Builder The Content-type Builder is a core plugin of Strapi. It is a feature that is always activated by default and cannot be deactivated. The Content-type Builder is however only accessible when the application is in a development environment. diff --git a/docusaurus/docs/user-docs/content-type-builder/managing-content-types.md b/docusaurus/docs/user-docs/content-type-builder/managing-content-types.md index e026b0e20a..528c1b8a7b 100644 --- a/docusaurus/docs/user-docs/content-type-builder/managing-content-types.md +++ b/docusaurus/docs/user-docs/content-type-builder/managing-content-types.md @@ -9,7 +9,6 @@ tags: - single type --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Managing content-types diff --git a/docusaurus/docs/user-docs/features/RBAC.md b/docusaurus/docs/user-docs/features/RBAC.md new file mode 100644 index 0000000000..cb98726e77 --- /dev/null +++ b/docusaurus/docs/user-docs/features/RBAC.md @@ -0,0 +1,293 @@ +--- +title: Role-Based Access Control (RBAC) +description: Learn to use the RBAC feature which allows to manage the users of the admin panel. +toc_max_heading_level: 5 +tags: +- admin panel +- RBAC +- Role Based Access Control +--- + +import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; + +# Role-Based Access Control (RBAC) + +The Role-Based Access Control (RBAC) feature allows the management of the administrators, who are the users of the admin panel. More specifically, RBAC manages the administrators' accounts and roles. + + + +:::prerequisites Identity Card of the Feature + **Plan:** RBAC is a free feature.
+ **Role & permission:** CRUD permissions in Roles > Settings - Users & Roles.
+ **Activation:** Available and activated by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +The *Roles* sub-section of *Administration panel* displays all created roles for the administrators of your Strapi application. + +From this interface, it is possible to: + +- create a new administrator role (see [Creating a new role](#creating-a-new-role)), +- delete an administrator role (see [Deleting a role](#deleting-a-role)), +- or access information regarding an administrator role, and edit it (see [Editing a role](#editing-a-role)). + +By default, 3 administrator roles are defined for any Strapi application: + +- Author: to be able to create and manage their own content. +- Editor: to be able to create content, and manage and publish any content. +- Super Admin: to be able to access all features and settings. This is the role attributed by default to the first administrator at the creation of the Strapi application. + +### Creating a new role + +On the top right side of the *Administration panel > Roles* interface, an **Add new role** button is displayed. It allows to create a new role for administrators of your Strapi application. + +To create a new role, click on the **Add new role** button. +Clicking on the **Add new role** button will redirect you to the roles edition interface, where you will be able to edit the role's details and configure its permissions (see [Editing a role](#editing-roles-details)). + +:::tip +In the *Roles* interface, from the table, you can click on the duplicate button ![Duplicate icon](/img/assets/icons/v5/Duplicate.svg) to create a new role by duplicating an existing one. +::: + +### Deleting a role + +Administrator roles can be deleted from the *Administration panel > Roles* interface. However, they can only be deleted once they are no more attributed to any administrator of the Strapi application. + +To delete a role: + +1. Click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) on the right side of the role's record. +2. In the deletion window, click on the **Confirm** button to confirm the deletion. + +### Editing a role + + + +The role edition interface allows to edit the details of an administrator role as well as configure in detail the permissions to all sections of your Strapi application. It is accessible from *Administration panel > Roles* either after clicking on the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) on the right side of a role's record, or after clicking on the **Add new role** button (see [Creating a new role](#creating-a-new-role)). + +:::caution +It isn't possible to edit the permissions of the Super Admin role. All configurations are in read-only mode. +::: + +#### Editing role's details + +The details area of an administrator role editing interface allow to define the name of the role, and to give it a description that should help other administrators understand what the role gives access to. + +:::tip +In the top right corner, you can see a counter indicating how many administrators have been attributed the role. +::: + +To edit a role's details, follow the instructions from the table below: + +| Role details | Instructions | +| ------------- | -------------- | +| Name | Write the new name of the role in the textbox. | +| Description | Write the description of the role in the textbox. | + +#### Configuring role's permissions + +The permissions area of an administrator role editing interface allows to configure in detail what actions an administrator can do for any part of the Strapi application. It is displayed as a table, split into 4 categories: Collection types, Single types, Plugins and Settings. + +##### Collection and Single types + +The Collection types and Single types categories respectively list all available collection and single types for the Strapi application. For each content-type, the administrators can have the permission to perform the following actions: create, read, update, delete and publish. + +To configure Collection or Single types permissions for a role: + +1. Go to the Collection types or Single types category of the permissions table. +2. Tick the box on the left of the name of the content-type to give access to. By default, all actions can be performed for all fields of the content-type. +3. (optional) Untick the action-related boxes to prevent actions of your choice. +4. (optional) Click the name of the content-type to display its full list of fields. Untick the field and action-related boxes to prevent access and/or action for the fields of your choice. If the [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is installed, define also what permissions should be granted for each available locale. +5. Repeat steps 2 to 4 for each content-type available to which the role should give access. +6. Click on the **Save** button on the top right corner. + +##### Plugins and Settings + +The Plugins and Settings categories both display a sub-category per available plugin or setting of the Strapi application. Each sub-category contains its own specific set of permissions. + +To configure plugins or settings permissions for a role: + +1. Go to the Plugins or Settings category of the permissions table. +2. Click on the name of the sub-category which permissions to configure, to display all available permissions. +3. Tick the boxes of the permissions the role should give access to. You can refer to the table below for more information and instructions. + + + + + +By default, plugins permissions can be configured for the Content-type Builder, the Upload (i.e. Media Library) plugin, the Content Manager, and Users Permissions (i.e. the Users & Permissions plugin allowing to manage end users). Each plugin has its own specific set of permissions. + +| Plugin name | Permissions | +| -------------------- | ----------- | +| Content-Releases
*(Releases)* |
  • General
    • "Read" - gives access to the Releases feature
    • "Create" - allows to create releases
    • "Edit" - allows to edit releases
    • "Delete" - allows to delete releases
    • "Publish" - allows to publish releases
    • "Remove an entry from a release"
    • "Add an entry to a release"
| +| Content-Manager |
  • Single types
    • "Configure view" - allows to configure the edit view of a single type
  • Collection types
    • "Configure view" - allows to configure the edit view of a collection type
  • Components
    • "Configure Layout" - allows to configure the layout of a component
| +| Content-Type-Builder |
  • General
    • "Read" - gives access to the Content-type Builder plugin in read-only mode
| +| Upload
*(Media Library)* |
  • General
    • "Access the Media Library" - gives access to the Media Library plugin
    • "Configure view" - allows to configure the view of the Media Library
  • Assets
    • "Create (upload)" - allows to upload media files
    • "Update (crop, details, replace) + delete" - allows to edit uploaded media files
    • "Download" - allows to download uploaded media files
    • "Copy link" - allows to copy the link of an uploaded media file
| +| Users-Permissions |
  • Roles
    • "Create" - allows to create end-user roles
    • "Read" - allows to see created end-user roles
    • "Update" - allows to edit end-user roles
    • "Delete" - allows to delete end-user roles
  • Providers
    • "Read" - allows to see providers
    • "Edit" - allows to edit providers
  • Email Templates
    • "Read" - allows to access the email templates
    • "Edit" - allows to edit email templates
  • Advanced settings
    • "Read" - allows to access the advanced settings of the Users & Permissions plugin
    • "Edit" - allows to edit advanced settings
👉 Path reminder to the Users & Permissions plugin:
*General > Settings > Users & Permissions plugin* | + +
+ + + +Settings permissions can be configured for all settings accessible from *General > Settings* from the main navigation of the admin panel: Media Library and Webhooks (*Global settings* section) and Users & Roles (*Administration panel* section, to configure the settings of the RBAC feature). Settings permissions also allow to configure access to the Plugins and Marketplace sections of the admin panel. Each setting has its own specific set of permissions. + +| Setting name | Permissions | +| ----------------------- | ----------- | +| Content Releases |
  • Options
    • "Read" - allows to access the Releases settings
    • "Edit" - allows to edit the Releases settings
👉 Path reminder to the Releases settings:
*General > Settings > Global Settings - Releases* | +| Email |
  • General
    • "Access the Email settings page" - gives access to Email settings
👉 Path reminder to Email settings:
*General > Settings > Users & Permissions plugin - Email templates* | +| Media Library |
  • General
    • "Access the Media Library settings page" - gives access to Media Library settings
👉 Path reminder to Media Library settings:
*General > Settings > Global Settings - Media Library* | +| Internationalization |
  • Locales
    • "Create" - allows to create new locales
    • "Read" - allows to see available locales
    • "Update" - allows to edit available locales
    • "Delete" - allows to delete locales
👉 Path reminder to the Internationalization settings:
*General > Settings > Global Settings - Internationalization* | +| Review Workflows |
  • "Create" - allows to create workflows
  • "Read" - allows to see created workflows
  • "Update" - allows to edit workflows
  • "Delete" - allows to delete workflows
👉 Path reminder to Review workflows settings:
*General > Settings > Global Settings - Review workflows* | +| Single sign on |
  • Options
    • "Read" - allows to access the SSO settings
    • "Update" - allows to edit the SSO settings
👉 Path reminder to the SSO settings:
*General > Settings > Global Settings - Single Sign-On* | +| Audit Logs |
  • Options
    • "Read" - allows to access the Audit Logs settings
👉 Path reminder to the Audit Logs settings:
*General > Settings > Admin Panel - Audit Logs* | +| Plugins and Marketplace |
  • Marketplace
    • "Access the Marketplace" - gives access to the Marketplace
| +| Webhooks |
  • General
    • "Create" - allows to create webhooks
    • "Read" - allows to see created webhooks
    • "Update" - allows to edit webhooks
    • "Delete" - allows to delete webhooks
👉 Path reminder to Webhook settings:
*General > Settings > Global Settings - Webhook* | +| Users and Roles |
  • Users
    • "Create (invite)" - allows to create administrator accounts
    • "Read" - allows to see existing administrator accounts
    • "Update" - allows to edit administrator accounts
    • "Delete" - allows to delete administrator accounts
  • Roles
    • "Create" - allows to create administrator roles
    • "Read" - allows to see created administrator roles
    • "Update" - allows to edit administrator roles
    • "Delete" - allows to delete administrator roles
👉 Path reminder to the RBAC feature:
*General > Settings > Administration Panel* | +| API Tokens |
  • API tokens
    • "Access the API tokens settings page" - toggles access to the API tokens page
  • General
    • "Create (generate)" - allows the creation of API tokens
    • "Read" - allows you to see created API tokens (disabling this permission will disable access to the *Global Settings - API Tokens* settings)
    • "Update" - allows editing of API tokens
    • "Delete (revoke)" - allows deletion of API tokens
    • "Regenerate" - allows regeneration of the API token
👉 Path reminder to API Tokens settings:
*General > Settings > Global Settings - API Tokens* | +| Project |
  • General
    • "Update the project level settings" - allows to edit the settings of the project
    • "Read the project level settings" - gives access to settings of the project
| +| Transfer Tokens |
  • Transfer tokens
    • "Access the Transfer tokens settings page" - toggles access to the Transfer tokens page
  • General
    • "Create (generate)" - allows the creation of Transfer tokens
    • "Read" - allows you to see created Transfer tokens (disabling this permission will disable access to the *Global Settings - Transfer Tokens* settings)
    • "Update" - allows editing of Transfer tokens
    • "Delete (revoke)" - allows deletion of Transfer tokens
    • "Regenerate" - allows regeneration of the Transfer token
👉 Path reminder to Transfer Tokens settings:
*General > Settings > Global Settings - Transfer Tokens* | + +
+ +
+ +4. Click on the **Save** button on the top right corner. + +#### Setting custom conditions for permissions + +For each permission of each category, a ![Settings icon](/img/assets/icons/v5/Cog.svg) **Settings** button is displayed. It allows to push the permission configuration further by defining additional conditions for the administrators to be granted the permission. There are 2 default additional conditions: + +- the administrator must be the creator, +- the administrator must have the same role as the creator. + +:::note +Other custom conditions can be available if they have been created beforehand for your Strapi application (see [Role-Based Access Control](/dev-docs/configurations/guides/rbac)). +::: + + + +To set custom conditions: + +1. Click on the ![Settings icon](/img/assets/icons/v5/Cog.svg) **Settings** button of the permission already granted for the role. +2. In the *Define conditions* window, each available permission can be customized with a specific condition. Click on the drop-down list related to the permission you want to customize. +3. Define the custom condition for the chosen permission. You can either: + - Tick the Default option for all available additional conditions to be applied. + - Click on the arrow button ![Carret icon](/img/assets/icons/v5/CaretDown.svg) to see the available additional conditions and tick only the chosen one(s). +4. Click on the **Apply** button. + +:::tip +Once a custom condition is set for a permission, a dot is displayed next to the permission's name and the ![Settings icon](/img/assets/icons/v5/Cog.svg) **Settings** button. +::: + +:::caution +Custom conditions can only be set for permissions that have been ticked to be granted for the role. If not, when clicking the ![Settings icon](/img/assets/icons/v5/Cog.svg) **Settings** button, the window that opens will remain empty, as no custom condition option will be available. +::: + +## Usage + +The *Users* sub-section of *Administration panel* displays a table listing all the administrators of your Strapi application. + +From this interface, it is possible to: + +- make a textual search to find specific administrators, +- set filters to find specific administrators, +- create a new administrator account (see [Creating a new account](#creating-a-new-account)) , +- delete an administrator account (see [Deleting an account](#deleting-an-account)), +- or access information regarding an administrator account, and edit it (see [Editing an account](#editing-an-account)). + +For each administrator listed in the table, their main account information are displayed, including name, email and attributed role. The status of their account is also indicated: active or inactive, depending on whether the administrator has already logged in to activate the account or not. + +:::tip +Sorting can be enabled for most fields displayed in the table. Click on a field name, in the header of the table, to sort on that field. +::: + +### Creating a new account + +On the top right side of the *Administration panel > Users* interface, a ![Mail icon](/img/assets/icons/v5/Mail.svg) **Invite new user** button is displayed. It allows to create a new administrator account for your Strapi application. + +To create a new administrator account: + +1. Click on the ![Mail icon](/img/assets/icons/v5/Mail.svg) **Invite new user** button. +2. In the *Invite new user* window, fill in the Details information about the new administrator: + + | User information | Instructions | + | ---------------- | ---------------------------------------------------------------------------- | + | First name | (mandatory) Write the administrator's first name in the textbox. | + | Last name | (mandatory) Write the administrator's last name in the textbox. | + | Email | (mandatory) Write the administrator's complete email address in the textbox. | + +3. Fill in the Login settings about the new administrator: + + | Setting | Instructions | + | ---------------- | --------------------------------------------------------------------------------------------------------------- | + | User's roles | (mandatory) Choose from the drop-down list the role to attribute to the new administrator. | + | Connect with SSO | (optional) Click **TRUE** or **FALSE** to connect the new administrator account with SSO. | + +4. Click on the **Invite user** button in the bottom right corner of the *Add new user* window. +5. A URL appears at the top of the window: it is the URL to send the new administrator for them to log in for the first time to your Strapi application. Click the copy button ![Duplicate icon](/img/assets/icons/v5/Duplicate.svg) to copy the URL. +6. Click on the **Finish** button in the bottom right corner to finish the new administrator account creation. The new administrator should now be listed in the table. + +:::note +The administrator invitation URL is accessible from the administrator's account until it has been activated. +::: + +### Deleting an account + +Administrator accounts can be deleted from the *Administration panel > Users* interface. It is possible to delete one or several administrator accounts at the same time. + +To delete an administrator: + +1. Click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) on the right side of the account's record, or select one or more accounts by ticking the boxes on the left side of the accounts' records then click on the ![Delete icon](/img/assets/icons/v5/Trash.svg) **Delete** button above the table. +2. In the deletion window, click on the **Confirm** button to confirm the deletion. + +### Editing an account + + + +The table displayed in the *Administration panel > Users* interface allows to access all information regarding each administrator, where it is also possible to edit that information. + +To edit an administrator account: + +1. Click on the name of the administrator whose account you want to edit. +2. In the *Details* area, edit your chosen account details: + +| User information | Instructions | +| --------------------- | ----------------------- | +| First name | Write the administrator's first name in the textbox. | +| Last name | Write the administrator's last name in the textbox. | +| Email | Write the administrator's complete email address in the textbox. | +| Username | Write the administrator's username in the textbox. | +| Password | Write the new administrator account's password in the textbox. | +| Confirm password | Write the new password in the textbox for confirmation. | +| Active | Click on **TRUE** to activate the administrator's account. | + +3. (optional) In the *Roles* area, edit the role of the administrator: + + - Click on the drop-down list to choose a new role, and/or add it to the already attributed one. + - Click on the delete button ![Clear icon](/img/assets/icons/v5/Cross.svg) to delete an already attributed role. + +4. Click on the **Save** button in the top right corner. \ No newline at end of file diff --git a/docusaurus/docs/user-docs/features/SSO.md b/docusaurus/docs/user-docs/features/SSO.md new file mode 100644 index 0000000000..f50abcc49d --- /dev/null +++ b/docusaurus/docs/user-docs/features/SSO.md @@ -0,0 +1,63 @@ +--- +title: Single Sign-On (SSO) +description: Learn to use the SSO feature which manages authentication through an identity provider. +toc_max_heading_level: 5 +tags: +- admin panel +- SSO +- Single Sign-On +--- + +# Single Sign-On (SSO) + +The Single Sign-On (SSO) feature can be made available on a Strapi application to allow administrators to authenticate through an identity provider (e.g. Microsoft Azure Active Directory). + + + +:::prerequisites Identity Card of the Feature + **Plan:** Enterprise plan.
+ **Role & permission:** Read & Update permissions in Roles > Settings - Single Sign-On.
+ **Activation:** Disabled by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +1. Go to the *Global settings > Single Sign-On* sub-section of the settings interface. +2. Define your chosen new settings: + +| Setting name | Instructions | +| ----------------- | ---------------------| +| Auto-registration | Click on **True** to allow the automatic creation of a new Strapi administrator when an SSO login does not match an existing Strapi administrator account. If this setting is set on **False**, new Strapi administrators accounts must be created manually beforehand. | +| Default role | Choose among the drop-down list the role to attribute by default to auto-registered Strapi administrators through SSO login. | +| Local authentication lock-out | Choose among the drop-down list the [roles](/user-docs/users-roles-permissions) for which the local authentication capabilities are disabled.
Users locked out of local authentication will be forced to use SSO to login and will not be able to change or reset their password. | + +3. Click the **Save** button. + +:::danger +Don't select _Super Admin_ in the roles list for the _Local authentication lock-out_. If _Super Admin_ is selected, it becomes possible to accidentally lock oneself out of the Strapi admin panel entirely. A fix will be provided soon. + +In the meantime, the only way to get in if the Super Admin can't log in is to temporarily disable the SSO feature entirely, log in with username and password to remove the _Super Admin_ role from the _Local authentication lock-out_ list, and then re-enable SSO. +::: + + + +## Usage + +To access the admin panel using a specific provider instead of logging in with a regular Strapi administrator account: + +1. Go to the URL of your Strapi application's admin panel. +2. Click on a chosen provider, which logo should be displayed at the bottom of the login form. If you cannot see your provider, click the ![More icon](/img/assets/icons/v5/More.svg) button to access the full list of all available providers. +3. You will be redirected to your provider's own login page where you will be able to authenticate. diff --git a/docusaurus/docs/user-docs/features/admin-panel.md b/docusaurus/docs/user-docs/features/admin-panel.md new file mode 100644 index 0000000000..4bd47c6017 --- /dev/null +++ b/docusaurus/docs/user-docs/features/admin-panel.md @@ -0,0 +1,115 @@ +--- +title: Admin panel +description: Learn to use the admin panel. +toc_max_heading_level: 5 +tags: +- admin panel +- administration panel +- profile +- interface language +- light mode +- dark mode +--- + +# Administration panel + +The admin panel is the back office of your Strapi application. From the admin panel, you will be able to manage content-types, and write their actual content. It is also from the admin panel that you will manage users, both administrators and end users of your Strapi application. + + + +## Overview + + + +## Configuration + +**Path to configure the admin panel:** Account name or initials (bottom left hand corner) > Profile + +If you are a new administrator, we recommend making sure your profile is all set, before diving into your Strapi application. From your administrator profile, you are able to modify your user information, such as name, username, email or password. You can also choose the language and mode of the interface for your Strapi application. + + + +### Modifying profile information (name, email, username) + +1. Go to the *Profile* section of your profile. +2. Fill in the following options: + +| Profile & Experience | Instructions | +| -------------------- | ------------------------------------------------- | +| First name | Write your first name in the textbox. | +| Last name | Write your last name in the textbox. | +| Email | Write your complete email address in the textbox. | +| Username | (optional) Write a username in the textbox. | + +3. Click on the **Save** button. + +### Changing account password + +1. Go to the *Change password* section of your profile. +2. Fill in the following options: + +| Password modification | | +| --------------------- | ------------------------------------------- | +| Current password | Write your current password in the textbox. | +| Password | Write the new password in the textbox. | +| Password confirmation | Write the same new password in the textbox. | + +3. Click on the **Save** button. + +:::tip +You can click on the ![Eye icon](/img/assets/icons/v5/Eye.svg) icon for the passwords to be shown. +::: + +### Choosing interface language + +In the *Experience* section of your profile, select your preferred language using the *Interface language* dropdown. + +:::note +Keep in mind that choosing an interface language only applies to your account on the admin panel. Other users of the same application's admin panel can use a different language. +::: + +### Choosing interface mode (light, dark) + +By default, the chosen interface mode is based on your browser's mode. You can however, in the *Experience* section of your profile, manually choose either the Light Mode or Dark Mode using the *Interface mode* dropdown. + +:::note +Keep in mind that choosing an interface mode only applies to your account on the admin panel. +::: + +## Usage + + + +:::caution +In order to access the admin panel, your Strapi application must be launched, and you must be aware of the URL to its admin panel (e.g. `api.example.com/admin`). +::: + +To access the admin panel: + +1. Go to the URL of your Strapi application's admin panel. +2. Enter your credentials to log in. +3. Click on the **Login** button. You should be redirected to the homepage of the admin panel. + +:::note +If you prefer or are required to log in via an SSO provider, please refer to the Single Sign-On documentation. +::: + + diff --git a/docusaurus/docs/user-docs/features/api-tokens.md b/docusaurus/docs/user-docs/features/api-tokens.md new file mode 100644 index 0000000000..225b8fb7de --- /dev/null +++ b/docusaurus/docs/user-docs/features/api-tokens.md @@ -0,0 +1,106 @@ +--- +title: API Tokens +description: Learn how you can use API tokens to manage end-users authentication. +sidebar_position: 2 +toc_max_heading_level: 5 +tags: +- api tokens +- admin panel +- authentication +- users & permissions +--- + +# API Tokens + +API tokens allow users to authenticate REST and GraphQL API queries (see [Developer Documentation](/dev-docs/configurations/api-tokens)). Administrators can manage API tokens from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > API Tokens*. + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** Minimum "Access the API tokens settings page" in Roles > Settings - API tokens.
+ **Activation:** Available by default.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Configuration + +Most configuration options for API tokens are available in the admin panel, and your Strapi project's code can be used to alter how API tokens are generated. + +### Admin panel settings + +The *API Tokens* settings sub-section displays a table listing all of the created API tokens. + +The table displays each API token's name, description, date of creation, and date of last use. From the table, administrators can also: + +- Click on the ![edit button](/img/assets/icons/v5/Pencil.svg) to edit an API token's name, description, type, duration or [regenerate the token](#regenerating-an-api-token). +- Click on the ![delete button](/img/assets/icons/v5/Trash.svg) to delete an API token. + +#### Creating a new API token + +To create a new API token: + +1. Click on the **Create new API Token** button. +2. In the API token edition interface, configure the new API token: + + | Setting name | Instructions | + | -------------- | ------------------------------------------------------------------------ | + | Name | Write the name of the API token. | + | Description | (optional) Write a description for the API token. | + | Token duration | Choose a token duration: *7 days*, *30 days*, *90 days*, or *Unlimited*. | + | Token type | Choose a token type: *Read-only*, *Full access*, or *Custom*. | + +3. (optional) For the *Custom* token type, define specific permissions for your API endpoints by clicking on the content-type name and using checkboxes to enable or disable permissions. +4. Click on the **Save** button. The new API token will be displayed at the top of the interface, along with a copy button ![copy button](/img/assets/icons/v5/Duplicate.svg). + + + +:::caution +For security reasons, API tokens are only shown right after they have been created. When refreshing the page or navigating elsewhere in the admin panel, the newly created API token will be hidden and will not be displayed again. +::: + +#### Regenerating an API token + +To regenerate an API token: + +1. Click on the API token's edit button. +2. Click on the **Regenerate** button. +3. Click on the **Regenerate** button to confirm in the dialog. +4. Copy the new API token displayed at the top of the interface. + +### Code-based configuration + +New API tokens are generated using a salt. This salt is automatically generated by Strapi and stored in environment variables (the `.env` file) as `API_TOKEN_SALT`. + +The salt can be customized: + +- either by updating the string value for `apiToken.salt` in `./config/admin.js` (see [admin panel configuration documentation](/dev-docs/configurations/admin-panel)) +- or by creating an `API_TOKEN_SALT` [environment variable](/dev-docs/configurations/environment#strapi) in the `.env` file of the project + +:::caution +Changing the salt invalidates all the existing API tokens. +::: + +## Usage + +Using API tokens allows executing a request on [REST API](/dev-docs/api/rest) or [GraphQL API](/dev-docs/api/graphql) endpoints as an authenticated user. + +API tokens can be helpful to give access to people or applications without managing a user account or changing anything in the Users & Permissions plugin. + +When performing a request to Strapi's REST API, the API token should be added to the request's `Authorization` header with the following syntax: `bearer your-api-token`. + +:::note +Read-only API tokens can only access the `find` and `findOne` functions. +::: diff --git a/docusaurus/docs/user-docs/features/audit-logs.md b/docusaurus/docs/user-docs/features/audit-logs.md new file mode 100644 index 0000000000..2e8eccde17 --- /dev/null +++ b/docusaurus/docs/user-docs/features/audit-logs.md @@ -0,0 +1,84 @@ +--- +title: Audit Logs +description: Learn how you can use the Audit Logs feature of Strapi 5. +displayed_sidebar: cmsSidebar +sidebar_position: 2 +toc_max_heading_level: 5 +tags: +- audit logs +- admin panel +- Enterprise feature +- payload +- Strapi Cloud +--- + +# Audit Logs + + +The Audit Logs feature provides a searchable and filterable display of all activities performed by users of the Strapi application. + +:::prerequisites Identity Card of the Feature + **Plan:** Growth or Enterprise Plan, or Cloud Team plan.
+ **Role & permission:** Super Admin role in the project's admin panel.
+ **Activation:** Available by default, if required plan.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Usage + +**Path to use the feature:** ![Settings icon](/img/assets/icons/v5/Cog.svg) Settings > Administration Panel - Audit Logs + +The Audit Logs feature logs the following events: + +| Event | Actions | +| --- | --- | +| Content Type | `create`, `update`, `delete` | +| Entry (draft/publish) | `create`, `update`, `delete`, `publish`, `unpublish` | +| Media | `create`, `update`, `delete` | +| Login / Logout | `success`, `fail` | +| Role / Permission | `create`, `update`, `delete` | +| User | `create`, `update`, `delete` | + +For each log item, the following information is displayed: + +- Action: type of action performed by the user (e.g.`create` or `update`). +- Date: date and time of the action. +- User: user who performed the action. +- Details: displays a modal with more details about the action (e.g. the User IP address, the request body, or the response body). + + +### Filtering logs + +By default, all logs are displayed in reverse chronological order. You can filter the logs by: + +- Action: select the type of action to filter by (e.g `create` or `update`). +- User: select the user to filter by. +- Date: select a date (range) and time to filter by. + + + +### Accessing log details + +For any log item, click the ![Eye icon](/img/assets/icons/v5/Eye.svg) icon to access a modal with more details about that action. In the modal, the *Payload* section displays the details in an interactive JSON component, enabling you to expand and collapse the JSON object. + + diff --git a/docusaurus/docs/user-docs/features/content-history.md b/docusaurus/docs/user-docs/features/content-history.md new file mode 100644 index 0000000000..ddc96841e8 --- /dev/null +++ b/docusaurus/docs/user-docs/features/content-history.md @@ -0,0 +1,77 @@ +--- +title: Content History +description: Learn how you can use the Content History feature of Strapi 5 to browse and restore previous versions of documents from the Content Manager. +displayed_sidebar: cmsSidebar +toc_max_heading_level: 5 +tags: + - Content Manager + - Content History +--- + +# Content History + + +The Content History feature, in the Content Manager, gives you the ability to browse and restore previous versions of documents created with the Content Manager. + +:::prerequisites Identity Card of the Feature + **Plan:** Growth or Enterprise plan, or Cloud Pro or Team plan.
+ **Role & permission:** None.
+ **Activation:** Available by default, if required plan.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Usage + +**Path to use the feature:** ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager
From the edit view of a content type: click ![More icon](/img/assets/icons/v5/More.svg) (top right corner) then ![ClockCounterClockwise icon](/img/assets/icons/v5/ClockCounterClockwise.svg) **Content History**. + +### Browsing Content History + + + +With Content History, you can browse your content through: + +- The main view on the left, which lists the fields and their content for the version selected in the sidebar on the right. +- The sidebar on the right, which lists the total number of versions available, and for each version: + - the date and time when the version was created, + - the user who created it, + - and whether its status is Draft, Modified, or Published (see [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content#saving--publishing-content) for more information about document statuses). + + + + +:::note +The main view of Content History clearly states whether a field was inexistent, deleted, or renamed in other versions of the content-type. Fields that are unknown for the selected version will be displayed under an _Unknown fields_ heading below the other fields. +::: + +### Restoring a previous version + +You can choose to restore a previous version of a document. When restoring a version, the content of this version will override the content of the current draft version. The document switches to the Modified status and you will then be able to [publish](/user-docs/content-manager/saving-and-publishing-content#publishing-and-unpublishing) the content whenever you want. + +To restore a version: + + +1. Browse the Content History and select a version via the sidebar on the right. +2. Click the **Restore** button. +3. In the _Confirmation_ window, click **Restore**. + +:::note +If the [Internationalization (i18n)](/user-docs/content-manager/translating-content) feature is enabled for the content-type, restoring a version with a unique field (i.e. a field whose content is the same for all locales) will restore the content of this field for all locales. +::: + + diff --git a/docusaurus/docs/user-docs/features/content-manager.md b/docusaurus/docs/user-docs/features/content-manager.md new file mode 100644 index 0000000000..d2e782262a --- /dev/null +++ b/docusaurus/docs/user-docs/features/content-manager.md @@ -0,0 +1,513 @@ +--- +title: Content Manager +description: Learn to use the Content Manager. +toc_max_heading_level: 5 +tags: +- admin panel +- content manager +--- + +import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; + +# Content Manager + +The Content Manager is from where the users of the admin panel write and manage their content. + +:::prerequisites Identity Card of the Content Manager + **Role & permission:** Minimum "Configure view" permissions in Roles > Plugins - Content Manager.
+ **Environment:** Available in both Development & Production environment. +::: + +## Overview + + + +
+ +
+ +The Content Manager is accessible from ![Content icon](/img/assets/icons/v5/Feather.svg) *Content Manager* in the main navigation, which opens a sub navigation displaying 2 categories: _Collection types_ and _Single types_. Each category contains the available collection and single content-types which were created beforehand using the [Content-type Builder](/user-docs/content-type-builder/introduction-to-content-types-builder.md). From these 2 categories, administrators can create, manage, and publish content. + +:::tip +Click the search icon ![Search icon](/img/assets/icons/v5/Search.svg) in the sub navigation to use a text search and find one of your content-types more quickly! +::: + +### Collection types {#collection-types} + +The _Collection types_ category of the Content Manager displays the list of available collection types which are accessible from the ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager sub navigation. + +For each available collection type multiple entries can be created which is why each collection type is divided into 2 interfaces: the list view and the edit view (see [Writing content](/user-docs/content-manager/writing-content)). + +The list view of a collection type displays all entries created for that collection type. + + + +From the list view, it is possible to: + +- create a new entry , +- make a textual search or set filters to find specific entries, +- if [Internationalization (i18n)](/user-docs/plugins/strapi-plugins#i18n) is enabled, filter by locale to display only the entries [translated](/user-docs/content-manager/translating-content) in a chosen locale , +- configure the fields displayed in the table of the list view , +- if [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) is enabled, see the status of each entry , +- perform actions on a specific entry by clicking on ![More icon](/img/assets/icons/v5/More.svg) at the end of the row: + - edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) (see [Writing content](/user-docs/content-manager/writing-content.md)), duplicate ![Duplicate icon](/img/assets/icons/v5/Duplicate.svg), or delete ![Delete icon](/img/assets/icons/v5/Trash.svg) (see [Deleting content](/user-docs/content-manager/saving-and-publishing-content#deleting-content)) the entry, + - if [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) is enabled, ![Unpublish icon](/img/assets/icons/v5/CrossCircle.svg) unpublish the entry, ![Unpublish icon](/img/assets/icons/v5/CrossCircle.svg) or discard its changes, + - if [Internationalization (i18n)](/user-docs/plugins/strapi-plugins#i18n) is enabled, ![Delete locale icon](/img/assets/icons/v5/delete-locale.svg) delete a given locale, +- select multiple entries to simultaneously [publish, unpublish](/user-docs/content-manager/saving-and-publishing-content#bulk-publishing-and-unpublishing), or [delete](/user-docs/content-manager/saving-and-publishing-content#deleting-content). + +:::tip +Sorting can be enabled for most fields displayed in the list view table (see [Configuring the views of a content-type](../content-manager/configuring-view-of-content-type.md)). Click on a field name, in the header of the table, to sort on that field. +::: + +#### Filtering entries {#filtering-entries} + +Right above the list view table, on the left side of the interface, a ![Filters icon](/img/assets/icons/v5/Filter.svg) **Filters** button is displayed. It allows to set one or more condition-based filters, which add to one another (i.e. if you set several conditions, only the entries that match all the conditions will be displayed). + + + +To set a new filter: + +1. Click on the ![Filters icon](/img/assets/icons/v5/Filter.svg) **Filters** button. +2. Click on the 1st drop-down list to choose the field on which the condition will be applied. +3. Click on the 2nd drop-down list to choose the type of condition to apply. +4. Enter the value(s) of the condition in the remaining textbox. +5. Click on the **Add filter** button. + +:::note +When active, filters are displayed next to the ![Filters icon](/img/assets/icons/v5/Filter.svg) **Filters** button. They can be removed by clicking on the delete icon ![Clear icon](/img/assets/icons/v5/Cross.svg). +::: + +#### Creating a new entry + +On the top right side of the list view interface, an **Create new entry** button is displayed. It allows to create a new entry for your collection type. + +Clicking on the new entry button will redirect you to the edit view, where you will be able to write the content of the new entry (see [Writing content](/user-docs/content-manager/writing-content)). + +:::note +New entries are only considered created once some of their content has been written and saved once. Only then will the new entry be listed in the list view. +::: + +#### Configuring the table fields + +Above the list view table, on the right, a settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) is displayed. It allows to temporarily choose which fields to display in the table or to access permanent view settings. + +Above the list view table, on the right, a settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) is displayed. It allows to temporarily choose which fields to display in the table or to access permanent view settings. + +:::note +Configuring the displayed field of the table in the way detailed below is only temporary: the configurations will be reset as soon as the page is refreshed or when navigating outside the Content Manager. For permanent configurations, go to the list view configuration interface by clicking on the settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) and clicking on the ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view** button (see [Configuring the views of a content-type](../content-manager/configuring-view-of-content-type.md)). +::: + + + +To temporarily configure the fields displayed in the table: + +1. Click on the settings button ![Cog icon](/img/assets/icons/v5/Cog.svg). +2. Tick the boxes associated with the field you want to be displayed in the table. +3. Untick the boxes associated with the fields you do not want to be displayed in the table. + +:::tip +Relational fields can also be displayed in the list view. Please refer to [Configuring the views of a content-type](../content-manager/configuring-view-of-content-type.md) for more information on their specificities. +::: + +### Single types {#single-types} + +The _Single types_ category of the Content Manager displays the list of available single types, which are accessible from the ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager sub navigation. + +Unlike collection types which have multiple entries, single types are not created for multiple uses. In other words, there can only be one default entry per available single type. There is therefore no list view in the Single types category. + +Clicking on a single type will directly redirect you to the edit view, where you will be able to write the content of your single type (see [Writing content](/user-docs/content-manager/writing-content)). + + + +## Configuration + +Depending on their type, content-types can be divided into 2 interfaces: the list view and the edit view. Both interfaces can be configured. + +### Configuring the list view + +On the right side of the list view interface, right above the table, a settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) is displayed. It allows to access the configurations that can be set for the list view of your collection type, and to choose which fields to display in the table. + +:::note +The configurations only apply to the list view of the collection type from which the settings are accessed (i.e. disabling the filters or search options for a collection type will not automatically also disable these same options for all other collection types). +
+ +Note also that the explanations below explain how to permanently configure which fields are displayed in the table of the list view of your collection type. It is also possible to configure the displayed fields temporarily (see [Introduction to Content Manager](/user-docs/content-manager)). +::: + + + +#### List view settings + +1. In the list view of your collection type, click on the settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) then ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view** to be redirected to the list view configuration interface. +2. In the Settings area, define your chosen new settings: + +| Setting name | Instructions | +| ---------------------- | -------------------------------------------------------------------------------------------------- | +| Enable search | Click on **TRUE** or **FALSE** to able or disable the search. | +| Enable filters | Click on **TRUE** or **FALSE** to able or disable filters. | +| Enable bulk actions | Click on **TRUE** or **FALSE** to able or disable the multiple selection boxes in the list view table. | +| Entries per page | Choose among the drop-down list the number of entries per page. | +| Default sort attribute | Choose the sorting field that will be used by default. | +| Default sort order | Choose the sorting type that will be applied by default. | + +3. Click on the **Save** button. + +#### List view display + +1. In the list view of your collection type, click on the settings button ![Cog icon](/img/assets/icons/v5/Cog.svg) then ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view** to be redirected to the list view configuration interface. +2. In the View area, define what fields to display in the list view table, and in what order: + - Click the add button ![Add icon](/img/assets/icons/v5/Plus.svg) to add a new field. + - Click the delete button ![Clear icon](/img/assets/icons/v5/Cross.svg) to remove a field. + - Click the reorder button ![Drag icon](/img/assets/icons/v5/Drag.svg) and drag and drop it to the place you want it to be displayed among the other fields. +3. Click the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) to access its available own settings: + +| Setting name | Instructions | +| ------------------------- | ------------------------------------------------------------------------- | +| Label | Write the label to be used for the field in the list view table. | +| Enable sort on this field | Click on **TRUE** or **FALSE** to able or disable the sort on the field. | + +4. Click on the **Save** button. + +:::note +Relational fields can also be displayed in the list view. There are however some specificities to keep in mind: + +- Only one field can be displayed per relational field. +- Only first-level fields can be displayed (i.e. fields from the relation of a relation can't be displayed). +- If the displayed field contains more than one value, not all its values will be displayed, but a counter indicating the number of values. You can hover this counter to see a tooltip indicating the first 10 values of the relational field. + +Note also that relational fields have a couple limitations when it comes to sorting options: + +- Sorting cannot be enabled for relational fields which display several fields. +- Relational fields cannot be set as default sort. +::: + +### Configuring the edit view + +In the edit view of a content-type, a ![More icon](/img/assets/icons/v5/More.svg) button is displayed, which leads to the ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view** button. It allows to access the configurations that can be set for the edit view of the content-type, such as the entry title, and the display of the fields of the content-type, including the relational ones. + + + +#### Edit view settings + +1. In the edit view of your content-type, click on the ![More icon](/img/assets/icons/v5/More.svg) button then ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view**. +2. In the Settings area, define your chosen new settings: + +| Setting name | Instructions | +| --------------- | ------------------------------------------------------------------------------------- | +| Entry title | Choose among the drop-down list the field that should be used as title for the entry. | + +3. Click on the **Save** button. + +#### Edit view display + +1. In the edit view of your content-type, click on the ![More icon](/img/assets/icons/v5/More.svg) button then ![List + icon](/img/assets/icons/v5/ListPlus.svg) **Configure the view**. +2. In the View area, define what fields (including relational fields) to display in the list view table, in what order and what size: + - Click the ![Add icon](/img/assets/icons/v5/Plus.svg) **Insert another field** button to add a new field. + - Click the delete button ![Clear icon](/img/assets/icons/v5/Cross.svg) to remove a field. + - Click the reorder button ![Drag icon](/img/assets/icons/v5/Drag.svg) and drag and drop it to the place you want it to be displayed among the other fields. +3. Click the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) of a field to access its available settings: + +| Setting name | Instructions | +| --------------- | ----------------------------------------------------------------------------------------- | +| Label | Write the label that should be used for the field. | +| Description | Write a description for the field, to help other administrators fill it properly. | +| Placeholder | Write the placeholder that should be displayed by default in the field. | +| Editable field | Click on **TRUE** or **FALSE** to able or disable the edition of the field by administrators. | +| Size | Select the size in which the field should be displayed in the Content Manager. Note that this setting is neither available for JSON and Rich Text fields, nor dynamic zones and components. | +| Entry title | *(relational fields only)* Write the entry title that should be used for the relational field. It is recommended to choose well the entry title of relational fields as the more comprehensive it is, the easier it will be for administrators to manage the content of relational fields from the edit view. | + +4. Click on the **Save** button. + +:::caution +The settings and display of a component's fields cannot be managed and reordered through the entry's edit view configuration page. Click on the **Set the component's layout** button of a component to access the component's own configuration page. You will find the exact same settings and display options as for the entry, but that will specifically apply to your component. + +Note also that the settings are defined for the component itself, which means that the settings will automatically be applied for every other content-type where the component is used. +::: + +## Usage + +### Writing content + +In Strapi, writing content consists in filling up fields, which are meant to contain specific content (e.g. text, numbers, media, etc.). These fields were configured for the collection or single type beforehand, through the [Content-type Builder](/user-docs/content-type-builder). + + + +To write or edit content: + +1. Access the edit view of your collection type or single type. +2. Write your content, following the available field schema. You can refer to the table below for more information and instructions on how to fill up each field type. + +:::info +If Draft & Publish is enabled for your content-type (it's enabled by default), the fields work the same way whether you are editing the draft or published version. See [Saving, publishing, and deleting content](/user-docs/content-manager/saving-and-publishing-content) for more information about the Draft & Publish feature. +::: + +| Field name | Instructions | +| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Text | Write your content in the textbox. | +| Rich text (Markdown) | Write your textual content in the editor, in Markdown. Some basic formatting options (titles, bold, italics, underline) are available in the top bar of the editor to apply to selected text. A **Preview mode/Markdown mode** button to switch between modes is also available.

💡 The box can be expanded by clicking on **Expand** in the bottom bar. It displays side by side, at the same time, the textbox that you can edit and the preview. | +| Rich text (Blocks) | Write and manage your content in the editor, which automatically renders live all additions/updates. In the Blocks editor, paragraphs behave as blocks of text: hovering on a paragraph will display an icon ![Reorder icon](/img/assets/icons/v5/Drag.svg) on which to click to reorder the content. Options to format or enrich the content are also accessible from the top bar of the editor (basic formatting options, code, links, image etc.).

💡 You can use text formatting keyboard shortcuts in the Blocks editor (e.g. bold, italics, underline, and pasting link). | +| Number | Write your number in the textbox. Up and down arrows, displayed on the right of the box, allow to increase or decrease the current number indicated in the textbox. | +| Date | 1. Click the date and/or time box.
2. Type the date and time or choose a date using the calendar and/or a time from the list. The calendar view fully supports keyboard-based navigation. | +| Media | 1. Click the media area.
2. Choose an asset from the [Media Library](/user-docs/media-library) or from a [folder](/user-docs/media-library/organizing-assets-with-folders.md) if you created some, or click the **Add more assets** button to add a new file to the Media Library.

💡 It is possible to drag and drop the chosen file in the media area. | +| Relation | Choose an entry from the drop-down list. See [Managing relational fields](/user-docs/content-manager/managing-relational-fields.md) for more information. | +| Boolean | Click on **TRUE** or **FALSE**. | +| JSON | Write your content, in JSON format, in the code textbox. | +| Email | Write a complete and valid email address. | +| Password | Write a password.

💡 Click the ![Eye icon](/img/assets/icons/v5/Eye.svg) icon, displayed on the right of the box, to show the password. | +| Enumeration | 1. Click the drop-down list.
2. Choose an entry from the list. | +| UID | Write a unique identifier in the textbox. A "Regenerate" button, displayed on the right of the box, allows automatically generating a UID based on the content type name. | + +:::note +Filling out a [custom field](/user-docs/content-type-builder/configuring-fields-content-type.md#custom-fields) depends on the type of content handled by the field. Please refer to the dedicated documentation for each custom field hosted on the [Marketplace](https://market.strapi.io). +::: + +#### Components + +Components are a combination of several fields, which are grouped together in the edit view. Writing their content works exactly like for independent fields, but there are some specificities to components. + +There are 2 types of components: non-repeatable and repeatable components. + +##### Non-repeatable components + + + + +Non-repeatable components are a combination of fields that can be used only once. + +By default, the combination of fields is not directly displayed in the edit view: + +1. Click on the add button ![Add icon](/img/assets/icons/v5/PlusCircle.svg) to add the component. +2. Fill in the fields of the component. + +To delete the non-repeatable component, click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg), located in the top right corner of the component area. + +##### Repeatable components + + + +Repeatable components are also a combination of fields, but they allow the creation of multiple component entries, all following the same combination of fields. + +To add a new entry and display its combination of fields: + +1. Click on the add button ![Add icon](/img/assets/icons/v5/PlusCircle.svg) to add the component. +2. Fill in the fields of the component. +3. (optional) Click on the **Add an entry** button and fill in the fields again. + +The repeatable component entries can be reordered or deleted directly in the edit view, using buttons displayed on the right of the entry area. + +- Use the drag & drop button ![Drag icon](/img/assets/icons/v5/Drag.svg) to reorder entries of your repeatable component. +- Use the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) to delete an entry from your repeatable component. + +:::note +Unlike regular fields, the order of the entries of a repeatable component is important. It should correspond exactly to how end users will read/see the content. +::: + +#### Dynamic zones + +Dynamic zones are a combination of components, which themselves are composed of several fields. Writing the content of a dynamic zone requires additional steps in order to access the fields. + + + + + +1. Click on the ![Add icon](/img/assets/icons/v5/PlusCircle.svg) **Add a component to [dynamic zone name]** button. +2. Choose a component available for the dynamic zone. +3. Fill in the fields of the component. + +Dynamic zones' components can also be reordered or deleted directly in the edit view, using buttons displayed in the top right corner of the component area. + +- Use the drag & drop button ![Drag icon](/img/assets/icons/v5/Drag.svg) to reorder components in your dynamic zone. +- Use the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) to delete a component from your dynamic zone. + +:::tip +You can also use the keyboard to reorder components: focus the component using Tab, press Space on the drag & drop button ![Drag icon](/img/assets/icons/v5/Drag.svg) and use the arrow keys to then re-order, pressing Space again to drop the item. +::: + +:::note +Unlike regular fields, the order of the fields and components inside a dynamic field is important. It should correspond exactly to how end users will read/see the content. +::: + +#### Relational fields + +Relation-type fields added to a content-type from the Content-type Builder allow establishing a relation with another collection type. These fields are called "relational fields". + +The content of relational fields is written from the edit view of the content-type they belong to (see [Writing content](/user-docs/content-manager/writing-content)). However, relational fields can point to one or several entries of the other collection type, this is why in the Content Manager it is possible to manage a content-type's relational fields to choose which entries are relevant. + +
+Example + +In my Strapi admin panel I have created 2 collection types: + +- Restaurant, where each entry is a restaurant +- Category, where each entry is a type of restaurant + +I want to assign a category to each of my restaurants, therefore I have established a relation between my 2 collection types: restaurants can have one category. + +In the Content Manager, from the edit view of my Restaurant entries, I can manage the Category relational field, and choose which entry of Category is relevant for my restaurant. +
+ + + +The relational fields of a content-type are displayed among regular fields. For each relational field is displayed a drop-down list containing all available entry titles. It allows to choose which entry the relational fields should point to. You can either choose one or several entries depending on the type of relation that was established. + +:::tip +Not all entries are listed by default: more can be displayed by clicking on the **Load more** button. Also, instead of choosing an entry by scrolling the list, you can click any relational field drop-down list and type to search a specific entry. +::: + +:::note +If the Draft & Publish feature (see [Saving, publishing and deleting content](/user-docs/content-manager/saving-and-publishing-content)) is activated for the content-type the relational field belongs to, you will notice blue or green dots next to the entries names in the drop-down list. They indicate the status of the entry, respectively draft or published content. +::: + +:::caution +If the [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is installed, the list of entries may be limited or differ from one locale to another. Only relevant entries that can possibly be chosen for a relational field will be listed. +::: + +##### Managing one-choice relational fields + +Many-to-one, one-to-one, and one-way types of relation only allow to choose one entry per relational field. + + + +To select the only relevant relational field's entry: + +1. In the content-type's edit view, click on the drop-down list of the relational field. +2. Among the list of entries, choose one. + +:::tip +You can click on the name of the selected entry to be redirected to the edit view of the relational field's content type. Make sure you save your page first, to avoid losing your last modifications. +::: + +To remove the entry selected in the drop-down list, click on the delete button ![Clear icon](/img/assets/icons/v5/Cross.svg). + +##### Managing multiple-choice relational fields + +Many-to-many, one-to-many, and many-ways types of relation allow to choose several entries per relational field. + + + +To select the relevant relational field's entries: + +1. In the content-type's edit view, click on the drop-down list of the relational field. +2. Among the list of entries, choose one. +3. Repeat step 2 until all relevant entries have been chosen. + +:::tip +All selected entries are listed right below the drop-down list. Click on the name of an entry to be redirected to the edit view of the relational field's content-type. Make sure you save your page first, to avoid losing your last modifications. +::: + +To remove an entry, click on the cross button ![Cross icon](/img/assets/icons/v5/Cross.svg) in the selected entries list. + +Entries from multiple-choice relational fields can be reordered, indicated by a drag button ![Drag icon](/img/assets/icons/v5/Drag.svg). To move an entry, click and hold it, drag it to the desired position, then release it. + +### Deleting content + +You can delete content by deleting any entry of a collection type, or the default entry of a single type. + +1. In the edit view of the entry, click on ![More icon](/img/assets/icons/v5/More.svg) at the top right of the interface, and click the **Delete document** button.
If Internationalization is enabled for the content-type, you can also choose to delete only the currently selected locale by clicking on the **Delete locale** button. +2. In the window that pops up, click on the **Confirm** button to confirm the deletion. + +:::tip +You can delete entries from the list view of a collection type, by clicking on ![More icon](/img/assets/icons/v5/More.svg) on the right side of the entry's record in the table, then choosing the ![Delete icon](/img/assets/icons/v5/Trash.svg) **Delete document** button.
If Internationalization is enabled for the content-type, **Delete document** deletes all locales while **Delete locale** only deletes the currently listed locale. diff --git a/docusaurus/docs/user-docs/features/content-type-builder.md b/docusaurus/docs/user-docs/features/content-type-builder.md new file mode 100644 index 0000000000..92b6cc0876 --- /dev/null +++ b/docusaurus/docs/user-docs/features/content-type-builder.md @@ -0,0 +1,730 @@ +--- +title: Content-type Builder +description: Learn to use the Content-type Builder. +toc_max_heading_level: 5 +tags: +- admin panel +- content type builder +--- + +import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; + +# Content-type Builder + +The Content-type Builder is from where the users of the admin panel create and edit their content types. + +:::prerequisites Identity Card of the Content-type Builder + **Role & permission:** Minimum "Read" permission in Roles > Plugins - Content Type Builder.
+ **Environment:** Available in Development environment only. +::: + +## Overview + + + +From the Content-type Builder, administrators can create and manage content-types: collection types and single types but also components. + +- Collection types are content-types that can manage several entries. +- Single types are content-types that can only manage one entry. +- Components are a data structure that can be used in multiple collection types and single types. + +All 3 are displayed as categories in the sub navigation of the Content-type Builder. In each category are listed all content-types and components that have already been created. + +From each category of the Content-type Builder sub navigation, it is possible to: + +- click on an existing content-type or component to access it and edit it (see [Managing content-types](/user-docs/content-type-builder/managing-content-types)), +- or create a new content-type or component (see [Creating content-types](/user-docs/content-type-builder/creating-new-content-type)). + +:::tip +Click the search icon ![Search icon](/img/assets/icons/v5/Search.svg) in the Content-type Builder sub navigation to find a specific collection type, single type, or component. +::: + +## Usage + +### Creating content-types + +:::note Development-only +The Content-type Builder is only accessible to create and update content-types when your Strapi application is in a development environment, else it will be in a read-only mode in other environments. +::: + +The Content-type Builder allows to create new content-types: single and collection types. Although they are not proper content-types as they cannot exist independently, components can also be created through the Content-type Builder, in the same way as collection and single types. + +#### Creating a new content-type + + + +Content types are created from the Content-type Builder's Collection types and Single types categories, both displayed in the Content-type Builder sub navigation. + +To create a new content-type: + +1. Choose whether you want to create a collection type or a single type. +2. In the category of the content-type you want to create, click on **Create new collection/single type**. +3. In the content-type creation window, write the name of the new content-type in the *Display name* textbox. +4. Check the *API ID* to make sure the automatically pre-filled values are correct. Collection type names are indeed automatically pluralized when displayed in the Content Manager. It is recommended to opt for singular names, but the *API ID* field allows to fix any pluralization mistake. +5. (optional) In the Advanced Settings tab, configure the available settings for the new content-type: + + | Setting name | Instructions | + |-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------| + | Draft & publish | Tick the checkbox to allow entries of the content-type to be managed as draft versions, before they are published (see [Saving & publishing content](/user-docs/content-manager/saving-and-publishing-content#saving--publishing-content)). | + | Internationalization | Tick the checkbox to allow entries of the content-type to be translated into other locales. | + + + +6. Click on the **Continue** button. +7. Add and configure chosen fields for your content-type (see [Configuring fields for content-types](/user-docs/content-type-builder/configuring-fields-content-type)). +8. Click on the **Save** button. + +:::caution +New content-types are only considered created once they have been saved. Saving is only possible if at least one field has been added and properly configured. If these steps have not been done, a content-type cannot be created, listed in its category in the Content-type Builder, and cannot be used in the Content Manager. +::: + +#### Creating a new component + + + +Components are created from the same-named category of the Content-type Builder's sub navigation. + +To create a new component: + +1. In the Components category of the Content-type Builder sub navigation, click on **Create new component**. +2. In the component creation window, configure the base settings of the new component: + - Write the name of the component in the *Display name* textbox. + - Select an available category, or enter in the textbox a new category name to create one. + - _(optional)_ Choose an icon representing the new component. You can use the search ![Search icon](/img/assets/icons/v5/Search.svg) to find an icon instead of scrolling through the list. +3. Click on the **Continue** button. +4. Add and configure chosen fields for your component (see [Configuring fields for content-types](/user-docs/content-type-builder/configuring-fields-content-type)). +5. Click on the **Save** button. + +### Configuring fields for content-types + +:::note Development-only +The Content-type Builder is only accessible to create and update content-types when your Strapi application is in a development environment, else it will be in a read-only mode in other environments. +::: + +Content-types are composed of one or several fields. Each field is designed to contain specific kind of data, filled up in the Content Manager (see [Writing content](/user-docs/content-manager/writing-content.md)). + +In the Content-type Builder, fields can be added at the creation of a new content-type or component, or afterward when a content-type or component is edited or updated. The following documentation lists all existing regular fields but also tackles the specificities of components and dynamic zones. For each, you will find a definition, explanation of the form they take once in the Content Manager, and instructions to configure them. + +:::note +Depending on what content-type or component is being created or edited, not all fields -including components and dynamic zones- are always available. +::: + + + +#### Regular fields + +##### Text {#text} + +The Text field displays a textbox that can contain small text. This field can be used for titles, descriptions, etc. + + + + + +| Setting name | Instructions | +|--------------|---------------------------------------------------------------------------------------------------------| +| Name | Write the name of the Text field. | +| Type | Choose between *Short text* (255 characters maximum) and *Long text*, to allow more or less space to fill up the Text field. | + + + + + +| Setting name | Instructions | +|----------------|-------------------------------------------------------------------------------| +| Default value | Write the default value of the Text field. | +| RegExp pattern | Write a regular expression to make sure the value of the Text field matches a specific format. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + +##### Rich Text (Blocks) {#rich-text-blocks} + +The Rich Text (Blocks) field displays an editor with live rendering and various options to manage rich text. This field can be used for long written content, even including images and code. + + + + + +| Setting name | Instructions | +|--------------|-------------------------------------------------| +| Name | Write the name of the Rich Text (Blocks) field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | + + + + + +:::strapi React renderer +If using the Blocks editor, we recommend that you also use the [Strapi Blocks React Renderer](https://github.com/strapi/blocks-react-renderer) to easily render the content in a React frontend. +::: + +##### Number {#number} + +The Number field displays a field for any kind of number: integer, decimal and float. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Number field. | +| Number format | Choose between *integer*, *big integer*, *decimal* and *float*. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Number field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | +| Maximum value | Tick to define a maximum value allowed. | +| Minimum value | Tick to define a minimum value allowed. | + + + + + +##### Date {#date} + +The Date field can display a date (year, month, day), time (hour, minute, second) or datetime (year, month, day, hour, minute, and second) picker. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Date field. | +| Type | Choose between *date*, *datetime* and *time* | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Date field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | + + + + + +##### Password + +The Password field displays a password field that is encrypted. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Password field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Password field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + + +##### Media {#media} + +The Media field allows to choose one or more media files (e.g. image, video) from those uploaded in the Media Library of the application. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Media field. | +| Type | Choose between *Multiple media* to allow multiple media uploads, and *Single media* to only allow one media upload. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Select allowed types of media | Click on the drop-down list to untick media types not allowed for this field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | + + + + + +##### Relation {#relation} + +The Relation field allows to establish a relation with another content-type, that must be a collection type. + +There are 6 different types of relations: + +- One way: Content-type A *has one* Content-type B +- One-to-one: Content-type A *has and belong to one* Content-type B +- One-to-many: Content-type A *belongs to many* Content-type B +- Many-to-one: Content-type B *has many* Content-type A +- Many-to-many: Content-type A *has and belongs to many* Content-type B +- Many way: Content-type A *has many* Content-type B + + + + + +Configuring the base settings of the Relation field consists in choosing with which existing content-type the relation should be established and the kind of relation. The edition window of the Relation field displays 2 grey boxes, each representing one of the content-types in relation. Between the grey boxes are displayed all possible relation types. + +1. Click on the 2nd grey box to define the content-type B. It must be an already created collection type. +2. Click on the icon representing the relation to establish between the content-types. +3. Choose the *Field name* of the content-type A, meaning the name that will be used for the field in the content-type A. +4. (optional if disabled by the relation type) Choose the *Field name* of the content-type B. + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Private field | Tick to make the field private and prevent it from being found via the API. | + + + + + +##### Boolean {#boolean} + +The Boolean field displays a toggle button to manage boolean values (e.g. Yes or No, 1 or 0, True or False). + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Boolean field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Choose the default value of the Boolean field: *true*, *null* or *false*. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | + + + + + +##### JSON {#json} + +The JSON field allows to configure data in a JSON format, to store JSON objects or arrays. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the JSON field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | + + + + + +##### Email {#email} + +The Email field displays an email address field with format validation to ensure the email address is valid. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Email field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Email field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Unique field | Tick to prevent another field to be identical to this one. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + +##### Password {#password} + +The Password field displays a password field that is encrypted. + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Password field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Password field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + +##### Enumeration {#enum} + +The Enumeration field allows to configure a list of values displayed in a drop-down list. + + + + + + + +| Setting name | Instructions | +|---------------|-----------------------------------------------------------------| +| Name | Write the name of the Enumeration field. | +| Values | Write the values of the enumeration, one per line. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Choose the default value of the Enumeration field. | +| Name override for GraphQL | Write a custom GraphQL schema type to override the default one for the field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | + + + + + +:::caution +Since Strapi v4.1.3, enumeration values should always have an alphabetical character preceding any number as it could otherwise cause the server to crash without notice when the GraphQL plugin is installed. +::: + +##### UID {#uid} + +The UID field displays a field that sets a unique identifier, optionally based on an existing other field from the same content-type. + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------| +| Name | Write the name of the UID field. It must not contain special characters or spaces. | +| Attached field | Choose what existing field to attach to the UID field. Choose *None* to not attach any specific field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the UID field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + +:::tip +The UID field can be used to create a slug based on the Attached field. +::: + +##### Rich Text (Markdown) {#rich-text-markdown} + +The Rich Text (Markdown) field displays an editor with basic formatting options to manage rich text written in Markdown. This field can be used for long written content. + + + + + +| Setting name | Instructions | +|--------------|---------------------------------------------------| +| Name | Write the name of the Rich Text (Markdown) field. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------| +| Default value | Write the default value of the Rich Text field. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the field to have a different value per locale. | +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Maximum length | Tick to define a maximum number of characters allowed. | +| Minimum length | Tick to define a minimum number of characters allowed. | + + + + + +#### Custom fields + +Custom fields are a way to extend Strapi’s capabilities by adding new types of fields to content-types or components. Once installed (see [Marketplace](/user-docs/plugins/installing-plugins-via-marketplace.md) documentation), custom fields are listed in the _Custom_ tab when selecting a field for a content-type. + +Each custom field type can have basic and advanced settings. The [Marketplace](https://market.strapi.io/plugins?categories=Custom+fields) lists available custom fields, and hosts dedicated documentation for each custom field, including specific settings. + +#### Components {#components} + +Components are a combination of several fields. Components allow to create reusable sets of fields, that can be quickly added to content-types, dynamic zones but also nested into other components. + +When configuring a component through the Content-type Builder, it is possible to either: + +- create a new component by clicking on *Create a new component* (see [Creating a new component](/user-docs/content-type-builder/creating-new-content-type#creating-a-new-component)), +- or use an existing one by clicking on *Use an existing component*. + + + + + +| Setting name | Instructions | +|--------------------|-----------------------------------------------------------------| +| Name | Write the name of the component for the content-type. | +| Select a component | When using an existing component only - Select from the drop-down list an existing component. | +| Type | Choose between *Repeatable component* to be able to use several times the component for the content-type, or *Single component* to limit to only one time the use of the component. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------------------| +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Private field | Tick to make the field private and prevent it from being found via the API. | +| Maximum value | For repeatable components only - Tick to define a maximum number of characters allowed. | +| Minimum value | For repeatable components only - Tick to define a minimum number of characters allowed. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the component to be translated per available locale. | + + + + + +#### Dynamic zones {#dynamiczones} + +Dynamic zones are a combination of components that can be added to content-types. They allow a flexible content structure as once in the Content Manager, administrators have the choice of composing and rearranging the components of the dynamic zone how they want. + + + + + +| Setting name | Instructions | +|--------------------|-----------------------------------------------------------------| +| Name | Write the name of the dynamic zone for the content-type. | + + + + + +| Setting name | Instructions | +|----------------|-----------------------------------------------------------------------------------------| +| Required field | Tick to prevent creating or saving an entry if the field is not filled in. | +| Maximum value | Tick to define a maximum number of characters allowed. | +| Minimum value | Tick to define a minimum number of characters allowed. | +| Enable localization for this field | (if [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is enabled for the content-type) Allow the dynamic zone to be translated per available locale. | + + + + + +After configuring the settings of the dynamic zone, its components must be configured as well. It is possible to either choose an existing component or create a new one. + +:::caution +When using dynamic zones, different components cannot have the same field name with different types (or with enumeration fields, different values). +::: + +### Managing content-types + +:::note development-only +The Content-type Builder is only accessible to create and update content-types when your Strapi application is in a development environment, else it will be in a read-only mode in other environments. +::: + +The Content-type Builder allows to manage any existing content-type or component, even if it is already being used in the Content Manager. They can only be managed one at a time. + +To manage a content-type or a component, click on its name in the Collection types, Single types or Components category. + +#### Editing content-types + +Managing a content-type or component can include editing the general settings and the fields, but also deleting the whole content-type or component. For any chosen content-type or component, the right side of the Content-type Builder interface displays all available editing options. + + + +- Next to the name and optional description of the content-type or component, an ![Edit icon](/img/assets/icons/v5/Pencil.svg) **Edit** button allows to access the [basic settings](#editing-content-type-or-component-settings) of the content-type or component. +- In the top right corner: + - the **Add new/another field** and **Save** buttons allow to respectively add another field to the content-type or component (see [Configuring fields for content-types](/user-docs/content-type-builder/configuring-fields-content-type)), or save any ongoing modification. + - the **Configure the view** button allows to access the view configuration interface (see [Configuring the edit view](/user-docs/content-manager/configuring-view-of-content-type#configuring-the-edit-view)) +- Below the previous editing options, a table lists all the fields created and configured for the content-type or component. From the fields table, it is possible to: + - Click on the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) to edit a field + - Click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) to delete a field + +:::caution +Editing a field allows renaming it. However, keep in mind that regarding the database, renaming a field means creating a whole new field and deleting the former one. Although nothing is deleted from the database, the data that was associated with the former field name will not be accessible from the admin panel of your application anymore. +::: + +##### Editing content-type or component settings + +The settings of a content-type or component can be edited through the Content-type Builder. There are two tabs available: **Basic Settings** and **Advanced Settings**. + +###### Basic settings + +The **Basic Settings** tab allows to edit the following properties of the content-type or component: + + + +* **Display name**: Name of the content-type or component as it will be displayed in the admin panel. +* **API ID (singular)**: Name of the content-type or component as it will be used in the API. It is automatically generated from the display name, but can be edited. +* **API ID (plural)**: Plural name of the content-type or component as it will be used in the API. It is automatically generated from the display name, but can be edited. +* **Type**: Type of the content-type or component. It can be either a **Collection type** or a **Single type**. + +###### Advanced settings + +The **Advanced Settings** tab allows to edit the following properties of the content-type or component: + + + +* **Draft & Publish**: Enable the [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) feature for the content-type or component. It is disabled by default. +* **Internationalization**: Enable the [Internationalization](/user-docs/content-manager/translating-content) feature for the content-type or component. It is disabled by default. + + + +#### Deleting content-types + +Content types and components can be deleted through the Content-type Builder. Deleting a content-type automatically deletes all entries from the Content Manager that were based on that content-type. The same goes for the deletion of a component, which is automatically deleted from every content-type or entry where it was used. + +To delete a content-type or component: + +1. In the Content-type Builder sub navigation, click on the name of the content-type or component to delete. +2. In the edition interface of the chosen content-type or component, click on the ![Edit icon](/img/assets/icons/v5/Pencil.svg) **Edit** button on the right side of the content-type's or component's name. +3. In the edition window, click on the **Delete** button. +4. In the confirmation window, confirm the deletion. + +:::caution +Deleting a content-type only deletes what was created and available from the Content-type Builder, and by extent from the admin panel of your Strapi application. All the data that was created based on that content-type is however kept in the database. For more information, please refer to the related [GitHub issue](https://github.com/strapi/strapi/issues/1114). +::: diff --git a/docusaurus/docs/user-docs/features/data-management.md b/docusaurus/docs/user-docs/features/data-management.md new file mode 100644 index 0000000000..1a4aa24beb --- /dev/null +++ b/docusaurus/docs/user-docs/features/data-management.md @@ -0,0 +1,137 @@ +--- +title: Data Management +sidebar_position: 1 +description: Learn to use the Data Management to import, export, or transfer data between different Strapi instances. +toc_max_heading_level: 5 +tags: +- admin panel +- features +- data management +- data import +- data export +- data transfer +--- + +# Data Management + +The Data Management feature can be used to import, export, or transfer data. Data Management is CLI-based only, but is partly configured in the admin panel. + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** Minimum "Access the transfer tokens settings page" permission in Roles > Settings - Transfer tokens.
+ **Activation:** Available and activated if a transfer salt is defined.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +Some configuration options for the Data Management feature are available in the admin panel, and some are handled via your Strapi project's code. + +### Admin panel settings + +:::prerequisites +A `transfer.token.salt` should be defined in the `config/admin` configuration file (see [code-based configuration](#code-based-configuration)). +::: + +Transfer tokens allow users to authorize the `strapi transfer` CLI command (see [Developer Documentation](/dev-docs/data-management/transfer)). Administrators can manage API tokens from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Transfer Tokens*. + + + +The *Transfer Tokens* settings sub-section displays a table listing all of the created Transfer tokens. + +The table displays each Transfer token's name, description, date of creation, and date of last use. From the table, administrators can also: + +- Click on the ![edit button](/img/assets/icons/v5/Pencil.svg) to edit a transfer token's name, description, or type, or [regenerate the token](#regenerating-a-transfer-token). +- Click on the ![delete button](/img/assets/icons/v5/Trash.svg) to delete a Transfer token. + +#### Creating a new transfer token + +To create a new Transfer token: + +1. Click on the **Create new Transfer Token** button. +2. In the Transfer token edition interface, configure the new Transfer token: + + | Setting name | Instructions | + | -------------- | ----------------------------------------------------------------------------- | + | Name | Write the name of the Transfer token. | + | Description | (optional) Write a description for the Transfer token. | + | Token duration | Choose a token duration: *7 days*, *30 days*, *90 days*, or *Unlimited*. | + | Token type | Choose a token type:
  • *Push* to allow transfers from local to remote instances only,
  • *Pull* to allow transfers from remote to local instances only,
  • or *Full Access* to allow both types of transfer.
| + +3. Click on the **Save** button. The new Transfer token will be displayed at the top of the interface, along with a copy button ![copy button](/img/assets/icons/v5/Duplicate.svg). + + + +:::caution +For security reasons, Transfer tokens are only shown right after they have been created. When refreshing the page or navigating elsewhere in the admin panel, the newly created Transfer token will be hidden and will not be displayed again. +::: + +#### Regenerating a Transfer token + +To regenerate an Transfer token: + +1. Click on the Transfer token's edit button. +2. Click on the **Regenerate** button. +3. Click on the **Regenerate** button to confirm in the dialog. +4. Copy the new Transfer token displayed at the top of the interface. + +### Code-based configuration + +A `transfer.token.salt` value must be defined in [the `config/admin` file](/dev-docs/configurations/admin-panel) so that transfer tokens can be properly generated. If no value is defined, the feature will be disabled. The salt can be any long string, and for increased security, it's best to add it to the [environment variables](/dev-docs/configurations/environment) and import it using the `env()` utility as in the following example: + + + + + +```js title="/config/admin.js" +module.exports = ({ env }) => ({ + // … + transfer: { + token: { + salt: env('TRANSFER_TOKEN_SALT', 'anotherRandomLongString'), + } + }, +}); + +``` + + + + + +```ts title="/config/admin.ts" +export default ({ env }) => ({ + // … + transfer: { + token: { + salt: env('TRANSFER_TOKEN_SALT', 'anotherRandomLongString'), + } + }, +}); +``` + + + + + +## Usage + +The Data Management system is CLI-based only, meaning any import, export, or transfer command must be executed from the terminal. Exhaustive documentation for each command is accessible from the following pages: + + + + + + diff --git a/docusaurus/docs/user-docs/features/draft-and-publish.md b/docusaurus/docs/user-docs/features/draft-and-publish.md new file mode 100644 index 0000000000..b9d41ceaeb --- /dev/null +++ b/docusaurus/docs/user-docs/features/draft-and-publish.md @@ -0,0 +1,202 @@ +--- +title: Draft & Publish +description: Learn how you can use the Draft & Publish feature of Strapi 5 to manage drafts for content. +displayed_sidebar: cmsSidebar +toc_max_heading_level: 5 +tags: + - Content Manager + - Content type Builder + - Draft & Publish + - publishing a draft + - unpublishing content +--- + +# Draft & Publish + +The Draft & Publish feature allows to manage drafts for your content. + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** None.
+ **Activation:** Available but disabled by default.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Configuration + +**Path to configure the feature:** ![CTB icon](/img/assets/icons/v5/Layout.svg) Content Type Builder + +For your content types to be managed with Draft & Publish in the Content Manager, the feature must be enabled through the Content-type Builder. Draft & Publish can be configured for each content type. + +To enable Draft & Publish: + +1. Either edit an already created content type of your choice, or create a new content type (see Content Type Builder documentation for more information). +2. Go to the **Advanced settings** tab. +3. Tick the Draft & Publish option. +4. Click the **Finish** button. + + + +## Usage + + + +With Draft & Publish enabled, the Content Manager's edit view indicates the current status of your content type's entry at the top of the interface. Your content can have 3 statuses: + +- Published: The content was previously published. There are no pending draft changes saved. +- Modified: The content was previously published. You made some changes to the draft version and saved these changes, but the changes have not been published yet. +- Draft: The content has never been published yet. + + + + + +### Working with drafts + +**Path to use the feature:** ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager, edit view of your content type + +While editing a document, you can see 2 tabs: + +- The _Draft_ tab is where you can edit your content. +- The _Published_ tab is a read-only tab where edition of all fields is disabled. The _Published_ tab only exists to show what is the content of fields in the published version. + + + +By default, each newly created content is a draft. Drafts can be modified and saved at will, using the **Save** button in the _Entry_ box on the right side of the interface, until they are ready to be published. + +Once you made changes to a draft, you have 3 possible options, all available in the _Entry_ box on the right side of the interface: +- **Publish** your document (see [publishing a draft](#publishing-a-draft)), +- **Save** your draft for later retrieval, +- or discard changes, by clicking on ![More icon](/img/assets/icons/v5/More.svg) and choosing ![Discard changes icon](/img/assets/icons/v5/CrossCircle.svg) **Discard changes**. + +### Publishing a draft + +**Path to use the feature:** ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager, edit view of your content type + +To publish a draft, click on the **Publish** button in the _Entry_ box on the right side of the interface. + +After a draft is published: + +- The content of the _Draft_ and _Published_ tabs should be exactly the same (but the _Published_ tab remains read-only). +- The status, below the document's title, will switch to "Published". + +:::caution +Before publishing a draft, make sure it doesn't have relations with other non-published content, otherwise some of the content may not be available through the API. +::: + +When a document has both a draft and a published version available, the published version can be found in the _Published_ tab. If the document has only a draft version, you can not click on the _Published_ tab. + + + +:::tip +To schedule publication, i.e., convert a draft to a published entry at a given date and time, you can [include it in a release](/user-docs/content-manager/adding-content-to-releases) and [schedule the publication](/user-docs/releases/creating-a-release) of the release. +::: + +### Unpublishing content + +**Path to use the feature:** ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager, edit view of your content type + +To unpublish a previously published content: from the _Draft_ tab, click on ![More icon](/img/assets/icons/v5/More.svg) in the _Entry_ box on the right side of the interface and choose the **Unpublish** button. + +If the draft version of the document contains content different from the published version, you can decide what to do with both content when unpublishing: + +1. From the _Draft_ tab, click on ![More icon](/img/assets/icons/v5/More.svg) in the _Entry_ box on the right side of the interface and choose the **Unpublish** button. +2. In the Confirmation dialog that opens, you can choose to: + - **Unpublish and keep last draft**, so that all the content you currently have in the _Draft_ tab is preserved, but the all the content from the _Published_ tab is definitely gone + - **Unpublish and replace last draft** to discard any existing content in the _Draft_ tab and replace it with the content of all fields from the _Published_ tab +3. Click **Confirm**. The desired changes will be applied to both the _Draft_ and _Published_ tabs and the new status of the entry will also be reflected below the entry title. + + + +### Bulk actions + +**Path to use the feature:** ![Content icon](/img/assets/icons/v5/Feather.svg) Content Manager, list view of your content type + +Selecting multiple entries from the Content Manager's list view will display additional buttons to publish or unpublish several entries simultaneously. This is what is called "bulk publishing/unpublishing". + +:::caution +If the [Internationalization plugin](/user-docs/plugins/strapi-plugins#i18n) is installed, the bulk publish/unpublish actions only apply to the currently selected locale. +::: + + + +#### Bulk publishing drafts + +To publish several entries at the same time: + +1. From the list view of the Content Manager, select your entries to publish by ticking the box on the left side of the entries' record. +2. Click on the **Publish** button located above the header of the table. +3. In the _Publish entries_ dialog, check the list of selected entries and their status: + - ![Success icon](/img/assets/icons/v5/CheckCircle.svg) Ready to publish: the entry can be published + - ![Fail icon](/img/assets/icons/v5/CrossCircle2.svg) "[field name] is required", "[field name] is too short" or "[field name] is too long": the entry cannot be published because of the issue stated in the red warning message. +4. (optional) If some of your entries have a ![Edit icon](/img/assets/icons/v5/CrossCircle2.svg) status, click the ![Edit icon](/img/assets/icons/v5/Pencil.svg) edit buttons to fix the issues until all entries have the ![Success icon](/img/assets/icons/v5/CheckCircle.svg) Ready to publish status. Note that you will have to click on the **Refresh** button to update the _Publish entries_ dialog as you fix the various entries issues. +5. Click the **Publish** button. +6. In the confirmation dialog box, confirm your choice by clicking again on the **Publish** button. + +#### Bulk unpublishing content + +To unpublish several entries at the same time: + +1. From the list view of the Content Manager, select your entries to unpublish by ticking the box on the left side of the entries' record. +2. Click on the **Unpublish** button located above the header of the table. +3. In the confirmation dialog box, confirm your choice by clicking again on the **Unpublish** button. + +### Usage with APIs + +Draft or published content can be requested, created, updated, and deleted using the `status` parameter through the various front-end APIs accessible from [Strapi's Content API](/dev-docs/api/content-api): + + + + + + +On the back-end server of Strapi, the Document Service API can also be used to interact with localized content: + + + + + diff --git a/docusaurus/docs/user-docs/features/email.md b/docusaurus/docs/user-docs/features/email.md new file mode 100644 index 0000000000..3f91299642 --- /dev/null +++ b/docusaurus/docs/user-docs/features/email.md @@ -0,0 +1,204 @@ +--- +title: Email +displayed_sidebar: cmsSidebar +description: Send email from your server or externals providers. +tags: +- admin panel +- controllers +- email +- lifecycle hooks +- services +--- + +# Email + +The Email feature enables Strapi applications to send emails from a server or an external provider. + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** Email > "send" permission for the user to send emails via the backend server.
+ **Activation:** Available by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +Most configuration options for the Email feature are handled via your Strapi project's code. The Email feature is not configurable in the admin panel, however users can test email delivery if it has been setup by an administrator. + +### Admin panel settings + +**Path to configure the feature:** Settings > Email feature > Configuration + + + +In the Configuration section, only the email address field under "Test email delivery" is modifiable by users. A **send test email** button sends a test email. + +This page is only visible if the current role has the "Access the Email Settings page" permission enabled: + + + +### Code-based configuration + +The Email feature requires a provider and a provider configuration in the `config/plugins.js` file or `config/plugins.ts` file. See the [Providers](/dev-docs/providers) documentation for detailed installation and configuration instructions. + + + + + +[`Sendmail`](https://www.npmjs.com/package/sendmail) is the default email provider in the Strapi Email feature. It provides functionality for the local development environment but is not production-ready in the default configuration. For production stage applications you need to further configure `Sendmail` or change providers. + +## Usage + +The Email feature uses the Strapi global API, meaning it can be called from anywhere inside a Strapi application, either from the back-end server itself through a [controller or service](#controller-service), or from the admin panel, for example in response to an event (using [lifecycle hooks](#lifecycle-hook)). + +### Sending emails with a controller or service {#controller-service} + +The Email feature has an `email` [service](/dev-docs/backend-customization/services) that contains 2 functions to send emails: + +* `send()` directly contains the email contents, +* `sendTemplatedEmail()` consumes data from the Content Manager to populate emails, streamlining programmatic emails. + +#### Using the `send()` function + +To trigger an email in response to a user action add the `send()` function to a [controller](/dev-docs/backend-customization/controllers) or [service](/dev-docs/backend-customization/services). The send function has the following properties: + +| Property | Type | Format | Description | +|-----------|----------|---------------|-------------------------------------------------------| +| `from` | `string` | email address | If not specified, uses `defaultFrom` in `plugins.js`. | +| `to` | `string` | email address | Required | +| `cc` | `string` | email address | Optional | +| `bcc` | `string` | email address | Optional | +| `replyTo` | `string` | email address | Optional | +| `subject` | `string` | - | Required | +| `text` | `string` | - | Either `text` or `html` is required. | +| `html` | `string` | HTML | Either `text` or `html` is required. | + +The following code example can be used in a controller or a service: + +```js title="/src/api/my-api-name/controllers/my-api-name.ts|js (or /src/api/my-api-name/services/my-api-name.ts|js)" +await strapi.plugins['email'].services.email.send({ + to: 'valid email address', + from: 'your verified email address', //e.g. single sender verification in SendGrid + cc: 'valid email address', + bcc: 'valid email address', + replyTo: 'valid email address', + subject: 'The Strapi Email feature worked successfully', + text: 'Hello world!', + html: 'Hello world!', +}), +``` + +#### Using the `sendTemplatedEmail()` function + +The `sendTemplatedEmail()` function is used to compose emails from a template. The function compiles the email from the available properties and then sends the email. + +To use the `sendTemplatedEmail()` function, define the `emailTemplate` object and add the function to a controller or service. The function calls the `emailTemplate` object, and can optionally call the `emailOptions` and `data` objects: + +| Parameter | Description | Type | Default | +|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------|----------|---------| +| `emailOptions`
Optional | Contains email addressing properties: `to`, `from`, `replyTo`, `cc`, and `bcc` | `object` | { } | +| `emailTemplate` | Contains email content properties: `subject`, `text`, and `html` using [Lodash string templates](https://lodash.com/docs/4.17.15#template) | `object` | { } | +| `data`
Optional | Contains the data used to compile the templates | `object` | { } | + +The following code example can be used in a controller or a service: + +```js title="/src/api/my-api-name/controllers/my-api-name.js (or ./src/api/my-api-name/services/my-api-name.js)" +const emailTemplate = { + subject: 'Welcome <%= user.firstname %>', + text: `Welcome to mywebsite.fr! + Your account is now linked with: <%= user.email %>.`, + html: `

Welcome to mywebsite.fr!

+

Your account is now linked with: <%= user.email %>.

`, +}; + +await strapi.plugins['email'].services.email.sendTemplatedEmail( + { + to: user.email, + // from: is not specified, the defaultFrom is used. + }, + emailTemplate, + { + user: _.pick(user, ['username', 'email', 'firstname', 'lastname']), + } +); +``` + +### Sending emails from a lifecycle hook {#lifecycle-hook} + + To trigger an email based on administrator actions in the admin panel use [lifecycle hooks](/dev-docs/backend-customization/models#lifecycle-hooks) and the [`send()` function](#using-the-send-function). + + The following example illustrates how to send an email each time a new content entry is added in the Content Manager use the `afterCreate` lifecycle hook: + + + + + +```js title="/src/api/my-api-name/content-types/my-content-type-name/lifecycles.js" + +module.exports = { + async afterCreate(event) { // Connected to "Save" button in admin panel + const { result } = event; + + try{ + await strapi.plugin('email').service('email').send({ // you could also do: await strapi.service('plugin:email.email').send({ + to: 'valid email address', + from: 'your verified email address', // e.g. single sender verification in SendGrid + cc: 'valid email address', + bcc: 'valid email address', + replyTo: 'valid email address', + subject: 'The Strapi Email feature worked successfully', + text: '${fieldName}', // Replace with a valid field ID + html: 'Hello world!', + + }) + } catch(err) { + console.log(err); + } + } +} +``` + + + + + +```ts title="/src/api/my-api-name/content-types/my-content-type-name/lifecycles.ts" + +export default { + async afterCreate(event) { // Connected to "Save" button in admin panel + const { result } = event; + + try{ + await strapi.plugins['email'].services.email.send({ + to: 'valid email address', + from: 'your verified email address', // e.g. single sender verification in SendGrid + cc: 'valid email address', + bcc: 'valid email address', + replyTo: 'valid email address', + subject: 'The Strapi Email feature worked successfully', + text: '${fieldName}', // Replace with a valid field ID + html: 'Hello world!', + }) + } catch(err) { + console.log(err); + } + } +} + +``` + + + + diff --git a/docusaurus/docs/user-docs/features/internationalization.md b/docusaurus/docs/user-docs/features/internationalization.md new file mode 100644 index 0000000000..8b39260ad1 --- /dev/null +++ b/docusaurus/docs/user-docs/features/internationalization.md @@ -0,0 +1,118 @@ +--- +title: Internationalization +description: Learn how to use the Internationalization (i18n) feature that enables content managers to translate the content +toc_max_heading_level: 5 +tags: +- admin panel +- internationalization +- i18n +- translation +- locale +--- + +# Internationalization (i18n) + +The Internationalization feature allows to manage content in different languages, called "locales". + + + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** None.
+ **Activation:** Available but disabled by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +Before being usable in the Content Manager, the Internationalization feature must be configured from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Internationalization*, and it should be enabled on your content types from the ![CTB icon](/img/assets/icons/v5/Layout.svg) _Content-type Builder_. + +### Content-type Builder + +For your content types to be translatable with Internationalization in the Content Manager, the feature must be enabled through the Content-type Builder. Internationalization can be configured for each content type and/or field. + +To enable Internationalization: + +1. Go to the ![CTB icon](/img/assets/icons/v5/Layout.svg) _Content-type Builder_ via the main navigation of the admin panel. +2. Either edit the already created content type/field of your choice, or create a new content type/field. +3. Go to the **Advanced settings** tab. +4. Tick the option named "Internationalization" at content-type level, and "Enable localization for this field" at field level. + + + +### Settings + +The *Internationalization* settings sub-section displays a table listing all locales available for the Strapi application. By default, only the English locale is configured and set as the default locale. + +For each locale, the table displays the default ISO code of the locale, its optional display name and indicates if the locale is set as the default one. From the table, administrators can also: + +- Click on the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) to edit a locale +- Click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) to delete a locale + +#### Adding a new locale + +Administrators can add and manage as many locales as they want. There can however only be one locale set as the default one for the whole Strapi application. + +:::note +It is not possible to create custom locales. Locales can only be created based on [the 500+ pre-created list of locales](https://github.com/strapi/strapi/blob/main/packages/plugins/i18n/server/src/constants/iso-locales.json) set by Strapi. +::: + +To add a new locale: + +1. Click on the **Add new locale** button. +2. In the locale addition window, choose your new locale among the *Locales* drop-down list. The latter lists alphabetically all locales, displayed as their ISO code, that can be added to your Strapi application. +3. (optional) In the *Locale display name* textbox, write a new display name for your new locale. +4. (optional) In the Advanced settings tab, tick the *Set as default locale* setting to make your new locale the default one for your Strapi application. +5. Click on the **Save** button to confirm the addition of your new locale. + +### Code-based configuration + +A `STRAPI_PLUGIN_I18N_INIT_LOCALE_CODE` [environment variable](/dev-docs/configurations/environment#strapi) can be configured to set the default locale for your environment. The value used for this variable should be an ISO country code from [the 500+ pre-created list of locales](https://github.com/strapi/strapi/blob/main/packages/plugins/i18n/server/src/constants/iso-locales.json). + +## Usage + +In the Content Manager, when the Internationalization feature is enabled for the content-type, a locale drop-down list is added to the top right of the edit view and allows to switch locales. + +The Internationalization feature also allows dynamic zones and components to differ from one locale to another. Depending on the locale, dynamic zones can indeed have different structures depending on the locale, and repeatable components can have different entries and be organized differently as well. + +:::caution +Content can only be managed one locale at the time. It is not possible to edit or publish content for several locales at the same time (e.g. Clicking on the **Publish** button will only publish the content for the locale you are currently working on). +::: + +To translate content in another locale: + +1. Access the edit view of your collection or single type. +2. On the top right of the edit view, click on the locale drop-down list. +3. Choose the locale in which you want to translate your content. +4. Translate your content by filling up your content-type's fields. + +:::tip +Click on the ![Dowload icon](/img/assets/icons/v5/Download.svg) *Fill in from another locale* button, in the top right corner, for all non relational fields to be filled up with the values of another chosen locale. It can be useful if you do not remember what was the exact content in another locale. +::: + +### Usage with APIs + +Localized content can be requested, created, updated, and deleted for a given locale through the various front-end APIs accessible from [Strapi's Content API](/dev-docs/api/content-api): + + + + + + +On the back-end server of Strapi, the Document Service API can also be used to interact with localized content: + + + + diff --git a/docusaurus/docs/user-docs/features/media-library.md b/docusaurus/docs/user-docs/features/media-library.md new file mode 100644 index 0000000000..1f6e99ae5b --- /dev/null +++ b/docusaurus/docs/user-docs/features/media-library.md @@ -0,0 +1,687 @@ +--- +title: Media Library +sidebar_position: 1 +description: Learn to use the Media Library which allows to display and manage all assets uploaded in the application. +toc_max_heading_level: 5 +tags: +- admin panel +- Content-type Builder +- filters +- introduction +- media library +--- + +import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; + +# Media Library + +The Media Library is the Strapi feature that displays all assets uploaded in the Strapi application and allows users to manage them. + + + +:::prerequisites Identity Card of the Feature + **Plan:** Media Library is a free feature.
+ **Role & permission:** Minimum "Access the Media Library" permission in Roles > Plugins - Upload.
+ **Activation:** Available and activated by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +Some configuration options for the Media Library are available in the admin panel, and some are handled via your Strapi project's code. + +### Admin panel settings + +The Media Library settings allow controlling the format, file size, and orientation of uploaded assets. + + + +1. Go to ![Settings icon](/img/assets/icons/v5/Cog.svg) Settings > Global Settings > Media Library. +2. Define your chosen new settings: + + | Setting name | Instructions | Default value | + | -------------------------- | ----------------------- |---------------| + | Responsive friendly upload | Enabling this option will generate multiple formats (small, medium and large) of the uploaded asset.
Default sizes for each format can be [configured through the code](#responsive-images). | True | + | Size optimization | Enabling this option will reduce the image size and slightly reduce its quality. | True | + | Auto orientation | Enabling this option will automatically rotate the image according to EXIF orientation tag. | False | + +3. Click on the **Save** button. + +### Code-based configuration + +The Media Library is powered in the backend server by the Upload package, which can be configured and extended through providers. + +#### Additional providers + +By default Strapi provides a [provider](/dev-docs/providers) that uploads files to a local `public/uploads/` directory in your Strapi project. Additional providers are available should you want to upload your files to another location. + +The providers maintained by Strapi are the following. Clicking on a card will redirect you to their Strapi Marketplace page: + + + + + + + +:::info +Code-based configuration instructions on the present page detail options for the default upload provider. If using another provider, please refer to the available configuration parameters in that provider's documentation. +::: + +#### Available options + +When using the default upload provider, the following specific configuration options can be declared in an `upload.config` object within [the `config/plugins` file](/dev-docs/configurations/plugins). All parameters are optional: + +| Parameter | Description | Type | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------- | ------- | +| `providerOptions.localServer` | Options that will be passed to [koa-static](https://github.com/koajs/static) upon which the Upload server is build (see [local server configuration](#local-server)) | Object | - | +| `sizeLimit` | Maximum file size in bytes (see [max file size](#max-file-size)) | Integer | `209715200`

(200 MB in bytes, i.e., 200 x 1024 x 1024 bytes) | +| `breakpoints` | Allows to override the breakpoints sizes at which responsive images are generated when the "Responsive friendly upload" option is set to `true` (see [responsive images](#responsive-images)) | Object | `{ large: 1000, medium: 750, small: 500 }` | + +:::note +The Upload request timeout is defined in the server options, not in the Upload plugin options, as it's not specific to the Upload plugin but is applied to the whole Strapi server instance (see [upload request timeout](#upload-request-timeout)). +::: + +#### Example custom configuration + +The following is an example of a custom configuration for the Upload plugin when using the default upload provider: + + + + + +```js title="/config/plugins.js" +module.exports = ({ env })=>({ + upload: { + config: { + providerOptions: { + localServer: { + maxage: 300000 + }, + }, + sizeLimit: 250 * 1024 * 1024, // 256mb in bytes + breakpoints: { + xlarge: 1920, + large: 1000, + medium: 750, + small: 500, + xsmall: 64 + }, + }, + }, +}); +``` + + + + + +```ts title="/config/plugins.ts" +export default () => ({ + upload: { + config: { + providerOptions: { + localServer: { + maxage: 300000 + }, + }, + sizeLimit: 250 * 1024 * 1024, // 256mb in bytes + breakpoints: { + xlarge: 1920, + large: 1000, + medium: 750, + small: 500, + xsmall: 64 + }, + }, + }, +}) +``` + + + + + +#### Local server + +By default Strapi accepts `localServer` configurations for locally uploaded files. These will be passed as the options for [koa-static](https://github.com/koajs/static). + +You can provide them by creating or editing [the `/config/plugins` file](/dev-docs/configurations/plugins). The following example sets the `max-age` header: + + + + + +```js title="/config/plugins.js" +module.exports = ({ env })=>({ + upload: { + config: { + providerOptions: { + localServer: { + maxage: 300000 + }, + }, + }, + }, +}); +``` + + + + + +```ts title="/config/plugins.ts" +export default ({ env }) => ({ + upload: { + config: { + providerOptions: { + localServer: { + maxage: 300000 + }, + }, + }, + }, +}); +``` + + + + +#### Max file size + +The Strapi middleware in charge of parsing requests needs to be configured to support file sizes larger than the default of 200MB. This must be done in addition to provider options passed to the Upload package for `sizeLimit`. + +:::caution +You may also need to adjust any upstream proxies, load balancers, or firewalls to allow for larger file sizes. For instance, [Nginx](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) has a configuration setting called `client_max_body_size` that must be adjusted, since its default is only 1mb. +::: + +The middleware used by the Upload package is [the `body` middleware](/dev-docs/configurations/middlewares#body). You can pass configuration to the middleware directly by setting it in the `/config/middlewares` file: + + + + + +```js title="/config/middlewares.js" +module.exports = [ + // ... + { + name: "strapi::body", + config: { + formLimit: "256mb", // modify form body + jsonLimit: "256mb", // modify JSON body + textLimit: "256mb", // modify text body + formidable: { + maxFileSize: 250 * 1024 * 1024, // multipart data, modify here limit of uploaded file size + }, + }, + }, + // ... +]; +``` + + + + + +```js title="/config/middlewares.ts" +export default [ + // ... + { + name: "strapi::body", + config: { + formLimit: "256mb", // modify form body + jsonLimit: "256mb", // modify JSON body + textLimit: "256mb", // modify text body + formidable: { + maxFileSize: 250 * 1024 * 1024, // multipart data, modify here limit of uploaded file size + }, + }, + }, + // ... +]; +``` + + + + + +In addition to the middleware configuration, you can pass the `sizeLimit`, which is an integer in bytes, in the [/config/plugins file](/dev-docs/configurations/plugins): + + + + + +```js title="/config/plugins.js" +module.exports = { + // ... + upload: { + config: { + sizeLimit: 250 * 1024 * 1024 // 256mb in bytes + } + } +}; +``` + + + + + +```js title="/config/plugins.ts" +export default { + // ... + upload: { + config: { + sizeLimit: 250 * 1024 * 1024 // 256mb in bytes + } + } +}; +``` + + + + + +#### Upload request timeout + +By default, the value of `strapi.server.httpServer.requestTimeout` is set to 330 seconds. This includes uploads. + +To make it possible for users with slow internet connection to upload large files, it might be required to increase this timeout limit. The recommended way to do it is by setting the `http.serverOptions.requestTimeout` parameter in [the `config/servers` file](/dev-docs/configurations/server). + +An alternate method is to set the `requestTimeout` value in [the `bootstrap` function](/dev-docs/configurations/functions#bootstrap) that runs before Strapi gets started. This is useful in cases where it needs to change programmatically—for example, to temporarily disable and re-enable it: + + + + + +```js title="/index.js" +module.exports = { + + //... + + bootstrap({ strapi }) { + // Set the requestTimeout to 1,800,000 milliseconds (30 minutes): + strapi.server.httpServer.requestTimeout = 30 * 60 * 1000; + }, +}; +``` + + + + + +```ts title="/index.ts" +export default { + + //... + + bootstrap({ strapi }) { + // Set the requestTimeout to 1,800,000 milliseconds (30 minutes): + strapi.server.httpServer.requestTimeout = 30 * 60 * 1000; + }, +}; +``` + + + + + +#### Responsive Images + +When the [`Responsive friendly upload` admin panel setting](#admin-panel-settings) is enabled, the plugin will generate the following responsive image sizes: + +| Name | Largest dimension | +| :------ | :--------- | +| large | 1000px | +| medium | 750px | +| small | 500px | + +These sizes can be overridden in `/config/plugins`: + + + + + +```js title="/config/plugins.js" +module.exports = ({ env }) => ({ + upload: { + config: { + breakpoints: { + xlarge: 1920, + large: 1000, + medium: 750, + small: 500, + xsmall: 64 + }, + }, + }, +}); +``` + + + + + +```js title="/config/plugins.ts" +export default ({ env }) => ({ + upload: { + config: { + breakpoints: { + xlarge: 1920, + large: 1000, + medium: 750, + small: 500, + xsmall: 64 + }, + }, + }, +}); +``` + + + + + +:::caution +Breakpoint changes will only apply to new images, existing images will not be resized or have new sizes generated. +::: + +## Usage + +The Media Library displays all assets uploaded in the application, either via the Media Library itself or via the Content Manager when managing a media field. Assets uploaded to the Media Library can be inserted into content-types using the [Content Manager](/user-docs/content-manager/writing-content#filling-up-fields). + + + +From the Media Library, it is possible to: + +- upload a new asset (see [adding assets](/user-docs/media-library/adding-assets)) or create a new folder (see [organizing assets with folders](/user-docs/media-library/organizing-assets-with-folders)) , +- sort the assets and folders or set filters to find assets and folders more easily, +- toggle between the list view ![List icon](/img/assets/icons/v5/List.svg) and the grid view ![Grid icon](/img/assets/icons/v5/GridFour.svg) to display assets, access settings ![Settings icon](/img/assets/icons/v5/Cog.svg) to [configure the view](#configuring-the-view), and make a textual search ![Search icon](/img/assets/icons/v5/Search.svg) to find a specific asset or folder, +- and view, navigate through, and manage folders . + +:::tip +Click the search icon ![Search icon](/img/assets/icons/v5/Search.svg) on the right side of the user interface to use a text search and find one of your assets or folders more quickly! +::: + +### Filtering assets + +Right above the list of folders and assets, on the left side of the interface, a ![Filter icon](/img/assets/icons/v5/Filter.svg) **Filters** button is displayed. It allows setting one or more condition-based filters, which add to one another (i.e. if you set several conditions, only the assets that match all the conditions will be displayed). + + + +To set a new filter: + +1. Click on the ![Filter icon](/img/assets/icons/v5/Filter.svg) **Filters** button. +2. Click on the 1st drop-down list to choose the field on which the condition will be applied. +3. Click on the 2nd drop-down list to choose the type of condition to apply. +4. For conditions based on the type of asset to filter, click on the 3rd drop-down list and choose a file type to include or exclude. For conditions based on date and time (i.e. _createdAt_ or _updatedAt_ fields), click on the left field to select a date and click on the right field to select a time. +5. Click on the **Add filter** button. + +:::note +When active, filters are displayed next to the ![Filter icon](/img/assets/icons/v5/Filter.svg) **Filters** button. They can be removed by clicking on the delete icon ![Clear icon](/img/assets/icons/v5/Cross.svg). +::: + +### Sorting assets + + + +Just above the list of folders and assets and next to the ![Filter icon](/img/assets/icons/v5/Filter.svg) **Filters** button, on the left side of the interface, a drop-down button is displayed. It allows to sort the assets by upload date, alphabetical order or date of update. Click on the drop-down button and select an option in the list to automatically display the sorted assets. + +### Configuring the view + +Just above the list of folders and assets, on the right side of the interface, there is a group of 3 buttons. Click on ![Settings icon](/img/assets/icons/v5/Cog.svg) to configure the default view for the Media library. + + + +From there you can: + +- Use the **Entries per page** dropdown to define the number of assets displayed by default +- Use the **Default sort order** dropdown the define the default order in which assets are displayed. This can be overriden when you [sort assets](#sorting-assets) in the Media Library. + +Both settings are used as the defaults in the Media Library and in the [Content Manager media upload modal](/user-docs/content-manager/writing-content#filling-up-fields). The settings saved here are global across the entire Strapi project for all users. + + +### Adding assets + +The Media Library displays all assets uploaded in the application, either via the [Media Library](/user-docs/media-library) or the [Content Manager](/user-docs/content-manager/writing-content.md#filling-up-fields) when managing a media field. + + + +To add new assets to the media library: + +1. Click the **Add new assets** button in the upper right corner of the Media Library. +2. Choose whether you want to upload the new asset from your computer or from an URL: + - from the computer, either drag & drop the asset directly or browse files on your system, + - from an URL, type or copy and paste an URL(s) in the _URL_ field, making sure multiple URLs are separated by carriage returns, then click **Next**. +3. (optional) Click the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) to view asset metadata and define a _File name_, _Alternative text_ and a _Caption_ for the asset (see [editing and deleting assets](/user-docs/media-library/managing-assets.md)). +4. (optional) Add more assets by clicking **Add new assets** and going back to step 2. +5. Click on **Upload assets to the library**. + +A variety of media types and extensions are supported by the Media Library: + +| Media type | Supported extensions | +| ---------- | --------------------------------------------------------------- | +| Image | - JPEG
- PNG
- GIF
- SVG
- TIFF
- ICO
- DVU | +| Video | - MPEG
- MP4
- MOV (Quicktime)
- WMV
- AVI
- FLV | +| Audio | - MP3
- WAV
- OGG | +| File | - CSV
- ZIP
- PDF
- XLS, XLSX
- JSON | + +### Managing individual assets + +The Media Library allows managing assets, which includes modifying assets' file details and location, downloading and copying the link of the assets file, and deleting assets. Image files can also be cropped. To manage an asset, click on its Edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button. + +#### Editing assets + +Clicking on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button of an asset opens up a "Details" window, with all the available options. + + + +- On the left, above the preview of the asset, control buttons allow performing various actions: + - click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) to delete the asset, + - click on the download button ![Download icon](/img/assets/icons/v5/Download.svg) to download the asset, + - click on the copy link button ![Copy link icon](/img/assets/icons/v5/Link.svg) to copy the asset's link to the clipboard, + - optionally, click on the crop button ![Copy link icon](/img/assets/icons/v5/Crop.svg) to enter cropping mode for the image (see [cropping images](#cropping-images)). +- On the right, meta data for the asset is displayed at the top of the window and the fields below can be used to update the _File name_, _Alternative text_, _Caption_ and _Location_ (see [organizing assets with folders](/user-docs/media-library/organizing-assets-with-folders.md)) for the asset . +- At the bottom, the **Replace Media** button can be used to replace the asset file but keep the existing content of the other editable fields, and the **Finish** button is used to confirm any updates to the fields. + +#### Moving assets + +An individual asset can be moved to a folder when editing its details. + +To move an asset: + +1. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button for the asset to be moved. +2. In the window that pops up, click the _Location_ field and choose a different folder from the drop-down list. +3. Click **Save** to confirm. + +:::note +Assets can also be moved to other folders from the main view of the Media Library (see [organizing assets with folders](/user-docs/media-library/organizing-assets-with-folders.md#moving-assets-to-a-folder)). This includes the ability to move several assets simultaneously. +::: + +#### Cropping images + +Images can be cropped when editing the asset's details. + +To crop an image: + +1. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button for the asset to be cropped. +2. In the window that pops up, click the crop button ![Crop icon](/img/assets/icons/v5/Crop.svg) to enter cropping mode. +3. Crop the image using handles in the corners to resize the frame. The frame can also be moved by drag & drop. +4. Click the crop ![Done icon](/img/assets/icons/v5/Check.svg) button to validate the new dimensions, and choose either to **crop the original asset** or to **duplicate & crop the asset** (i.e. to create a copy with the new dimensions while keeping the original asset untouched). Alternatively, click the stop cropping ![Cancel icon](/img/assets/icons/v5/Cross.svg) button to cancel and quit cropping mode. + +5. Click **Finish** to save changes to the file. + +#### Deleting assets + +An individual asset can be deleted when editing its details. + +To delete an asset: + +1. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button for the asset to be deleted. +2. In the window that pops up, click the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) in the control buttons bar above the asset's preview. +3. Click **Confirm**. + +:::tip +Assets can also be deleted individually or in bulk from the main view of the Media Library. Select assets by clicking on their checkbox in the top left corner, then click the Delete icon ![Delete icon](/img/assets/icons/v5/Trash.svg) at the top of the window, below the filters and sorting options. +::: + +### Organizing assets with folders + +Folders in the Media Library help you organize uploaded assets. Folders sit at the top of the Media Library view or are accessible from the Media field popup when using the [Content Manager](/user-docs/content-manager/writing-content). + +From the Media Library, it is possible to view the list of folders and browse a folder's content, create new folders, edit an existing folder, move assets to a folder, and delete a folder. + +:::note +Folders follow the permission system of assets (see [Users, Roles & Permissions](/user-docs/users-roles-permissions)). It is not yet possible to define specific permissions for a folder. +::: + +#### Browsing folders + +By default, the Media Library displays folders and assets created at the root level. Clicking a folder navigates to this folder, and displays the following elements: + +- the folder title and breadcrumbs to navigate to a parent folder +- the subfolders the current folder contains +- all assets from this folder + + + +From this dedicated folder view, folders and assets can be managed, filtered, sorted and searched just like from the main Media Library (see [introduction to Media Library](/user-docs/media-library)). + +To navigate back to the parent folder, one level up, use the **Back** button at the top of the interface. + +:::tip +The breadcrumb navigation can also be used to go back to a parent folder: click on a folder name to directly jump to it or click on the 3 dots `/img.` and select a parent folder from the drop-down list. +::: + +#### Adding folders + +To create a new folder in the Media Library: + +1. Click on **Add new folder** in the upper right of the Media Library interface. +2. In the window that pops up, type a name for the new folder in the _Name_ field. +3. (optional) In the _Location_ drop-down list, choose a location for the new folder. The default location is the active folder. +4. Click **Create**. + +:::note +There is no limit to how deep your folders hierarchy can go, but bear in mind it might take some effort to reach a deeply nested subfolder, as the Media Library currently has no visual hierarchy indication. Searching for files using the ![Search icon](/img/assets/icons/v5/Search.svg) on the right side of the user interface might be a faster alternative to finding the asset you are looking for. +::: + +#### Moving assets to a folder + +Assets and folders can be moved to another folder from the root view of the Media Library or from any view for a dedicated folder. + + + +To bulk move assets and folders to another folder: + +1. Select assets and folder to be moved, by clicking the checkbox on the left of the folder name or clicking the asset itself. +2. Click the ![Move icon](/img/assets/icons/v5/Folder.svg) **Move** button at the top of the interface. +3. In the _Move elements to_ pop-up window, select the new folder from the _Location_ drop-down list. +4. Click **Move**. + +:::note +An individual asset can also be moved to a folder when [editing the asset](/user-docs/media-library/managing-assets.md). +::: + +#### Editing folders + +Once created, a folder can be renamed, moved or deleted. To manage a single folder: + +1. In the Folders part of the Media library, hover the folder to be edited and click its edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg). +2. In the window that pops up, update the name and location with the _Name_ field and _Location_ drop-down list, respectively. +3. Click **Save**. + +#### Deleting folders + +Deleting a folder can be done either from the list of folders of the Media Library, or when editing a single folder. + +To delete a folder, from the Media Library: + +1. Click the checkbox on the left of the folder name. Multiple folders can be selected. +2. Click the ![Delete icon](/img/assets/icons/v5/Trash.svg) **Delete** button above the Folders list. +3. In the _Confirmation_ dialog, click **Confirm**. + +:::note +A single folder can also be deleted when editing it: hover the folder, click on its edit icon ![Edit icon](/img/assets/icons/v5/Pencil.svg), and in the window that pops up, click the **Delete folder** button and confirm the deletion. +::: + +### Usage with the REST API + +The Media Library feature has some endpoints that can accessed through Strapi's REST API: + + + + diff --git a/docusaurus/docs/user-docs/features/preview.md b/docusaurus/docs/user-docs/features/preview.md new file mode 100644 index 0000000000..1ba70087cf --- /dev/null +++ b/docusaurus/docs/user-docs/features/preview.md @@ -0,0 +1,312 @@ +--- +title: Static Preview +description: With the Preview feature, you can preview your front-end directly from the Content Manager +displayedSidebar: userSidebar +toc_max_heading_level: 4 +tags: +- content manager +- preview +--- + +# Static Preview + +With the Preview feature, you can preview your front end application directly from Strapi's admin panel. This is helpful to see how updates to your content in the Edit View of the Content Manager will affect the final result. + + + + + + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** Read permissions in Roles > Plugins - Users & Permissions.
+ **Activation:** Should be configured in the `config/admin` file.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +:::note Notes +* The following environment variables must be defined in your `.env` file, replacing example values with appropriate values: + + ```bash + CLIENT_URL=https://your-frontend-app.com + PREVIEW_SECRET=your-secret-key # optional, required with Next.js draft mode + ``` + +* A front-end application for your Strapi project should be already created and set up. +::: + +### Configuration components + +The Preview feature configuration is stored in the `preview` object of [the `config/admin` file](/dev-docs/configurations/admin-panel) and consists of 3 key components: + +#### Activation flag + +Enables or disables the preview feature: +```javascript title="config/admin.ts|js" {3} +// … +preview: { + enabled: true, + // … +} +// … +``` + +#### Allowed origins + +The Preview feature configuration is stored in the `preview` object of [the `config/admin` file](/dev-docs/configurations/admin-panel) and consists of 3 key components: + +```javascript title="config/admin.ts|js" {5} +// … +preview: { + enabled: true, + config: { + allowedOrigins: env("CLIENT_URL"), // Usually your frontend application URL + // … + } +} +// … +``` + +#### Preview handler + +Manages the preview logic and URL generation, as in the following basic example where `uid` is the content-type identifier (e.g., `api::article.article` or `plugin::my-api.my-content-type`): + +```jsx title="config/admin.ts|js" {6-11} +// … +preview: { + enabled: true, + config: { + // … + async handler(uid, { documentId, locale, status }) { + const document = await strapi.documents(uid).findOne({ documentId }); + const pathname = getPreviewPathname(uid, { locale, document }); + + return `${env('PREVIEW_URL')}${pathname}` + }, + } +} +// … +``` + +An example of [URL generation logic](#2-add-url-generation-logic) in given in the following basic implementation guide. + +##### Previewing draft entries + +The strategy for the front end application to query draft or published content is framework-specific. At least 3 strategies exist: + +- using a query parameter, having something like `/your-path?preview=true` (this is, for instance, how [Nuxt](https://nuxt.com/docs/api/composables/use-preview-modehow) works) +- redirecting to a dedicated preview route like `/preview?path=your-path`(this is, for instance, how [Next's draft mode](https://nextjs.org/docs/app/building-your-application/configuring/draft-mode) works) +- or using a different domain for previews like `preview.mysite.com/your-path`. + +When [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content.md) is enabled for your content-type, you can also directly leverage Strapi's `status` parameter to handle the logic within the Preview handler, using the following generic approach: + +```javascript +async handler(uid, { documentId, locale, status }) { + const document = await strapi.documents(uid).findOne({ documentId }); + const pathname = getPreviewPathname(uid, { locale, document }); + if (status === 'published') { + // return the published version + } + // return the draft version +}, +``` + +A more detailed example using the draft mode of Next.js is given in the [basic implementation guide](#3-add-handler-logic). + +### Basic implementation guide + +Follow these steps to add Preview capabilities to your content types. + +#### 1. Create the Preview configuration + +Create a new file `/config/admin.ts` (or update it if it exists) with the following basic structure: + +```javascript title="config/admin.ts" +export default ({ env }) => ({ + // Other admin-related configurations go here + // (see docs.strapi.io/dev-docs/configurations/admin-panel) + preview: { + enabled: true, + config: { + allowedOrigins: env('CLIENT_URL'), + async handler (uid, { documentId, locale, status }) => { + // Handler implementation coming in step 3 + }, + }, + }, +}); +``` + +#### 2. Add URL generation logic + +Add the URL generation logic with a `getPreviewPathname` function. The following example is taken from the [Launchpad](https://github.com/strapi/LaunchPad/tree/feat/preview) Strapi demo application: + +```typescript title="config/admin.ts" +// Function to generate preview pathname based on content type and document +const getPreviewPathname = (uid, { locale, document }): string => { + const { slug } = document; + + // Handle different content types with their specific URL patterns + switch (uid) { + // Handle pages with predefined routes + case "api::page.page": + switch (slug) { + case "homepage": + return `/${locale}`; // Localized homepage + case "pricing": + return "/pricing"; // Pricing page + case "contact": + return "/contact"; // Contact page + case "faq": + return "/faq"; // FAQ page + } + // Handle product pages + case "api::product.product": { + if (!slug) { + return "/products"; // Products listing page + } + return `/products/${slug}`; // Individual product page + } + // Handle blog articles + case "api::article.article": { + if (!slug) { + return "/blog"; // Blog listing page + } + return `/blog/${slug}`; // Individual article page + } + default: { + return null; + } + } +}; + +// … main export (see step 3) +``` + +:::note +Some content types don't need to have a preview if it doesn't make sense, hence the default case returning `null`. A Global single type with some site metadata, for example, will not have a matching front-end page. In these cases, the handler function should return `null`, and the preview UI will not be shown in the admin panel. This is how you enable or disable preview per content type. +::: + +#### 3. Add handler logic + +Create the complete configuration, expanding the basic configuration created in step 1. with the URL generation logic created in step 2., adding an appropriate handler logic: + +```typescript title="config/admin.ts" {8-9,18-35} +const getPreviewPathname = (uid, { locale, document }): string => { + // … as defined in step 2 +}; + +// Main configuration export +export default ({ env }) => { + // Get environment variables + const clientUrl = env("CLIENT_URL"); // Frontend application URL + const previewSecret = env("PREVIEW_SECRET"); // Secret key for preview authentication + + return { + // Other admin-related configurations go here + // (see docs.strapi.io/dev-docs/configurations/admin-panel) + preview: { + enabled: true, // Enable preview functionality + config: { + allowedOrigins: clientUrl, // Restrict preview access to specific domain + async handler(uid, { documentId, locale, status }) { + // Fetch the complete document from Strapi + const document = await strapi.documents(uid).findOne({ documentId }); + + // Generate the preview pathname based on content type and document + const pathname = getPreviewPathname(uid, { locale, document }); + + // Disable preview if the pathname is not found + if (!pathname) { + return null; + } + + // Use Next.js draft mode passing it a secret key and the content-type status + const urlSearchParams = new URLSearchParams({ + url: pathname, + secret: previewSecret, + status, + }); + return `${clientUrl}/api/preview?${urlSearchParams}`; + }, + }, + }, + }; +}; + +``` +#### 4. Set up the front-end preview route + +Setting up the front-end preview route is highly dependent on the framework used for your front-end application. + +For instance, [Next.js draft mode](https://nextjs.org/docs/app/building-your-application/configuring/draft-mode) and +[Nuxt preview mode](https://nuxt.com/docs/api/composables/use-preview-mode) provide additional documentation on how to implement the front-end part in their respective documentations. + +If using Next.js, a basic implementation could be like in the following example taken from the [Launchpad](https://github.com/strapi/LaunchPad/tree/feat/preview) Strapi demo application: + +```typescript title="/next/api/preview/route.ts" +import { draftMode } from "next/headers"; +import { redirect } from "next/navigation"; + +export async function GET(request: Request) { + // Parse query string parameters + const { searchParams } = new URL(request.url); + const secret = searchParams.get("secret"); + const url = searchParams.get("url"); + const status = searchParams.get("status"); + + // Check the secret and next parameters + // This secret should only be known to this route handler and the CMS + if (secret !== process.env.PREVIEW_SECRET) { + return new Response("Invalid token", { status: 401 }); + } + + // Enable Draft Mode by setting the cookie + if (status === "published") { + draftMode().disable(); + } else { + draftMode().enable(); + } + + // Redirect to the path from the fetched post + // We don't redirect to searchParams.slug as that might lead to open redirect vulnerabilities + redirect(url || "/"); +} +``` + +#### 5. Allow the front-end to be embedded + +On the Strapi side, [the `allowedOrigins` configuration parameter](#allowed-origins) allows the admin panel to load the front-end window in an iframe. But allowing the embedding works both ways, so on the front-end side, you also need to allow the window to be embedded in Strapi's admin panel. + +This requires the front-end application to have its own header directive, the CSP `frame-ancestors` directive. Setting this directive up depends on how your website is built. For instance, setting this up in Next.js requires a middleware configuration (see [Next.js docs](https://nextjs.org/docs/app/building-your-application/configuring/content-security-policy)). + +## Usage + +When the Preview feature is properly set up, an **Open preview** button is visible on the right in the Edit View of the Content Manager. Clicking it will display the preview of your content as it will appear in your front-end application, but directly within Strapi's the admin panel: + + + + +From the Preview screen, you can: + +- click the close button ![Close button](/img/assets/icons/close-icon.svg) in the upper left corner to go back to the Edit View of the Content Manager, +- switch between previewing the draft and the published version (if [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) is enabled for the content-type), +- and click the link icon ![Link icon](/img/assets/icons/v5/Link.svg) in the upper right corner to copy the preview link. Depending on the preview tab you are currently viewing, this will either copy the link to the preview of the draft or the published version. + +:::caution +When making updates to the content, first save them before clicking on Open Preview again, otherwise your latest updates will be lost. A pop up window will warn you about this behavior. +::: diff --git a/docusaurus/docs/user-docs/features/releases.md b/docusaurus/docs/user-docs/features/releases.md new file mode 100644 index 0000000000..7e232157fb --- /dev/null +++ b/docusaurus/docs/user-docs/features/releases.md @@ -0,0 +1,212 @@ +--- +title: Releases +description: Learn how to use the Releases feature that enables content managers to organize entries to publish/unpublish simultaneously +toc_max_heading_level: 5 +tags: +- admin panel +- Enterprise feature +- Releases feature +- Strapi Cloud +pagination_next: user-docs/releases/creating-a-release +--- + +# Releases + + +The Releases feature enables content managers to organize entries into containers that can perform publish and unpublish actions simultaneously. A release can contain entries from different content types and can mix locales. + +:::prerequisites Identity Card of the Feature + **Plan:** Enterprise Edition or Cloud Team plan.
+ **Role & permission:** Administrator role in the project's admin panel.
+ **Activation:** Available by default, if required plan.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Usage + +**Path to use the feature:** ![Releases icon](/img/assets/icons/v5/PaperPlane.svg) Releases + + + + + +### Creating a release + +1. Click the ![Plus icon](/img/assets/icons/v5/Plus.svg) **New Release** button in the upper right corner of the Releases page. +2. Give the release a name. +3. (_optional_) If you want to schedule the release publication instead of publishing the release manually, check the **Schedule release** checkbox and define the date, time, and timezone for publication. Scheduling is currently a feature (see [scheduling a release](/user-docs/releases/managing-a-release#scheduling-a-release) for details). +4. Click the **Continue** button. + + + +Adding entries to a release must be done from the Content Manager. You can add a single entry to a release while creating or editing the entry [in the edit view](/user-docs/content-manager/adding-content-to-releases). + +### Managing a release + + + +Adding entries to a [release](/user-docs/releases/introduction) allow viewing them altogether on a single page. + + + +From a release page, you can: + +- edit the release, to update its name or schedule it, or delete the release, +- decide whether an entry will be published or unpublished with the release, +- and publish the release. + + + + +:::caution +Since publishing an entry with a release means turning a draft entry into a published entry, Releases will not work if [Draft & Publish](/user-docs/content-manager/saving-and-publishing-content) is disabled for the content-type. +::: + +#### Editing a release + +You can rename a release. To do so, while on a release page: + +1. Click on the ![More icon](/img/assets/icons/v5/More.svg) button in the top right corner of the admin panel. +2. Select ![Edit icon](/img/assets/icons/v5/Pencil.svg) **Edit**. +3. In the modal, change the name of the release in the _Name_ field. +4. Click **Continue** to save the change. + +#### Scheduling a release + +Releases can be [published manually](#publishing-a-release) or scheduled to be automatically published at a given date and time, with the timezone of your choice. + +You can schedule a release: +- when [creating the release](/user-docs/releases/creating-a-release), +- or once the release is already created, by editing it. + +To schedule an existing release, while on a release page: +1. Click on the ![More icon](/img/assets/icons/v5/More.svg) button in the top right corner of the admin panel. +2. Select ![Edit icon](/img/assets/icons/v5/Pencil.svg) **Edit**. +3. In the modal, check the **Schedule release** checkbox. +4. Select a date, time, and timezone for the release to be published. +5. Click **Save**. + + + +#### Choosing how entries are grouped + +A release page can display entries either grouped by locale, content-type, or action (publish or unpublish). To change how entries are grouped, click the **Group by …** dropdown and select an option from the list. + +#### Publishing or unpublishing entries + +A release includes multiple entries. You can set the state of each entry with the **Publish** and **Unpublish** action buttons. When the release itself is “published” then the desired actions will be simultaneously performed on each entry. + +#### Removing entries from a release + +Entries can be removed from a release. To do so, click the ![More icon](/img/assets/icons/v5/More.svg) at the end of the row of an entry and select the **Remove from release** button. + +#### Publishing a release + +Publishing a release means that all the actions (publish or unpublish) defined for each entry included in the release will be performed simultaneously. To publish a release, click the **Publish** button in the top right corner of the admin panel. + +The _Status_ column displays the status of each entry: + + - ![Success icon](/img/assets/icons/v5/CheckCircle.svg) Already published: the entry is already published and publishing the release will not affect this entry + - ![Success icon](/img/assets/icons/v5/CheckCircle.svg) Ready to publish: the entry is ready to be published with the release + - ![Fail icon](/img/assets/icons/v5/CrossCircle2.svg) "[field name] is required", "[field name] is too short" or "[field name] is too long": the entry cannot be published because of the issue stated in the red warning message. In this case, the release will be indicated as *Blocked* until all issues have been fixed. + +If some of your entries have a ![Fail icon](/img/assets/icons/v5/CrossCircle2.svg) status, click the ![More icon](/img/assets/icons/v5/More.svg) and the **Edit the entry** button to fix the issues until all entries have the ![Success icon](/img/assets/icons/v5/CheckCircle.svg) status. Note that you will have to click on the **Refresh** button to update the release page as you fix the various entries issues. + +:::caution +Once a release is published, the release itself cannot be updated. You can not re-release that specific release with the same group of entries with some modifications; you must create another release. +::: + +#### Deleting a release + +You can delete a release. Deleting a release will only delete the release itself, but not the content-type entries included in the release. To delete a release, while on the release page: + +1. Click on the ![More icon](/img/assets/icons/v5/More.svg) button in the top right corner of the admin panel. +2. Select ![Delete icon](/img/assets/icons/v5/Trash.svg) **Delete**. +3. In the confirmation dialog, click ![Delete icon](/img/assets/icons/v5/Trash.svg) **Confirm**. + +### Including content in a release + +Using the [Releases](/user-docs/releases/introduction) feature, you can group several entries to publish them altogether. Adding entries to a release is done from the Content Manager. You can also remove an entry from a release while updating the entry. + +:::prerequisites +- Before entries can be added to a release, you must create a release from the [Releases](/user-docs/releases/creating-a-release) page. +- Adding content to a release requires the appropriate permissions for the Content-Releases plugin (see [configuring administrator roles](/user-docs/users-roles-permissions/configuring-administrator-roles#plugins-and-settings)). +::: + +#### Adding multiple entries to a release + +Multiple entries can be added to a [release](/user-docs/releases/introduction) from the list view of the Content Manager. + +To add entries to a release: + +1. From the list view of the Content Manager, select which entries you want to add by ticking the box on the left side of the entries' record. +2. Click on the **Add to release** button located above the header of the table. +3. In the modal, select which release to add these entries to. +4. Click on the **Publish** or **Unpublish** button to decide whether these entries will be published or unpublished when the release is published, then click **Continue**. + + + +#### Adding an entry to a release + +An entry can be added to a [release](/user-docs/releases/introduction) while editing it from the edit view of the Content Manager. + +To add an entry to a release: + +1. Click on ![More icon](/img/assets/icons/v5/More.svg) in the _Entry_ area on the right side of the interface. +2. In the list, click on the ![Releases icon](/img/assets/icons/v5/PaperPlane.svg) **Add to release** button. +2. Select which release to add this entry to. +3. Click on the **Publish** or **Unpublish** button depending on whether you want the entry to be published or unpublished when the release itself is published, then click **Continue**. + +The *Releases* box on the right should show which release(s) the entry is included in. + +:::info +If [Releases scheduling](/user-docs/releases/managing-a-release#scheduling-a-release) is enabled and the entry is added to a scheduled release, the release date and time will also be displayed. +::: + +#### Removing an entry from a release + +An entry can be removed from a [release](/user-docs/releases/introduction) while editing it from the edit view of the Content Manager. + +To remove an entry from a release: + +1. In the *Releases* box in the right sidebar, click on ![More icon](/img/assets/icons/v5/More.svg) below the name of the release. +2. Click the **Remove from release** button. diff --git a/docusaurus/docs/user-docs/features/review-workflows.md b/docusaurus/docs/user-docs/features/review-workflows.md new file mode 100644 index 0000000000..9a1cdb3ee9 --- /dev/null +++ b/docusaurus/docs/user-docs/features/review-workflows.md @@ -0,0 +1,144 @@ +--- +title: Review Workflows +description: Learn how to use the Review Workflows feature that enables the creation and management of workflows for your various content-types +toc_max_heading_level: 5 +tags: +- admin panel +- Enterprise feature +- Review Workflows feature +--- + +# Review Workflows + +The Review Workflows feature allows you to create and manage workflows for your various content-types. Each workflow can consist of any review stages for your content, enabling your team to collaborate in the content creation flow from draft to publication. + + + +:::prerequisites Identity Card of the Feature + **Plan:** Enterprise Edition.
+ **Role & permission:** Super Admin role in project's admin panel.
+ **Activation:** Available by default, if required plan.
+ **Environment:** Available in both Development & Production environment. +::: + + + +## Configuration + +Before being available in the Content Manager, the Review Workflows feature must be configured from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Review Workflows*. + +The default workflow is configured to have 4 stages: To do, In progress, Ready to review, and Reviewed. All 4 stages can be edited, reordered or deleted as needed, and it is also possible to add new stages. + +### Creating or editing a workflow + + + +1. Click on the **Create new workflow** button or on the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) of a workflow. +2. In the workflow edit interface, configure the new workflow: + + | Setting name | Instructions | + | -------------- | ------------------------------------------------------------------------ | + | Workflow name | Write a unique name of workflow. | + | Associated to | (optional) Assign this workflow to one or more existing content-types. | + | Stages | Add review stages (see [Adding a new stage](#adding-a-new-stage)). | + +3. Click on the **Save** button. The new workflow will be displayed in the list-view and for every content-type assigned. + +:::note +The maximum number of [workflows and stages per workflow is limited](https://strapi.io/pricing-cloud). +::: + +#### Adding a new stage + +To add a new stage in the review workflows: + +1. Click on the **Add new stage** button. +2. Write the *Stage name*. +3. Select a *Color*. +4. Select *Roles* that can change the stage, if the entity is currently in that review stage. +5. Click on the **Save** button. + +By default new stages are appended, but they can be reordered anytime using the ![drag & drop](/img/assets/icons/v5/Drag.svg) button. + +:::tip +To set up roles for each stage, you can either click "Apply to all stages" to apply the current roles to all other stages of the workflow or use "Duplicate stage" of the stage context menu. +::: + + +#### Duplicating a stage + +1. Click **Duplicate Stage** in the context menu of the stage. +2. Change the name of the duplicated stage. +2. Click on the **Save** button. + + +#### Deleting a stage + +To delete a stage, click ![More](/img/assets/icons/v5/More.svg) in the context menu of the stage, then **Delete**. + +If you delete a stage that has pending reviews, the reviews will be moved to first stage in the workflow. Every workflow needs to +contain at least one stage and therefore it is not possible to delete the last stage. + + +### Deleting a workflow + +To delete a workflow click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) of a workflow in the list view. + +:::note +It is not possible to delete the last workflow. +::: + + +## Usage + +The Review Workflows feature, once configured, is used from the the ![Content icon](/img/assets/icons/v5/Feather.svg) *Content Manager*, accessible via the main navigation of the admin panel. + +### Change review stage + +As content is created and revised among your team, you can change the review stage of the content to any stage defined in the review workflow (see [Managing Review Workflows](/user-docs/settings/review-workflows)). + +To change the review stage of your content: + +1. Access the edit view of your content-type. +2. In the *Review Workflows* box on the right side of the interface, click on the _Review stage_ drop-down list. +3. Choose the new review stage of your entry. It is automatically saved. + + + +### Change assignee + +Entries of a review workflow content type can be assigned to any admin user in Strapi for review. + +To change the assignee of your content: + +1. Access the edit view of your content-type. +2. In the *Review Workflows* box on the right side of the interface, click on the _Assignee_ drop-down list. +3. Choose the new assignee of your entry. It is automatically saved. + + \ No newline at end of file diff --git a/docusaurus/docs/user-docs/features/users-permissions.md b/docusaurus/docs/user-docs/features/users-permissions.md new file mode 100644 index 0000000000..02941ed33c --- /dev/null +++ b/docusaurus/docs/user-docs/features/users-permissions.md @@ -0,0 +1,611 @@ +--- +title: Users & Permissions +description: Learn to use the Users & Permissions and API tokens features to manage end-users. +toc_max_heading_level: 5 +tags: +- admin panel +- users & permissions +- api tokens +- authenticated role +- JSON Web Tokens (JWT) +- JWT configuration +- keycloak +- ngrok +- provider +- public role +- password +- Users, Roles & Permissions +--- + +# Users & Permissions + +The Users & Permissions feature allows the management of the end-users of a Strapi project. It provides a full authentication process based on JSON Web Tokens (JWT) to protect your API, and an access-control list (ACL) strategy that enables you to manage permissions between groups of users. + +:::prerequisites Identity Card of the Feature + **Plan:** Free feature.
+ **Role & permission:** CRUD permissions in Roles > Plugins - Users & Permissions.
+ **Activation:** Available by default.
+ **Environment:** Available in both Development & Production environment. +::: + +## Configuration + +
+ +### Configuring end-user roles + + + +The configurations of the end-user roles and permissions are available in the *Users & Permissions plugin* section of the ![Settings icon](/img/assets/icons/v5/Cog.svg) _Settings_ sub navigation. + + + +The *Roles* sub-section of *Users & Permissions plugin* displays all created roles for the end users of your Strapi application. + +From this interface, it is possible to: + +- create a new end-user role (see [Creating a new role](#creating-a-new-role)), +- delete an end-user role (see [Deleting a role](#deleting-a-role)), +- or access information regarding an end-user role, and edit it (see [Editing a role](#editing-a-role)). + +:::tip +Click the search button ![Search icon](/img/assets/icons/v5/Search.svg) above the table to use a text search and find one of your administrator roles more quickly! +::: + +By default, 2 end-user roles are defined for any Strapi application: + +- Authenticated: for end users to access content only if they are logged in to a front-end application. +- Public: for end users to access content without being logged in to a front-end application. + +:::note +The end-user role attributed by default to all new end users can be defined in the *Advanced settings* sub-section of *Users & Permissions plugin* (see [Configuring advanced settings](/user-docs/settings/configuring-users-permissions-plugin-settings#configuring-advanced-settings)). +::: + +#### Creating a new role + +On the top right side of the *Users & Permissions plugin > Roles* interface, an **Add new role** button is displayed. It allows to create a new role for end users of your Strapi application. + +To create a new role, click on the **Add new role** button. +Clicking on the **Add new role** button will redirect you to the roles edition interface, where you will be able to edit the role's details and configure its permissions (see [Editing a role](#editing-roles-details)). + +#### Deleting a role + +Although the 2 default end-user roles cannot be deleted, the other ones can, as long as no end user still has this role attributed to their account. + +To delete a role: + +1. Click on the delete button ![Delete icon](/img/assets/icons/v5/Trash.svg) on the right side of the role's record. +2. In the deletion window, click on the ![Delete icon](/img/assets/icons/v5/Trash.svg) **Confirm** button to confirm the deletion. + +#### Editing a role + + + +The role edition interface allows to edit the details of an end-user role as well as to configure in detail the permissions to access the content of a front-end application. It is accessible from *Users & Permissions plugin > Roles* either after clicking on the edit button ![Edit icon](/img/assets/icons/v5/Pencil.svg) on the right side of a role's record, or after clicking on the **Add new role** button (see [Creating a new role](#creating-a-new-role)). + +##### Editing role's details + +The details area of an end-user role editing interface allows to define the name of the role, and to give it a description that should help administrators understand what the role gives access to. + +To edit a role's details, follow the instructions from the table below: + +| Role details | Instructions | +| ------------- | ---------------------------------------- | +| Name | Write the new name of the role in the textbox. | +| Description | Write the description of the role in the textbox. | + +##### Configuring role's permissions + +The permissions area of an end-user role editing interface allows to configure all possible actions and accesses for content-types and available plugins of the Strapi application. + +To configure permissions for an end-user role: + +1. Click on the name of the permission category to configure (e.g. Application, Content-Manager, Email etc.). +2. Tick the boxes of the actions and permissions to grant for the role. +3. Click on the **Save** button. + +:::tip +When ticking an action or permission box, related bound routes of the API are displayed in the right side of the interface. +::: + +### Configuring providers + +Users & Permissions allows enabling and configuring providers, for end users to login via a third-party provider to access the content of a front-end application through the Strapi application API. By default, a list of providers is available including one, "Email", enabled by default for all Strapi applications with Users & Permissions enabled. + + + +To enable and configure a provider: + +1. Go to the *Users & Permissions plugin > Providers* sub-section of the settings interface. +2. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button of the provider to enable and configure. +3. In the provider edition window, click on the **TRUE** button of the *Enable* option. +4. Fill in the provider's configurations. Each provider has its own specific set of configurations (see [Users & Permissions providers documentation](/dev-docs/configurations/users-and-permissions-providers)). +5. Click on the **Save** button. + +:::tip +Other providers that are not proposed by default by Strapi can be added manually through the code of your Strapi application (see [the dedicated guide](/dev-docs/configurations/users-and-permissions-providers/new-provider-guide)). +::: + + + +### Configuring email templates + +The Users & Permissions plugin uses 2 email templates, "Email address confirmation" and "Reset password", that are sent to end users: + +- if their account must be confirmed to be activated, +- if they need to reset the password of their Strapi account. + + + +To configure and edit email templates: + +1. Go to the *Users & Permissions plugin > Email templates* sub-section of the settings interface. +2. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button of the email template to configure and edit. +3. Configure the email template: + +| Setting name | Instructions | +|--------------- | ----------------------------------------------- | +| Shipper name | Indicate the name of the shipper of the email. | +| Shipper email | Indicate the email address of the shipper of the email. | +| Response email | (optional) Indicate the email address to which responses emails from the end users will be sent. | +| Subject | Write the subject of the email. Variables can be used (see [templating emails](#templating-emails)). | + +4. Edit the content of the email in the "Message" textbox. Email templates content is in HTML and uses variables (see [templating emails](#templating-emails)). +5. Click on the **Finish** button. + +### Configuring advanced settings + +All settings related to the Users & Permissions plugin are managed from the *Advanced Settings* sub-section, including the choice of a default role for end users, the enablement of sign-ups and email confirmation, as well as the choice of landing page for resetting a password. + + + +1. Go to the *Users & Permissions plugin > Advanced settings* sub-section of the settings interface. +2. Configure the settings: + +| Setting name | Instructions | +| ------------------------------------ | --------------------------------------------------------------| +| Default role for authenticated users | Click the drop-down list to choose the default role for new end users. | +| One account per email address | Click on the **TRUE** button to limit to 1 the number of end-user accounts with the same email address. Click on **FALSE** to disable this limitation and allow several end-user accounts to be associated with the same email address (e.g. `kai.doe@strapi.io` can be used when logging in via several different providers). | +| Enable sign-ups | Click on the **TRUE** button to enable end-user sign-ups. Click on **FALSE** to prevent end-user registration to your front-end application(s). | +| Reset password page | Indicate the URL of the reset password page for your front-end application(s). | +| Enable email confirmation | Click on the **TRUE** button to enable end-user account confirmation by sending them a confirmation email. Click on **FALSE** to disable account confirmation. | +| Redirection url | Indicate the URL of the page where end users should be redirected after confirming their Strapi account. | + +3. Click the **Save** button. + +### Code-based configuration + +While most of the Users & Permissions settings are handled via the admin panel, some more specific settings can be fine-tuned by configuring and customizing your Strapi project's code. + +#### JWT configuration + +You can configure the JWT generation by using the [plugins configuration file](/dev-docs/configurations/plugins). + +Strapi uses [jsonwebtoken](https://www.npmjs.com/package/jsonwebtoken) to generate the JWT. + +Available options: + +- `jwtSecret`: random string used to create new JWTs, typically set using the `JWT_SECRET` [environment variable](/dev-docs/configurations/environment#strapi). +- `jwt.expiresIn`: expressed in seconds or a string describing a time span.
+ Eg: 60, "45m", "10h", "2 days", "7d", "2y". A numeric value is interpreted as a seconds count. If you use a string be sure you provide the time units (minutes, hours, days, years, etc), otherwise milliseconds unit is used by default ("120" is equal to "120ms"). + + + + + +```js title="/config/plugins.js" + +module.exports = ({ env }) => ({ + // ... + 'users-permissions': { + config: { + jwt: { + expiresIn: '7d', + }, + }, + }, + // ... +}); +``` + + + + + +```ts title="/config/plugins.ts" + +export default ({ env }) => ({ + // ... + 'users-permissions': { + config: { + jwt: { + expiresIn: '7d', + }, + }, + }, + // ... +}); +``` + + + + + +:::warning +Setting JWT expiry for more than 30 days is **not recommended** due to security concerns. +::: + +#### Registration configuration + +If you have added any additional fields in your User **model** Models, also called content-types in Strapi, define a representation of the data structure.
Users are a special type of built-in content-type found in any new Strapi application. You can customize the Users model, adding more fields for instance, like any other models.
For more information, please refer to the [models](/dev-docs/backend-customization/models) documentation.
that need to be accepted on registration, you need to added them to the list of allowed fields in the `config.register` object of [the `/config/plugins` file](/dev-docs/configurations/plugins), otherwise they will not be accepted. + +The following example shows how to ensure a field called "nickname" is accepted by the API on user registration: + + + + + +```js title="/config/plugins.js" +module.exports = ({ env }) => ({ + // ... + "users-permissions": { + config: { + register: { + allowedFields: ["nickname"], + }, + }, + }, + // ... +}); +``` + + + + + +```ts title="/config/plugins.ts" +export default ({ env }) => ({ + // ... + "users-permissions": { + config: { + register: { + allowedFields: ["nickname"], + }, + }, + }, + // ... +}); +``` + + + + + +#### Templating emails + +By default this plugin comes with two templates: reset password and email address confirmation. The templates use [Lodash's `template()` method](https://lodash.com/docs/4.17.15#template) to populate the variables. + +You can update these templates under **Plugins** > **Roles & Permissions** > **Email Templates** tab in the admin panel (see [configuring email templates](#configuring-email-templates)). + +The following variables can be used: + + + + +
+- `USER` (object) + - `username` + - `email` +- `TOKEN` corresponds to the token generated to be able to reset the password. +- `URL` is the link where the user will be redirected after clicking on it in the email. +- `SERVER_URL` is the absolute server url (configured in server configuration). + +
+ + + +
+- `USER` (object) + - `username` + - `email` +- `CODE` corresponds to the CODE generated to be able confirm the user email. +- `URL` is the Strapi backend URL that confirms the code (by default `/auth/email-confirmation`). +- `SERVER_URL` is the absolute server url (configured in server configuration). + +
+ +
+ +#### Security configuration + +JWTs can be verified and trusted because the information is digitally signed. To sign a token a _secret_ is required. By default Strapi generates and stores it in `/extensions/users-permissions/config/jwt.js`. + +This is useful during development but for security reasons it is recommended to set a custom token via an environment variable `JWT_SECRET` when deploying to production. + +By default you can set a `JWT_SECRET` environment variable and it will be used as secret. If you want to use another variable you can update the configuration file. + + + + + +```js title="/extensions/users-permissions/config/jwt.js" + +module.exports = { + jwtSecret: process.env.SOME_ENV_VAR, +}; +``` + + + + + +```ts title="/extensions/users-permissions/config/jwt.ts" + +export default { + jwtSecret: process.env.SOME_ENV_VAR, +}; +``` + + + + + +##### Creating a custom callback validator + +By default, Strapi SSO only redirects to the redirect URL that is exactly equal to the url in the configuration: + + + +If you need to configure a custom handler to accept other URLs, you can create a callback `validate` function in your plugins.js for the `users-permissions` plugin. + +```tsx title="/config/plugins.js|ts" + // ... other plugins configuration ... + // Users & Permissions configuration + 'users-permissions': { + enabled: true, + config: { + callback: { + validate: (cbUrl, options) => { + // cbUrl is where Strapi is being asked to redirect the auth info + // that was received from the provider to + + // in this case, we will only validate that the + // if using a base url, you should always include the trailing slash + // although in real-world usage you should also include the full paths + if (cbUrl.startsWith('https://myproxy.mysite.com/') || + cbUrl.startsWith('https://mysite.com/')) { + return; + } + + // Note that you MUST throw an error to fail validation + // return values are not checked + throw new Error('Invalid callback url'); + }, + }, + }, + }, +``` + +## Usage + +With the Users & Permissions plugin, the end users and their account information are managed as a content-type. When the plugin is installed on a Strapi application, 3 collection types are automatically created (see [Users & Permissions plugin](/user-docs/plugins/strapi-plugins#users-and-permissions)), including "User" which is the only one available directly in the Content Manager. + + + +Registering new end users in a front-end application with the Users & Permissions plugin consists in adding a new entry to the User collection type (see [Introduction to the Content Manager](/user-docs/content-manager) for more information about the Content Manager). + +:::note +If end users can register themselves on your front-end application (see [Managing Users & Permissions plugin settings](../settings/configuring-users-permissions-plugin-settings)), a new entry will automatically be created and the fields of that entry will be filled up with the information indicated by the end user. All fields can however be edited by an administrator of the Strapi application. +::: + +To create a new end-user account: + +1. Go to the User collection type in the Content Manager. +2. Click on the **Create new entry** button in the top right corner. +3. Fill in the default fields of the entry. Additional fields added specifically for your Strapi application by your administrators may be displayed as well. + +| Field | Instructions | +| --------- | ---------------------------- | +| Username | Write the username of the end user. | +| Email | Write the complete email address of the end user in the textbox. | +| Password | (optional) Write a new password in the textbox. You can click on the ![Eye icon](/img/assets/icons/v5/Eye.svg) icon for the password to be shown. | +| Confirmed | (optional) Click **ON** for the end-user account to be confirmed. | +| Blocked | (optional) Click **ON** to block the account of the end user, to prevent them to access content. | +| Role | (optional) Indicate the role that should be granted to the new end user. If this field is not filled in, the end user will be attributed the role set as default (see [Managing Users & Permissions plugin settings](../settings/configuring-users-permissions-plugin-settings)). | + +4. Click on the **Save** button. + +### API usage + +Each time an API request is sent the server checks if an `Authorization` header is present and verifies if the user making the request has access to the resource. + +:::note +When you create a user without a role, or if you use the `/api/auth/local/register` route, the `authenticated` role is given to the user. +::: + +#### Identifier + +The `identifier` param can be an email or username, as in the following examples: + + + + + +```js +import axios from 'axios'; + +// Request API. +axios + .post('http://localhost:1337/api/auth/local', { + identifier: 'user@strapi.io', + password: 'strapiPassword', + }) + .then(response => { + // Handle success. + console.log('Well done!'); + console.log('User profile', response.data.user); + console.log('User token', response.data.jwt); + }) + .catch(error => { + // Handle error. + console.log('An error occurred:', error.response); + }); +``` + + + + + +If you use **Postman**, set the **body** to **raw** and select **JSON** as your data format: + +```json +{ + "identifier": "user@strapi.io", + "password": "strapiPassword" +} +``` + +If the request is successful you will receive the **user's JWT** in the `jwt` key: + +```json +{ + "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTc2OTM4MTUwLCJleHAiOjE1Nzk1MzAxNTB9.UgsjjXkAZ-anD257BF7y1hbjuY3ogNceKfTAQtzDEsU", + "user": { + "id": 1, + "username": "user", + ... + } +} +``` + + + + +#### Token usage + +The `jwt` may then be used for making permission-restricted API requests. To make an API request as a user place the JWT into an `Authorization` header of the `GET` request. + +Any request without a token will assume the `public` role permissions by default. Modify the permissions of each user's role in the admin dashboard. + +Authentication failures return a `401 (unauthorized)` error. + +The `token` variable is the `data.jwt` received when logging in or registering. + +```js +import axios from 'axios'; + +const token = 'YOUR_TOKEN_HERE'; + +// Request API. +axios + .get('http://localhost:1337/posts', { + headers: { + Authorization: `Bearer ${token}`, + }, + }) + .then(response => { + // Handle success. + console.log('Data: ', response.data); + }) + .catch(error => { + // Handle error. + console.log('An error occurred:', error.response); + }); +``` + +#### User registration + +Creating a new user in the database with a default role as 'registered' can be done like in the following example: + +```js +import axios from 'axios'; + +// Request API. +// Add your own code here to customize or restrict how the public can register new users. +axios + .post('http://localhost:1337/api/auth/local/register', { + username: 'Strapi user', + email: 'user@strapi.io', + password: 'strapiPassword', + }) + .then(response => { + // Handle success. + console.log('Well done!'); + console.log('User profile', response.data.user); + console.log('User token', response.data.jwt); + }) + .catch(error => { + // Handle error. + console.log('An error occurred:', error.response); + }); +``` + +#### User object in Strapi context + +The `user` object is available to successfully authenticated requests. + +The authenticated `user` object is a property of `ctx.state`. + +```js +create: async ctx => { + const { id } = ctx.state.user; + + const depositObj = { + ...ctx.request.body, + depositor: id, + }; + + const data = await strapi.services.deposit.add(depositObj); + + // Send 201 `created` + ctx.created(data); +}; +``` diff --git a/docusaurus/docs/user-docs/getting-started/user-guide-fundamentals.md b/docusaurus/docs/user-docs/getting-started/user-guide-fundamentals.md index 16983f8243..f18edd59be 100644 --- a/docusaurus/docs/user-docs/getting-started/user-guide-fundamentals.md +++ b/docusaurus/docs/user-docs/getting-started/user-guide-fundamentals.md @@ -19,7 +19,7 @@ Before going any further into this user guide, we recommend you to acknowledge t - **Versions**
Strapi is constantly evolving and growing. This implies that new releases are quite frequent, to improve what is already available but also to add new features to Strapi. For every new Strapi version, we communicate through our main channels and by sending notifications both on your terminal (when launching your Strapi application), and on your application's admin panel. We always recommend to use the latest version. However, we always keep live both the documentation of the current Strapi version, and the documentation of the previous major version — the latter being officially and actively maintained for up to 12 months after the release of the newest Strapi version. -- **License and Pricing Plans**
As a Strapi user you have the choice between using the Community Edition, which is entirely free, or the [Enterprise Edition](https://strapi.io/pricing-self-hosted). In this user guide, if a feature is only available for the Enterprise Edition, an badge is displayed beside the section's title. Strapi can also be hosted on Strapi Cloud by subscribing to a tier that meets the functionality, support, and customization options specified on [Strapi Cloud](https://strapi.io/pricing-cloud). In this user guide, the , , and badges can be displayed beside a section's title to indicate the feature is available on the tier. +- **License and Pricing Plans**
As a Strapi user you have the choice between using the Community Edition, which is entirely free, the [Growth plan](https://strapi.io/pricing-self-hosted), or the [Enterprise plan](https://strapi.io/pricing-self-hosted). In this user guide, if a feature is available for the Growth plan, or for the Enterprise plan, then respectively a or an badge will be displayed beside the section's title. Strapi can also be hosted on Strapi Cloud by subscribing to a tier that meets the functionality, support, and customization options specified on [Strapi Cloud](https://strapi.io/pricing-cloud). In this user guide, the , , and badges can be displayed below a section's title to indicate the feature is available on the tier. - **Future flags**
Some incoming Strapi features are not yet ready to be shipped to all users, but Strapi still offers community users the opportunity to provide early feedback on these new features or changes. This feedback is invaluable in enhancing the feature before the final release. Such experimental features are indicated by a badge throughout the documentation and enabling these features requires enabling the corresponding future flags (see [Developer Docs](/dev-docs/configurations/features#enabling-a-future-flag)). diff --git a/docusaurus/docs/user-docs/media-library/adding-assets.md b/docusaurus/docs/user-docs/media-library/adding-assets.md index bb087b269b..5297a0d0a8 100644 --- a/docusaurus/docs/user-docs/media-library/adding-assets.md +++ b/docusaurus/docs/user-docs/media-library/adding-assets.md @@ -9,8 +9,6 @@ tags: - media library --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Adding assets The Media Library displays all assets uploaded in the application, either via the [Media Library](/user-docs/media-library) or the [Content Manager](/user-docs/content-manager/writing-content.md#filling-up-fields) when managing a media field. diff --git a/docusaurus/docs/user-docs/media-library/introduction-to-the-media-library.md b/docusaurus/docs/user-docs/media-library/introduction-to-the-media-library.md index c82f0b5b73..517339897c 100644 --- a/docusaurus/docs/user-docs/media-library/introduction-to-the-media-library.md +++ b/docusaurus/docs/user-docs/media-library/introduction-to-the-media-library.md @@ -12,7 +12,6 @@ tags: pagination_next: user-docs/media-library/adding-assets --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Introduction to the Media Library diff --git a/docusaurus/docs/user-docs/media-library/managing-assets.md b/docusaurus/docs/user-docs/media-library/managing-assets.md index 76970725dc..eb5400a22c 100644 --- a/docusaurus/docs/user-docs/media-library/managing-assets.md +++ b/docusaurus/docs/user-docs/media-library/managing-assets.md @@ -9,7 +9,6 @@ tags: - media library --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Managing individual assets diff --git a/docusaurus/docs/user-docs/media-library/organizing-assets-with-folders.md b/docusaurus/docs/user-docs/media-library/organizing-assets-with-folders.md index f3e548c9f7..3b7e6e4c8f 100644 --- a/docusaurus/docs/user-docs/media-library/organizing-assets-with-folders.md +++ b/docusaurus/docs/user-docs/media-library/organizing-assets-with-folders.md @@ -10,7 +10,6 @@ tags: - Users, Roles & Permissions --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Organizing assets with folders diff --git a/docusaurus/docs/user-docs/plugins/installing-plugins-via-marketplace.md b/docusaurus/docs/user-docs/plugins/installing-plugins-via-marketplace.md index 38ac745875..146e9a943d 100644 --- a/docusaurus/docs/user-docs/plugins/installing-plugins-via-marketplace.md +++ b/docusaurus/docs/user-docs/plugins/installing-plugins-via-marketplace.md @@ -1,6 +1,6 @@ --- title: Installing Plugins via the Marketplace -displayed_sidebar: userDocsSidebar +displayed_sidebar: cmsSidebar sidebar_position: 2 tags: - plugins @@ -9,12 +9,8 @@ tags: - upload plugin --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Using the Marketplace - - The Marketplace is where users can find additional plugins to customize Strapi applications, and additional [providers](/user-docs/plugins#providers) to extend plugins. The Marketplace is located in the admin panel, indicated by ![Marketplace icon](/img/assets/icons/v5/ShoppingCart.svg) _Marketplace_. In the Marketplace, users can browse or search for plugins and providers, link to detailed descriptions for each, and submit new plugins and providers. :::note strapi In-app Marketplace vs. Market website diff --git a/docusaurus/docs/user-docs/plugins/introduction-to-plugins.md b/docusaurus/docs/user-docs/plugins/introduction-to-plugins.md index df8f00e3e1..0d0c27e3bc 100644 --- a/docusaurus/docs/user-docs/plugins/introduction-to-plugins.md +++ b/docusaurus/docs/user-docs/plugins/introduction-to-plugins.md @@ -12,8 +12,6 @@ tags: pagination_next: user-docs/plugins/installing-plugins-via-marketplace --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Introduction to plugins Strapi is built around different types of plugins. Every default Strapi application comes with the following pre-installed plugins: @@ -48,7 +46,7 @@ Some plugins can be further extended through the configuration of _providers_, p Currently, the only plugins designed to work with providers are the: -* [Email plugin](/dev-docs/plugins/email/), and +* [Email plugin](/user-docs/features/email/), and * Media Library plugin (implemented via the [Upload plugin](/dev-docs/plugins/upload/)). ## Custom fields diff --git a/docusaurus/docs/user-docs/plugins/strapi-plugins.md b/docusaurus/docs/user-docs/plugins/strapi-plugins.md index 4b7deeee55..de30818e0f 100644 --- a/docusaurus/docs/user-docs/plugins/strapi-plugins.md +++ b/docusaurus/docs/user-docs/plugins/strapi-plugins.md @@ -13,8 +13,6 @@ tags: - Strapi plugin --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # List of Strapi plugins Strapi builds and maintains plugins that extend the functionality of a core Strapi application. This section is a reference guide to the pre-installed plugins and additional plugins developed by Strapi, which are available in the [Marketplace](/user-docs/plugins/installing-plugins-via-marketplace/). Additional documentation on plugins is provided in the relevant sections of the User Guide and the Developer Documentation, however, a brief plugin description, how the installed plugin works, and changes to the admin panel is provided. @@ -22,7 +20,7 @@ Strapi builds and maintains plugins that extend the functionality of a core Stra :::note - Some Strapi Starters and Templates might install additional plugins beyond the default plugins listed below. -- If plugin options are only available with an [Enterprise edition license](https://strapi.io/pricing-self-hosted), they are marked with in this reference guide. +- If plugin options are only available with a [paid plan](https://strapi.io/pricing-self-hosted), they are marked with a or an badge in this reference guide. - All plugin installations can be confirmed in ![Cog icon](/img/assets/icons/v5/Cog.svg) *Settings > Plugins* in the admin panel. ::: @@ -66,13 +64,13 @@ The Users & Permissions plugin impacts several parts of the admin panel. The tab | Content-type Builder |

    Creation of a default collection type "User" which allows for the management of the end users, the end-user roles and their permissions. This collection type cannot be deleted and the composing fields cannot be edited, but the addition of new fields is possible.
| | Content Manager |
    Addition of the default "User" collection type that allows for the management of end-user accounts (see [Managing end-user accounts](/user-docs/users-roles-permissions/managing-end-users)).
    • By default, the following fields are available: Username, Email, Password, as well as Confirmed and Blocked as boolean fields.
    • The "User" collection type has a relation established with the "Role" collection type. All end-user accounts must have a designated role: by default, the end user is attributed the end-user role set as default, but that role can be changed via the end-user entries directly in the Content Manager.
| -### Email plugin {#email} + ## Additional plugins diff --git a/docusaurus/docs/user-docs/releases/creating-a-release.md b/docusaurus/docs/user-docs/releases/creating-a-release.md index 57239157f7..d4b594e21e 100644 --- a/docusaurus/docs/user-docs/releases/creating-a-release.md +++ b/docusaurus/docs/user-docs/releases/creating-a-release.md @@ -8,10 +8,8 @@ tags: - Strapi Cloud --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Creating a release - + The ![Releases icon](/img/assets/icons/v5/PaperPlane.svg) [Releases](/user-docs/releases/introduction) page allows creating new releases that will be used to organize entries. diff --git a/docusaurus/docs/user-docs/releases/introduction.md b/docusaurus/docs/user-docs/releases/introduction.md index 0c3dae5005..95d574905c 100644 --- a/docusaurus/docs/user-docs/releases/introduction.md +++ b/docusaurus/docs/user-docs/releases/introduction.md @@ -11,7 +11,7 @@ pagination_next: user-docs/releases/creating-a-release --- # Releases - + Releases enables content managers to organize entries into containers that can perform publish and unpublish actions simultaneously. A release can contain entries from different content types and can mix locales. diff --git a/docusaurus/docs/user-docs/releases/managing-a-release.md b/docusaurus/docs/user-docs/releases/managing-a-release.md index 19bc1b71e6..79d454e258 100644 --- a/docusaurus/docs/user-docs/releases/managing-a-release.md +++ b/docusaurus/docs/user-docs/releases/managing-a-release.md @@ -9,7 +9,7 @@ tags: --- # Managing a release - + Adding entries to a [release](/user-docs/releases/introduction) allow viewing them altogether on a single page. diff --git a/docusaurus/docs/user-docs/settings/API-tokens.md b/docusaurus/docs/user-docs/settings/API-tokens.md index dc010bdc98..c103b5ec1b 100644 --- a/docusaurus/docs/user-docs/settings/API-tokens.md +++ b/docusaurus/docs/user-docs/settings/API-tokens.md @@ -7,8 +7,6 @@ tags: - GraphQL API --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Managing API tokens :::prerequisites diff --git a/docusaurus/docs/user-docs/settings/admin-panel.md b/docusaurus/docs/user-docs/settings/admin-panel.md index 81a828ac82..4aebfcf3fc 100644 --- a/docusaurus/docs/user-docs/settings/admin-panel.md +++ b/docusaurus/docs/user-docs/settings/admin-panel.md @@ -6,8 +6,6 @@ tags: - company logo --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Customizing the logo The default Strapi logos, displayed in the main navigation of a Strapi application and the authentication pages, can be modified from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Overview*. diff --git a/docusaurus/docs/user-docs/settings/audit-logs.md b/docusaurus/docs/user-docs/settings/audit-logs.md index 2276a8f6c8..3dc24dbebf 100644 --- a/docusaurus/docs/user-docs/settings/audit-logs.md +++ b/docusaurus/docs/user-docs/settings/audit-logs.md @@ -10,8 +10,6 @@ tags: - Strapi Cloud --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Audit Logs diff --git a/docusaurus/docs/user-docs/settings/configuring-users-permissions-plugin-settings.md b/docusaurus/docs/user-docs/settings/configuring-users-permissions-plugin-settings.md index f827226bfa..deaa2064c8 100644 --- a/docusaurus/docs/user-docs/settings/configuring-users-permissions-plugin-settings.md +++ b/docusaurus/docs/user-docs/settings/configuring-users-permissions-plugin-settings.md @@ -7,8 +7,6 @@ tags: - Users, Roles & Permissions --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring Users & Permissions plugin settings The Users & Permissions plugin is managed from the *Users & Permissions plugin* settings section, accessible from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings* in the main navigation of the admin panel. This settings section allows to configure the available providers, email templates and the advanced settings of the plugin. It also allows to define the end-users roles and their related permissions (see [Configuring end-user roles](../users-roles-permissions/configuring-end-users-roles.md)). @@ -30,7 +28,7 @@ To enable and configure a provider: 1. Go to the *Users & Permissions plugin > Providers* sub-section of the settings interface. 2. Click on the edit ![Edit icon](/img/assets/icons/v5/Pencil.svg) button of the provider to enable and configure. 3. In the provider edition window, click on the **TRUE** button of the *Enable* option. -4. Fill in the provider's configurations. Each provider has its own specific set of configurations, detailed in our developer documentation (see [Setting up the provider](/dev-docs/plugins/users-permissions#setting-up-the-provider---examples)). +4. Fill in the provider's configurations. Each provider has its own specific set of configurations, detailed in our developer documentation (see [Setting up the provider](/dev-docs/configurations/users-and-permissions-providers#setting-up-the-provider---examples)). 5. Click on the **Save** button. :::note diff --git a/docusaurus/docs/user-docs/settings/internationalization.md b/docusaurus/docs/user-docs/settings/internationalization.md index 928fb7b001..1601c4685e 100644 --- a/docusaurus/docs/user-docs/settings/internationalization.md +++ b/docusaurus/docs/user-docs/settings/internationalization.md @@ -7,8 +7,6 @@ tags: - plugins --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring Internationalization locales The [Internationalization feature](/user-docs/plugins/strapi-plugins.md#i18n) allows to manage content in different languages, called "locales". Once the Internationalization plugin is installed in a Strapi application (see [Installing plugins via the Marketplace](/user-docs/plugins/installing-plugins-via-marketplace.md)), administrators can manage locales from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Internationalization*. diff --git a/docusaurus/docs/user-docs/settings/media-library-settings.md b/docusaurus/docs/user-docs/settings/media-library-settings.md index 40410d69b7..dee3e88eca 100644 --- a/docusaurus/docs/user-docs/settings/media-library-settings.md +++ b/docusaurus/docs/user-docs/settings/media-library-settings.md @@ -7,8 +7,6 @@ tags: - plugins --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring the Media Library The [Media Library](/user-docs/media-library) displays all assets uploaded in the Strapi application. The Media Library settings allow controlling the format, file size, and orientation of uploaded assets. Those settings can be configured from ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings > Global settings > Media Library*. diff --git a/docusaurus/docs/user-docs/settings/review-workflows.md b/docusaurus/docs/user-docs/settings/review-workflows.md index 8cbb577d88..5eafa5df77 100644 --- a/docusaurus/docs/user-docs/settings/review-workflows.md +++ b/docusaurus/docs/user-docs/settings/review-workflows.md @@ -8,8 +8,6 @@ tags: - Strapi Cloud --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Managing Review Workflows diff --git a/docusaurus/docs/user-docs/settings/single-sign-on.md b/docusaurus/docs/user-docs/settings/single-sign-on.md index 008d6eb386..f335a21920 100644 --- a/docusaurus/docs/user-docs/settings/single-sign-on.md +++ b/docusaurus/docs/user-docs/settings/single-sign-on.md @@ -7,8 +7,6 @@ tags: - Single Sign-On (SSO) --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring Single Sign-On (SSO) diff --git a/docusaurus/docs/user-docs/settings/transfer-tokens.md b/docusaurus/docs/user-docs/settings/transfer-tokens.md index 3005e6788a..e81e41eb4b 100644 --- a/docusaurus/docs/user-docs/settings/transfer-tokens.md +++ b/docusaurus/docs/user-docs/settings/transfer-tokens.md @@ -1,4 +1,5 @@ --- +displayed_sidebar: cmsSidebar sidebar_position: 3 title: Transfer tokens tags: @@ -7,8 +8,6 @@ tags: - transfer tokens --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Managing transfer tokens :::prerequisites diff --git a/docusaurus/docs/user-docs/users-roles-permissions/configuring-administrator-roles.md b/docusaurus/docs/user-docs/users-roles-permissions/configuring-administrator-roles.md index 2bababf58f..b8999ba40f 100644 --- a/docusaurus/docs/user-docs/users-roles-permissions/configuring-administrator-roles.md +++ b/docusaurus/docs/user-docs/users-roles-permissions/configuring-administrator-roles.md @@ -4,8 +4,6 @@ displayed_sidebar: userDocsSidebar sidebar_position: 2 --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring administrator roles (RBAC) Administrators are the users of an admin panel of a Strapi application. Administrator accounts and roles are managed with the Role-Based Access Control (RBAC) feature. It is available in the *Administration panel* section of the ![Settings icon](/img/assets/icons/v5/Cog.svg) *Settings* sub navigation. diff --git a/docusaurus/docs/user-docs/users-roles-permissions/configuring-end-users-roles.md b/docusaurus/docs/user-docs/users-roles-permissions/configuring-end-users-roles.md index cfe4ff5e20..7e5b4b29ec 100644 --- a/docusaurus/docs/user-docs/users-roles-permissions/configuring-end-users-roles.md +++ b/docusaurus/docs/user-docs/users-roles-permissions/configuring-end-users-roles.md @@ -5,8 +5,6 @@ displayed_sidebar: userDocsSidebar sidebar_position: 4 --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Configuring end-user roles End-users are the users who consume the content that is created and managed with a Strapi application and displayed on front-end applications (e.g. websites, mobile applications, connected devices etc.). Unlike the administrators, they do not have access to the admin panel. diff --git a/docusaurus/docs/user-docs/users-roles-permissions/managing-administrators.md b/docusaurus/docs/user-docs/users-roles-permissions/managing-administrators.md index 25819554ab..fddba5c4a7 100644 --- a/docusaurus/docs/user-docs/users-roles-permissions/managing-administrators.md +++ b/docusaurus/docs/user-docs/users-roles-permissions/managing-administrators.md @@ -4,7 +4,6 @@ displayed_sidebar: userDocsSidebar sidebar_position: 3 --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' import ScreenshotNumberReference from '/src/components/ScreenshotNumberReference.jsx'; # Managing administrator accounts diff --git a/docusaurus/docs/user-docs/users-roles-permissions/managing-end-users.md b/docusaurus/docs/user-docs/users-roles-permissions/managing-end-users.md index 5eecb5674f..a2098afd7f 100644 --- a/docusaurus/docs/user-docs/users-roles-permissions/managing-end-users.md +++ b/docusaurus/docs/user-docs/users-roles-permissions/managing-end-users.md @@ -5,8 +5,6 @@ displayed_sidebar: userDocsSidebar sidebar_position: 5 --- -import NotV5 from '/docs/snippets/_not-updated-to-v5.md' - # Managing end-user accounts End-users are the users who consume the content that is created and managed with a Strapi application and displayed on front-end applications (e.g. websites, mobile applications, connected devices etc.). Unlike the administrators, they do not have access to the admin panel. diff --git a/docusaurus/docusaurus.config.js b/docusaurus/docusaurus.config.js index 5a84fe9ec6..fb5a70f064 100644 --- a/docusaurus/docusaurus.config.js +++ b/docusaurus/docusaurus.config.js @@ -86,6 +86,9 @@ const config = { // 'data-modal-open-on-command-k': 'true', 'data-modal-override-open-class': "kapa-widget-button", 'data-modal-title-ask-ai': 'Ask your question', + 'data-modal-border-radius': '4px', + 'data-submit-query-button-bg-color': '#4945FF', + 'data-modal-body-padding-top': '20px', async: true, }, ], diff --git a/docusaurus/sidebars.js b/docusaurus/sidebars.js index b85b3b73a0..61086ed0cd 100644 --- a/docusaurus/sidebars.js +++ b/docusaurus/sidebars.js @@ -20,19 +20,23 @@ const sidebars = { label: 'Getting Started', className: 'category-getting-started', collapsible: false, - link: {type: 'doc', id: 'dev-docs/intro'}, items: [ 'dev-docs/quick-start', 'dev-docs/project-structure', 'dev-docs/installation', { type: 'doc', - id: 'user-docs/content-manager/introduction-to-content-manager', + id: 'user-docs/features/admin-panel', + label: 'Admin panel', + }, + { + type: 'doc', + id: 'user-docs/features/content-manager', label: 'Content Manager', }, { type: 'doc', - id: 'user-docs/content-type-builder/introduction-to-content-types-builder', + id: 'user-docs/features/content-type-builder', label: 'Content Type Builder', }, 'dev-docs/deployment', @@ -46,100 +50,149 @@ const sidebars = { items: [ { type: 'doc', - label: 'Draft & Publish', - id: 'user-docs/content-manager/saving-and-publishing-content' + label: 'API Tokens', + id: 'user-docs/features/api-tokens', }, { type: 'doc', - label: 'Content History', - id: 'user-docs/content-manager/working-with-content-history' - }, - { - type: 'doc', - label: 'Static Preview', - id: 'user-docs/intro', + label: 'Audit Logs', + id: 'user-docs/features/audit-logs', }, { type: 'doc', - label: 'Internationalization', - id: 'user-docs/content-manager/translating-content', + label: 'Content History', + id: 'user-docs/features/content-history' }, { type: 'doc', - label: 'Releases', - id: 'user-docs/releases/introduction', + label: 'Data Management', + id: 'user-docs/features/data-management' }, { type: 'doc', - label: 'Audit Logs', - id: 'user-docs/settings/audit-logs', + label: 'Draft & Publish', + id: 'user-docs/features/draft-and-publish' }, + 'user-docs/features/email', { type: 'doc', - label: 'Review Workflows', - id: 'user-docs/settings/review-workflows', + label: 'Internationalization (i18n)', + id: 'user-docs/features/internationalization', }, { type: 'doc', label: 'Media Library', - id: 'user-docs/media-library/introduction-to-the-media-library', + id: 'user-docs/features/media-library', }, { type: 'doc', - label: 'Upgrade tools', - id: 'dev-docs/upgrade-tool', + label: 'Role-Based Access Control (RBAC)', + id: 'user-docs/features/RBAC', }, { type: 'doc', - label: 'RBAC', - id: 'dev-docs/configurations/guides/rbac', - }, - { - type: 'category', - label: 'Users & Permissions', - link: {type: 'doc', id: 'user-docs/intro'}, - items: [ - 'user-docs/settings/API-tokens' - ] + label: 'Releases', + id: 'user-docs/features/releases', }, { type: 'doc', - label: 'SSO', - id: 'dev-docs/configurations/sso', - }, - { - type: 'category', - label: 'Data Management', - link: {type: 'doc', id: 'user-docs/intro'}, - items: [ - 'user-docs/settings/transfer-tokens' - ] + label: 'Review Workflows', + id: 'user-docs/features/review-workflows', }, { type: 'doc', - label: 'Providers', - id: 'dev-docs/providers', + label: 'Single Sign-On (SSO)', + id: 'user-docs/features/SSO', }, { type: 'doc', - label: 'Sentry', - id: 'dev-docs/plugins/sentry', + label: 'Static Preview', + id: 'user-docs/features/preview', }, { type: 'doc', - label: 'GraphQL', - id: 'dev-docs/plugins/graphql', + label: 'Users & Permissions', + id: 'user-docs/features/users-permissions', }, { - type: 'doc', - label: 'Documentation', - id: 'dev-docs/plugins/documentation', + type: 'category', + label: 'Strapi plugins', + collapsed: true, + items: [ + { + type: 'doc', + label: 'Documentation', + id: 'dev-docs/plugins/documentation', + }, + { + type: 'doc', + label: 'GraphQL', + id: 'dev-docs/plugins/graphql', + }, + { + type: 'doc', + label: 'Sentry', + id: 'dev-docs/plugins/sentry', + }, + ] }, + + ] + }, + { // APIs + type: 'category', + label: 'APIs', + className: 'category-api', + link: {type: 'doc', id:'dev-docs/api/content-api'}, + collapsible: false, + collapsed: false, + items: [ + 'dev-docs/api/content-api', + 'dev-docs/api/document', { - type: 'doc', - label: 'Email', - id: 'dev-docs/plugins/email', + type: 'category', + label: 'REST API', + link: {type: 'doc', id:'dev-docs/api/rest'}, + collapsed: true, + items: [ + { + type: 'doc', + id: 'dev-docs/api/rest', + label: 'Endpoints' + }, + 'dev-docs/api/rest/parameters', + 'dev-docs/api/rest/filters', + 'dev-docs/api/rest/locale', + 'dev-docs/api/rest/status', + 'dev-docs/api/rest/populate-select', + 'dev-docs/api/rest/relations', + 'dev-docs/api/rest/sort-pagination', + 'dev-docs/api/rest/upload', + 'dev-docs/api/rest/interactive-query-builder', + 'dev-docs/api/rest/guides/intro', + ] }, + 'dev-docs/api/graphql', + { + type: 'category', + label: 'Document Service API', + link: {type: 'doc', id:'dev-docs/api/document-service'}, + collapsed: true, + items: [ + { + type: 'doc', + id: 'dev-docs/api/document-service', + label: 'Available methods' + }, + 'dev-docs/api/document-service/fields', + 'dev-docs/api/document-service/filters', + 'dev-docs/api/document-service/locale', + 'dev-docs/api/document-service/middlewares', + 'dev-docs/api/document-service/populate', + 'dev-docs/api/document-service/sort-pagination', + 'dev-docs/api/document-service/status', + ] + } ] }, { // Configurations @@ -147,16 +200,44 @@ const sidebars = { label: 'Configurations', collapsed: false, collapsible: false, - link: {type: 'doc', id: 'dev-docs/configurations'}, className: 'category-configurations', items: [ - 'dev-docs/configurations/database', - 'dev-docs/configurations/server', + { + type: 'doc', + label: 'Configurations introduction', + id: 'dev-docs/configurations', + }, 'dev-docs/configurations/admin-panel', - 'dev-docs/configurations/middlewares', 'dev-docs/configurations/api', + 'dev-docs/configurations/api-tokens', + 'dev-docs/configurations/cron', + 'dev-docs/configurations/database', + 'dev-docs/configurations/environment', + 'dev-docs/configurations/features', + 'dev-docs/configurations/functions', + 'dev-docs/configurations/middlewares', 'dev-docs/configurations/plugins', + { + type: 'doc', + id: 'dev-docs/providers', + label: 'Email & Upload Providers' + }, + 'dev-docs/configurations/users-and-permissions-providers', + 'dev-docs/configurations/server', + 'dev-docs/configurations/sso', 'dev-docs/configurations/typescript', + { + type: 'category', + label: 'Guides', + collapsed: true, + items: [ + 'dev-docs/configurations/guides/access-cast-environment-variables', + 'dev-docs/configurations/guides/access-configuration-values', + 'dev-docs/configurations/guides/public-assets', + 'dev-docs/configurations/guides/rbac', + 'dev-docs/configurations/guides/use-cron-jobs', + ] + } ] }, { // Development @@ -165,34 +246,47 @@ const sidebars = { className: 'category-development', collapsible: false, collapsed: false, - link: {type: 'doc', id: 'dev-docs/customization'}, items: [ - { - type: 'doc', - id: 'dev-docs/backend-customization', - label: 'How the backend server works' - }, + 'dev-docs/customization', { type: 'category', label: 'Backend customization', - link: {type: 'doc', id: 'dev-docs/backend-customization'}, collapsible: true, - collapsed: false, + collapsed: true, items: [ + { + type: 'doc', + id: 'dev-docs/backend-customization', + label: 'How the backend server works' + }, 'dev-docs/backend-customization/routes', 'dev-docs/backend-customization/policies', 'dev-docs/backend-customization/middlewares', + 'dev-docs/backend-customization/controllers', + 'dev-docs/backend-customization/services', + 'dev-docs/backend-customization/models', + 'dev-docs/backend-customization/requests-responses', + 'dev-docs/backend-customization/webhooks', + ] + }, + { + type: 'category', + label: 'Admin panel customization', + collapsed: true, + items: [ { type: 'doc', - id: 'dev-docs/backend-customization/controllers', - customProps: { - new: true - } + id: 'dev-docs/admin-panel-customization', + label: 'What\'s possible' }, - 'dev-docs/backend-customization/services', + 'dev-docs/admin-panel-customization/bundlers', + 'dev-docs/admin-panel-customization/deployment', + 'dev-docs/admin-panel-customization/extension', + 'dev-docs/admin-panel-customization/host-port-path', + 'dev-docs/admin-panel-customization/options', + 'dev-docs/admin-panel-customization/wysiwyg-editor', ] }, - 'dev-docs/admin-panel-customization', 'dev-docs/cli', { type: 'doc', @@ -202,7 +296,8 @@ const sidebars = { 'dev-docs/database-migrations', 'dev-docs/database-transactions', 'dev-docs/testing', - 'dev-docs/error-handling' + 'dev-docs/error-handling', + 'dev-docs/templates', ] }, { // Plugins @@ -219,38 +314,26 @@ const sidebars = { }, { type: 'category', - link: { type: 'doc', id: 'dev-docs/plugins/developing-plugins' }, label: 'Plugins development', - collapsed: false, + collapsed: true, items: [ - 'dev-docs/plugins/development/plugin-sdk', + { + type: 'doc', + label: 'Developing plugins', + id: 'dev-docs/plugins/developing-plugins' + }, 'dev-docs/plugins/development/create-a-plugin', + 'dev-docs/plugins/development/plugin-sdk', + 'dev-docs/plugins/development/plugin-structure', 'dev-docs/custom-fields', - { - type: 'category', - label: 'Plugin APIs', - collapsed: false, - items: [ - 'dev-docs/plugins/admin-panel-api', - 'dev-docs/plugins/server-api', - ] - } + 'dev-docs/plugins/admin-panel-api', + 'dev-docs/plugins/server-api', + 'dev-docs/plugins-extension', ] } ] }, - { // APIs - type: 'category', - label: 'APIs', - className: 'category-api', - collapsible: false, - collapsed: false, - items: [ - 'dev-docs/api/rest', - 'dev-docs/api/graphql', - 'dev-docs/api/document-service', - ] - }, + { // Upgrades type: 'category', label: 'Upgrades', @@ -262,7 +345,7 @@ const sidebars = { { type: 'category', label: 'v4 → v5', - collapsed: false, + collapsed: true, items: [ 'dev-docs/migration/v4-to-v5/introduction-and-faq', 'dev-docs/migration/v4-to-v5/step-by-step', @@ -597,338 +680,338 @@ const sidebars = { ], }, ], - restApiSidebar: [ - { - type: 'link', - label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' - }, - { - type: 'category', - collapsed: false, - label: 'REST API reference', - link: { - type: 'doc', - id: 'dev-docs/api/rest' - }, - items: [ - { - type: 'category', - label: 'Endpoints and basic requests', - link: {type: 'doc', id: 'dev-docs/api/rest'}, - collapsed: false, - items: [ - { - type: 'link', - label: 'Endpoints', - href: '/dev-docs/api/rest#endpoints', - }, - { - type: 'link', - label: 'Get documents', - href: '/dev-docs/api/rest#get-all' - }, - { - type: 'link', - label: 'Get a document', - href: '/dev-docs/api/rest#get' - }, - { - type: 'link', - label: 'Create a document', - href: '/dev-docs/api/rest#create' - }, - { - type: 'link', - label: 'Update a document', - href: '/dev-docs/api/rest#update' - }, - { - type: 'link', - label: 'Delete a document', - href: '/dev-docs/api/rest#delete' - }, - ] - }, - { - type: 'doc', - id: 'dev-docs/api/rest/interactive-query-builder', - label: '✨ Interactive Query Builder' - }, - { - type: 'doc', - id: 'dev-docs/api/rest/parameters' - }, - { - type: 'category', - label: 'Populate and Select', - link: {type: 'doc', id: 'dev-docs/api/rest/populate-select'}, - collapsed: false, - items: [ - { - type: 'link', - label: 'Field selection', - href: '/dev-docs/api/rest/populate-select#field-selection', - }, - { - type: 'link', - label: 'Population', - href: '/dev-docs/api/rest/populate-select#population', - }, - ] - }, - { - type: 'category', - collapsed: false, - label: 'Filters, Locale, Publication State', - link: {type: 'doc', id: 'dev-docs/api/rest/filters-locale-publication' }, - items: [ - { - type: 'link', - label: 'Filtering', - href: '/dev-docs/api/rest/filters-locale-publication#filtering' - }, - { - type: 'link', - label: 'Complex filtering', - href: '/dev-docs/api/rest/filters-locale-publication#complex-filtering', - }, - { - type: 'link', - label: 'Deep filtering', - href: '/dev-docs/api/rest/filters-locale-publication#deep-filtering', - }, - { - type: 'link', - label: 'Locale', - href: '/dev-docs/api/rest/filters-locale-publication#locale', - }, - { - type: 'link', - label: 'Status', - href: '/dev-docs/api/rest/filters-locale-publication#status', - }, - ], - }, - { - type: 'category', - collapsed: false, - label: 'Sort and Pagination', - link: { type: 'doc', id: 'dev-docs/api/rest/sort-pagination'}, - items: [ - { - type: 'link', - label: 'Sorting', - href: '/dev-docs/api/rest/sort-pagination#sorting' - }, - { - type: 'link', - label: 'Pagination', - href: '/dev-docs/api/rest/sort-pagination#pagination' - }, - { - type: 'link', - label: 'Pagination by page', - href: '/dev-docs/api/rest/sort-pagination#pagination-by-page' - }, - { - type: 'link', - label: 'Pagination by offset', - href: '/dev-docs/api/rest/sort-pagination#pagination-by-offset' - }, - ] - }, - { - type: 'category', - collapsed: false, - label: 'Relations', - link: {type: 'doc', id: 'dev-docs/api/rest/relations'}, - items: [ - { - type: 'link', - label: 'connect', - href: '/dev-docs/api/rest/relations#connect' - }, - { - type: 'link', - label: 'disconnect', - href: '/dev-docs/api/rest/relations#disconnect' - }, - { - type: 'link', - label: 'set', - href: '/dev-docs/api/rest/relations#set' - }, - ] - }, - ] - }, - { - type: "category", - label: "Rest API guides", - collapsed: false, - link: { - type: 'doc', - id: 'dev-docs/api/rest/guides/intro', - }, - items: [ - { - type: "doc", - label: "Understanding populate", - id: 'dev-docs/api/rest/guides/understanding-populate', - }, - { - type: "doc", - label: "How to populate creator fields", - id: 'dev-docs/api/rest/guides/populate-creator-fields', - }, - { - type: 'link', - label: 'Additional resources', - href: '/dev-docs/api/rest/guides/intro#additional-resources' - }, - ], - } - ], - devDocsConfigSidebar: [ - { - type: 'link', - label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' - }, - { - type: 'category', - collapsed: false, - label: 'Configuration', - link: { - type: 'doc', - id: 'dev-docs/configurations', - }, - items: [ - { - type: 'doc', - label: 'Introduction to configurations', - id: 'dev-docs/configurations', - }, - { - type: 'category', - collapsed: false, - label: 'Base configurations', - link: { - type: 'doc', - id: 'dev-docs/configurations' - }, - items: [ - 'dev-docs/configurations/database', - 'dev-docs/configurations/server', - 'dev-docs/configurations/admin-panel', - 'dev-docs/configurations/middlewares', - 'dev-docs/configurations/api', - ] - }, - { - type: 'category', - label: 'Additional configurations', - collapsed: false, - link: { - type: 'doc', - id: 'dev-docs/configurations' - }, - items: [ - 'dev-docs/configurations/plugins', - 'dev-docs/configurations/typescript', - 'dev-docs/configurations/api-tokens', - 'dev-docs/configurations/functions', - 'dev-docs/configurations/cron', - 'dev-docs/configurations/environment', - 'dev-docs/configurations/sso', - 'dev-docs/configurations/features', - ] - }, - { - type: 'category', - label: 'Guides', - collapsed: false, - link: { - type: 'doc', - id: 'dev-docs/configurations' - }, - items: [ - 'dev-docs/configurations/guides/rbac', - 'dev-docs/configurations/guides/public-assets', - 'dev-docs/configurations/guides/access-cast-environment-variables', - 'dev-docs/configurations/guides/access-configuration-values', - 'dev-docs/configurations/guides/use-cron-jobs', - ] - } - ] - }, - ], - devDocsMigrationV5Sidebar: [ - { - type: 'link', - label: '⬅️ Back to Dev Docs content', - href: '/dev-docs/intro' - }, - { - type: 'category', - collapsed: false, - link: { - type: 'doc', - id: 'dev-docs/migration/v4-to-v5/introduction-and-faq' - }, - label: 'Upgrade to Strapi 5', - customProps: { - new: true, - }, - items: [ - { - type: "doc", - label: "Introduction and FAQ", - id: "dev-docs/migration/v4-to-v5/introduction-and-faq" - }, - { - type: "doc", - label: "Step-by-step guide", - id: "dev-docs/migration/v4-to-v5/step-by-step" - }, - { - type: "doc", - label: "Upgrade tool reference", - id: 'dev-docs/upgrade-tool', - }, - { - type: "category", - collapsible: true, - collapsed: true, - label: "Breaking changes", - link: { - type: 'doc', - id: 'dev-docs/migration/v4-to-v5/breaking-changes' - }, - items: [ - { - type: "autogenerated", - dirName: 'dev-docs/migration/v4-to-v5/breaking-changes' - }, - ] - }, - { - type: 'category', - label: 'Specific resources', - collapsed: false, - link: { type: 'doc', id: 'dev-docs/migration/v4-to-v5/additional-resources/introduction' }, - items: [ - 'dev-docs/migration/v4-to-v5/additional-resources/introduction', - 'dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service', - 'dev-docs/migration/v4-to-v5/additional-resources/plugins-migration', - 'dev-docs/migration/v4-to-v5/additional-resources/helper-plugin', - ] - } - ] - }, + // cmsSidebar: [ + // { + // type: 'link', + // label: '⬅️ Back to Dev Docs content', + // href: '/dev-docs/intro' + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'REST API reference', + // link: { + // type: 'doc', + // id: 'dev-docs/api/rest' + // }, + // items: [ + // { + // type: 'category', + // label: 'Endpoints and basic requests', + // link: {type: 'doc', id: 'dev-docs/api/rest'}, + // collapsed: false, + // items: [ + // { + // type: 'link', + // label: 'Endpoints', + // href: '/dev-docs/api/rest#endpoints', + // }, + // { + // type: 'link', + // label: 'Get documents', + // href: '/dev-docs/api/rest#get-all' + // }, + // { + // type: 'link', + // label: 'Get a document', + // href: '/dev-docs/api/rest#get' + // }, + // { + // type: 'link', + // label: 'Create a document', + // href: '/dev-docs/api/rest#create' + // }, + // { + // type: 'link', + // label: 'Update a document', + // href: '/dev-docs/api/rest#update' + // }, + // { + // type: 'link', + // label: 'Delete a document', + // href: '/dev-docs/api/rest#delete' + // }, + // ] + // }, + // { + // type: 'doc', + // id: 'dev-docs/api/rest/interactive-query-builder', + // label: '✨ Interactive Query Builder' + // }, + // { + // type: 'doc', + // id: 'dev-docs/api/rest/parameters' + // }, + // { + // type: 'category', + // label: 'Populate and Select', + // link: {type: 'doc', id: 'dev-docs/api/rest/populate-select'}, + // collapsed: false, + // items: [ + // { + // type: 'link', + // label: 'Field selection', + // href: '/dev-docs/api/rest/populate-select#field-selection', + // }, + // { + // type: 'link', + // label: 'Population', + // href: '/dev-docs/api/rest/populate-select#population', + // }, + // ] + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'Filters, Locale, Publication State', + // link: {type: 'doc', id: 'dev-docs/api/rest/filters-locale-publication' }, + // items: [ + // { + // type: 'link', + // label: 'Filtering', + // href: '/dev-docs/api/rest/filters' + // }, + // { + // type: 'link', + // label: 'Complex filtering', + // href: '/dev-docs/api/rest/filters-locale-publication#complex-filtering', + // }, + // { + // type: 'link', + // label: 'Deep filtering', + // href: '/dev-docs/api/rest/filters-locale-publication#deep-filtering', + // }, + // { + // type: 'link', + // label: 'Locale', + // href: '/dev-docs/api/rest/locale', + // }, + // { + // type: 'link', + // label: 'Status', + // href: '/dev-docs/api/rest/status', + // }, + // ], + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'Sort and Pagination', + // link: { type: 'doc', id: 'dev-docs/api/rest/sort-pagination'}, + // items: [ + // { + // type: 'link', + // label: 'Sorting', + // href: '/dev-docs/api/rest/sort-pagination#sorting' + // }, + // { + // type: 'link', + // label: 'Pagination', + // href: '/dev-docs/api/rest/sort-pagination#pagination' + // }, + // { + // type: 'link', + // label: 'Pagination by page', + // href: '/dev-docs/api/rest/sort-pagination#pagination-by-page' + // }, + // { + // type: 'link', + // label: 'Pagination by offset', + // href: '/dev-docs/api/rest/sort-pagination#pagination-by-offset' + // }, + // ] + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'Relations', + // link: {type: 'doc', id: 'dev-docs/api/rest/relations'}, + // items: [ + // { + // type: 'link', + // label: 'connect', + // href: '/dev-docs/api/rest/relations#connect' + // }, + // { + // type: 'link', + // label: 'disconnect', + // href: '/dev-docs/api/rest/relations#disconnect' + // }, + // { + // type: 'link', + // label: 'set', + // href: '/dev-docs/api/rest/relations#set' + // }, + // ] + // }, + // ] + // }, + // { + // type: "category", + // label: "Rest API guides", + // collapsed: false, + // link: { + // type: 'doc', + // id: 'dev-docs/api/rest/guides/intro', + // }, + // items: [ + // { + // type: "doc", + // label: "Understanding populate", + // id: 'dev-docs/api/rest/guides/understanding-populate', + // }, + // { + // type: "doc", + // label: "How to populate creator fields", + // id: 'dev-docs/api/rest/guides/populate-creator-fields', + // }, + // { + // type: 'link', + // label: 'Additional resources', + // href: '/dev-docs/api/rest/guides/intro#additional-resources' + // }, + // ], + // } + // ], + // devDocsConfigSidebar: [ + // { + // type: 'link', + // label: '⬅️ Back to Dev Docs content', + // href: '/dev-docs/intro' + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'Configuration', + // link: { + // type: 'doc', + // id: 'dev-docs/configurations', + // }, + // items: [ + // { + // type: 'doc', + // label: 'Introduction to configurations', + // id: 'dev-docs/configurations', + // }, + // { + // type: 'category', + // collapsed: false, + // label: 'Base configurations', + // link: { + // type: 'doc', + // id: 'dev-docs/configurations' + // }, + // items: [ + // 'dev-docs/configurations/database', + // 'dev-docs/configurations/server', + // 'dev-docs/configurations/admin-panel', + // 'dev-docs/configurations/middlewares', + // 'dev-docs/configurations/api', + // ] + // }, + // { + // type: 'category', + // label: 'Additional configurations', + // collapsed: false, + // link: { + // type: 'doc', + // id: 'dev-docs/configurations' + // }, + // items: [ + // 'dev-docs/configurations/plugins', + // 'dev-docs/configurations/typescript', + // 'dev-docs/configurations/api-tokens', + // 'dev-docs/configurations/functions', + // 'dev-docs/configurations/cron', + // 'dev-docs/configurations/environment', + // 'dev-docs/configurations/sso', + // 'dev-docs/configurations/features', + // ] + // }, + // { + // type: 'category', + // label: 'Guides', + // collapsed: false, + // link: { + // type: 'doc', + // id: 'dev-docs/configurations' + // }, + // items: [ + // 'dev-docs/configurations/guides/rbac', + // 'dev-docs/configurations/guides/public-assets', + // 'dev-docs/configurations/guides/access-cast-environment-variables', + // 'dev-docs/configurations/guides/access-configuration-values', + // 'dev-docs/configurations/guides/use-cron-jobs', + // ] + // } + // ] + // }, + // ], + // devDocsMigrationV5Sidebar: [ + // { + // type: 'link', + // label: '⬅️ Back to Dev Docs content', + // href: '/dev-docs/intro' + // }, + // { + // type: 'category', + // collapsed: false, + // link: { + // type: 'doc', + // id: 'dev-docs/migration/v4-to-v5/introduction-and-faq' + // }, + // label: 'Upgrade to Strapi 5', + // customProps: { + // new: true, + // }, + // items: [ + // { + // type: "doc", + // label: "Introduction and FAQ", + // id: "dev-docs/migration/v4-to-v5/introduction-and-faq" + // }, + // { + // type: "doc", + // label: "Step-by-step guide", + // id: "dev-docs/migration/v4-to-v5/step-by-step" + // }, + // { + // type: "doc", + // label: "Upgrade tool reference", + // id: 'dev-docs/upgrade-tool', + // }, + // { + // type: "category", + // collapsible: true, + // collapsed: true, + // label: "Breaking changes", + // link: { + // type: 'doc', + // id: 'dev-docs/migration/v4-to-v5/breaking-changes' + // }, + // items: [ + // { + // type: "autogenerated", + // dirName: 'dev-docs/migration/v4-to-v5/breaking-changes' + // }, + // ] + // }, + // { + // type: 'category', + // label: 'Specific resources', + // collapsed: false, + // link: { type: 'doc', id: 'dev-docs/migration/v4-to-v5/additional-resources/introduction' }, + // items: [ + // 'dev-docs/migration/v4-to-v5/additional-resources/introduction', + // 'dev-docs/migration/v4-to-v5/additional-resources/from-entity-service-to-document-service', + // 'dev-docs/migration/v4-to-v5/additional-resources/plugins-migration', + // 'dev-docs/migration/v4-to-v5/additional-resources/helper-plugin', + // ] + // } + // ] + // }, - ] + // ] }; module.exports = sidebars; diff --git a/docusaurus/src/components/Badge.js b/docusaurus/src/components/Badge.js index 79daa816b0..54aab67372 100644 --- a/docusaurus/src/components/Badge.js +++ b/docusaurus/src/components/Badge.js @@ -90,7 +90,19 @@ export function EnterpriseBadge(props) { variant="Enterprise" link="https://strapi.io/pricing-self-hosted" icon="feather" - tooltip="This feature is available with an Enterprise licence." + tooltip="This feature is available with an Enterprise plan." + {...props} + /> + ); +} + +export function GrowthBadge(props) { + return ( + ); diff --git a/docusaurus/src/components/CustomDocCard.js b/docusaurus/src/components/CustomDocCard.js index a0773c1840..3a30253f18 100644 --- a/docusaurus/src/components/CustomDocCard.js +++ b/docusaurus/src/components/CustomDocCard.js @@ -1,5 +1,6 @@ import React from 'react' import classNames from 'classnames'; +import Link from '@docusaurus/Link'; export default function CustomDocCard(props) { const { title, description, link, icon, small = false } = props; @@ -13,16 +14,14 @@ export default function CustomDocCard(props) { }); return ( ); } diff --git a/docusaurus/src/components/Guideflow.js b/docusaurus/src/components/Guideflow.js new file mode 100644 index 0000000000..4dd475dc96 --- /dev/null +++ b/docusaurus/src/components/Guideflow.js @@ -0,0 +1,51 @@ +import React from 'react'; +import { useColorMode } from '@docusaurus/theme-common'; + +export default function Guideflow({ lightId, darkId }) { + const { isDarkTheme } = useColorMode(); + + if (!lightId) return null; + + const iframeStyle = { + overflow: 'hidden', + position: 'absolute', + border: 'none', + width: '100%', + height: '100%', + transition: 'opacity 0.2s' + }; + + return ( +
+ +