mirror of
https://github.com/strapi/strapi.git
synced 2025-09-05 14:53:01 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
dffa0b03e3
22
ROADMAP.md
22
ROADMAP.md
@ -88,21 +88,21 @@ _Reorganize the mono-repository. The rule to follow is to only have hooks withou
|
|||||||
- ~~Improve generated APIs (especially the relation part)~~.
|
- ~~Improve generated APIs (especially the relation part)~~.
|
||||||
|
|
||||||
`strapi@alpha.8` *(expected release date: 22/12/2017)*:
|
`strapi@alpha.8` *(expected release date: 22/12/2017)*:
|
||||||
- [Admin] Install plugins directly from the interface.
|
- ~~[Admin] Install plugins directly from the interface~~.
|
||||||
- Ask database settings during the project creation.
|
- ~~Ask database settings during the project creation~~.
|
||||||
- Ping database before generating the project.
|
- ~~Ping database before generating the project~~.
|
||||||
- Allow associations between app's models and plugins' models.
|
- ~~Allow associations between app's models and plugins' models~~.
|
||||||
|
|
||||||
`strapi@alpha.9` *(expected release date: 12/01/2018)*:
|
`strapi@alpha.9` *(expected release date: 12/01/2018)*:
|
||||||
- [Plugin - Users & Permissions] Integrate providers authentication, email templates and advanced settings.
|
- ~~[Plugin] Analytics (homepage only)~~.
|
||||||
|
- ~~[Plugin - Users & Permissions] Integrate providers authentication, email templates and advanced settings~~.
|
||||||
|
|
||||||
`strapi@alpha.10` *(expected release date: 29/01/2018)*:
|
`strapi@alpha.10` *(expected release date: 15/02/2018)*:
|
||||||
- [Plugin] Analytics.
|
- [Framework] New core API to manage settings in database.
|
||||||
|
- [Admin] Refactor the Input component to make it more extensible.
|
||||||
|
|
||||||
`strapi@alpha.11` *(expected release date: 12/02/2018)*:
|
`strapi@alpha.11` *(expected release date: 02/03/2018)*:
|
||||||
- [Plugin] Upload.
|
- [Plugin] Upload.
|
||||||
- Re-design & improve the DX of the validations layer.
|
|
||||||
|
|
||||||
`strapi@alpha.12` *(expected release date: 02/03/2018)*:
|
`strapi@alpha.12` *(expected release date: 19/03/2018)*:
|
||||||
- [Plugin] Media Library.
|
|
||||||
- [Plugin] GraphQL.
|
- [Plugin] GraphQL.
|
||||||
|
@ -54,3 +54,4 @@
|
|||||||
### Migration
|
### Migration
|
||||||
* [Migrating from v1 to v3](migration/migration-guide.md)
|
* [Migrating from v1 to v3](migration/migration-guide.md)
|
||||||
* [Migrating from 3.0.0-alpha.7.4 to 3.0.0-alpha.8](migration/migration-guide-alpha-7-4-to-alpha-8.md)
|
* [Migrating from 3.0.0-alpha.7.4 to 3.0.0-alpha.8](migration/migration-guide-alpha-7-4-to-alpha-8.md)
|
||||||
|
* [Migrating from 3.0.0-alpha.8 to 3.0.0-alpha.9](migration/migration-guide-alpha-8-to-alpha-9.md)
|
||||||
|
@ -2,16 +2,19 @@
|
|||||||
|
|
||||||
The middlewares are functions which are composed and executed in a stack-like manner upon request. If you are not familiar with the middleware stack in Koa, we highly recommend you to read the [Koa's documentation introduction](http://koajs.com/#introduction).
|
The middlewares are functions which are composed and executed in a stack-like manner upon request. If you are not familiar with the middleware stack in Koa, we highly recommend you to read the [Koa's documentation introduction](http://koajs.com/#introduction).
|
||||||
|
|
||||||
|
Enable the middleware in environments settings
|
||||||
|
|
||||||
|
**Path —** [`config/environments/**`]
|
||||||
|
```json
|
||||||
|
"urlReader": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
**Path —** [`strapi/lib/middlewares/responseTime/index.js`](https://github.com/strapi/strapi/blob/master/packages/strapi/lib/middlewares/responseTime/index.js).
|
**Path —** [`strapi/lib/middlewares/responseTime/index.js`](https://github.com/strapi/strapi/blob/master/packages/strapi/lib/middlewares/responseTime/index.js).
|
||||||
```js
|
```js
|
||||||
module.exports = strapi => {
|
module.exports = strapi => {
|
||||||
return {
|
return {
|
||||||
defaults: {
|
|
||||||
responseTime: {
|
|
||||||
enabled: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function(cb) {
|
initialize: function(cb) {
|
||||||
strapi.app.use(async (ctx, next) => {
|
strapi.app.use(async (ctx, next) => {
|
||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
@ -30,7 +33,6 @@ module.exports = strapi => {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
- `defaults` (object): Contains the defaults configurations. This object is merged to `strapi.config.middleware.settings.**`.
|
|
||||||
- `initialize` (function): Called during the server boot. The callback `cb` needs to be called. Otherwise, the middleware won't be loaded into the stack.
|
- `initialize` (function): Called during the server boot. The callback `cb` needs to be called. Otherwise, the middleware won't be loaded into the stack.
|
||||||
|
|
||||||
The core of Strapi embraces a small list of middlewares for performances, security and great error handling.
|
The core of Strapi embraces a small list of middlewares for performances, security and great error handling.
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
# Migrating from 3.0.0-alpha.8 to 3.0.0-alpha.9
|
||||||
|
|
||||||
|
**Here are the major changes:**
|
||||||
|
|
||||||
|
- Put roles' permissions in database
|
||||||
|
- Providers connection (Facebook, GitHub, ...)
|
||||||
|
|
||||||
|
> Feel free to [join us on Slack](http://slack.strapi.io) and ask questions about the migration process.
|
||||||
|
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
Install Strapi `alpha.9` globally on your computer. To do so run `npm install strapi@3.0.0-alpha.9 -g`.
|
||||||
|
|
||||||
|
When it's done, generate a new empty project `strapi new myNewProject` (don't pay attention to the database configuration).
|
||||||
|
|
||||||
|
## Configurations
|
||||||
|
|
||||||
|
You will have to update just 2 files: `package.json` and `request.json`
|
||||||
|
|
||||||
|
- Edit the Strapi's dependencies version: (move Strapi's dependencies to `3.0.0-alpha.9` version) in `package.json` file
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"lodash": "4.x.x",
|
||||||
|
"strapi": "3.0.0-alpha.9",
|
||||||
|
"strapi-mongoose": "3.0.0-alpha.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
- Edit the `session.enabled` settings to `true` in each environment file: `/configs/environments/***/request.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"session": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Update the Admin
|
||||||
|
|
||||||
|
Delete your old admin folder and replace it by the new one.
|
||||||
|
|
||||||
|
|
||||||
|
## Update the Plugins
|
||||||
|
|
||||||
|
Copy this file `/plugins/users-permissions/config/jwt.json` **from your old project** and paste it in the corresponding one in your new project.
|
||||||
|
|
||||||
|
Copy the fields and relations you had in your `/plugins/users-permissions/models/User.settings.json` file in the new one.
|
||||||
|
|
||||||
|
Then, delete your old `plugins` folder and replace it by the new one.
|
||||||
|
|
||||||
|
|
||||||
|
## ⚠️ Roles update
|
||||||
|
|
||||||
|
Roles are now stored in your database. You will have to re-create and configure them via the admin dashboard.
|
||||||
|
|
||||||
|
|
||||||
|
## ⚠️ User collection/table name has changed
|
||||||
|
|
||||||
|
If you have an existing set of users in your database you will have to rename the collection/table from `user` to `users-permissions_user`.
|
||||||
|
|
||||||
|
Then update all your users by changing the old role id by the new one which is in `users-permissions_role` collection/table.
|
||||||
|
|
||||||
|
|
||||||
|
That's all, you have now upgraded to Strapi `alpha.9`.
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"assert": "~1.3.0",
|
"assert": "~1.3.0",
|
||||||
"babel-eslint": "^6.1.2",
|
"babel-eslint": "^6.1.2",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-admin",
|
"name": "strapi-admin",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Strapi Admin",
|
"description": "Strapi Admin",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -27,8 +27,8 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"sanitize.css": "^4.1.0",
|
"sanitize.css": "^4.1.0",
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3",
|
"strapi-helper-plugin": "3.0.0-alpha.9.1",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi",
|
"name": "Strapi",
|
||||||
|
@ -43,8 +43,6 @@ module.exports = function(strapi) {
|
|||||||
initialize: cb => {
|
initialize: cb => {
|
||||||
const connections = _.pickBy(strapi.config.connections, { connector: 'strapi-bookshelf' });
|
const connections = _.pickBy(strapi.config.connections, { connector: 'strapi-bookshelf' });
|
||||||
|
|
||||||
const done = _.after(_.size(connections), cb);
|
|
||||||
|
|
||||||
_.forEach(connections, (connection, connectionName) => {
|
_.forEach(connections, (connection, connectionName) => {
|
||||||
// Apply defaults
|
// Apply defaults
|
||||||
_.defaults(connection.settings, strapi.config.hook.settings.bookshelf);
|
_.defaults(connection.settings, strapi.config.hook.settings.bookshelf);
|
||||||
@ -70,11 +68,6 @@ module.exports = function(strapi) {
|
|||||||
ORM.plugin('pagination');
|
ORM.plugin('pagination');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Select models concerned by this connection
|
|
||||||
const models = _.pickBy(strapi.models, { connection: connectionName });
|
|
||||||
// Will call the done() method when every models will be loaded.
|
|
||||||
const loadedHook = _.after(_.size(models), done);
|
|
||||||
|
|
||||||
const mountModels = (models, target, plugin = false) => {
|
const mountModels = (models, target, plugin = false) => {
|
||||||
// Parse every registered model.
|
// Parse every registered model.
|
||||||
_.forEach(models, (definition, model) => {
|
_.forEach(models, (definition, model) => {
|
||||||
@ -205,7 +198,6 @@ module.exports = function(strapi) {
|
|||||||
// Push attributes to be aware of model schema.
|
// Push attributes to be aware of model schema.
|
||||||
target[model]._attributes = definition.attributes;
|
target[model]._attributes = definition.attributes;
|
||||||
|
|
||||||
loadedHook();
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
strapi.log.error('Impossible to register the `' + model + '` model.');
|
strapi.log.error('Impossible to register the `' + model + '` model.');
|
||||||
strapi.log.error(err);
|
strapi.log.error(err);
|
||||||
@ -395,6 +387,8 @@ module.exports = function(strapi) {
|
|||||||
mountModels(_.pickBy(strapi.plugins[name].models, { connection: connectionName }), plugin.models, name);
|
mountModels(_.pickBy(strapi.plugins[name].models, { connection: connectionName }), plugin.models, name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
cb();
|
||||||
},
|
},
|
||||||
|
|
||||||
getQueryParams: (value, type, key) => {
|
getQueryParams: (value, type, key) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-bookshelf",
|
"name": "strapi-bookshelf",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Bookshelf hook for the Strapi framework",
|
"description": "Bookshelf hook for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -19,8 +19,8 @@
|
|||||||
"bookshelf": "^0.10.3",
|
"bookshelf": "^0.10.3",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"pluralize": "^6.0.0",
|
"pluralize": "^6.0.0",
|
||||||
"strapi-knex": "3.0.0-alpha.8.3",
|
"strapi-knex": "3.0.0-alpha.9.1",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"isHook": true,
|
"isHook": true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-ejs",
|
"name": "strapi-ejs",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "EJS hook for the Strapi framework",
|
"description": "EJS hook for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-admin",
|
"name": "strapi-generate-admin",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate the default admin panel for a Strapi application.",
|
"description": "Generate the default admin panel for a Strapi application.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -15,7 +15,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^4.0.1",
|
"fs-extra": "^4.0.1",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"strapi-admin": "3.0.0-alpha.8.3"
|
"strapi-admin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"email": "hi@strapi.io",
|
"email": "hi@strapi.io",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-api",
|
"name": "strapi-generate-api",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate an API for a Strapi application.",
|
"description": "Generate an API for a Strapi application.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-controller",
|
"name": "strapi-generate-controller",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate a controller for a Strapi API.",
|
"description": "Generate a controller for a Strapi API.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-model",
|
"name": "strapi-generate-model",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate a model for a Strapi API.",
|
"description": "Generate a model for a Strapi API.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -83,15 +83,33 @@ module.exports = (scope, cb) => {
|
|||||||
// Install default plugins and link dependencies.
|
// Install default plugins and link dependencies.
|
||||||
function pluginsInstallation() {
|
function pluginsInstallation() {
|
||||||
// Define the list of default plugins.
|
// Define the list of default plugins.
|
||||||
const defaultPlugins = ['settings-manager', 'content-type-builder', 'content-manager', 'users-permissions', 'email'];
|
const defaultPlugins = [{
|
||||||
|
name: 'settings-manager',
|
||||||
|
core: true
|
||||||
|
}, {
|
||||||
|
name: 'content-type-builder',
|
||||||
|
core: true
|
||||||
|
}, {
|
||||||
|
name: 'content-manager',
|
||||||
|
core: true
|
||||||
|
}, {
|
||||||
|
name: 'users-permissions',
|
||||||
|
core: true
|
||||||
|
}, {
|
||||||
|
name: 'email',
|
||||||
|
core: true
|
||||||
|
}, {
|
||||||
|
name: 'analytics',
|
||||||
|
core: false
|
||||||
|
}];
|
||||||
|
|
||||||
// Install each plugin.
|
// Install each plugin.
|
||||||
defaultPlugins.forEach(defaultPlugin => {
|
defaultPlugins.forEach(defaultPlugin => {
|
||||||
try {
|
try {
|
||||||
execSync(`node ${strapiBin} install ${defaultPlugin} ${scope.developerMode ? '--dev' : ''}`);
|
execSync(`node ${strapiBin} install ${defaultPlugin.name} ${scope.developerMode && defaultPlugin.core ? '--dev' : ''}`);
|
||||||
logger.info(`The plugin ${defaultPlugin} has been successfully installed.`);
|
logger.info(`The plugin ${defaultPlugin.name} has been successfully installed.`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.error(`An error occurred during ${defaultPlugin} plugin installation.`);
|
logger.error(`An error occurred during ${defaultPlugin.name} plugin installation.`);
|
||||||
logger.error(error);
|
logger.error(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-new",
|
"name": "strapi-generate-new",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate a new Strapi application.",
|
"description": "Generate a new Strapi application.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"get-installed-path": "^3.0.1",
|
"get-installed-path": "^3.0.1",
|
||||||
"inquirer": "^4.0.2",
|
"inquirer": "^4.0.2",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3",
|
"strapi-utils": "3.0.0-alpha.9.1",
|
||||||
"uuid": "^3.1.0"
|
"uuid": "^3.1.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-plugin",
|
"name": "strapi-generate-plugin",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate an plugin for a Strapi application.",
|
"description": "Generate an plugin for a Strapi application.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-policy",
|
"name": "strapi-generate-policy",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate a policy for a Strapi API.",
|
"description": "Generate a policy for a Strapi API.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate-service",
|
"name": "strapi-generate-service",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Generate a service for a Strapi API.",
|
"description": "Generate a service for a Strapi API.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-generate",
|
"name": "strapi-generate",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Master of ceremonies for the Strapi generators.",
|
"description": "Master of ceremonies for the Strapi generators.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"fs-extra": "^4.0.0",
|
"fs-extra": "^4.0.0",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"reportback": "^2.0.1",
|
"reportback": "^2.0.1",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-helper-plugin",
|
"name": "strapi-helper-plugin",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Helper for Strapi plugins development",
|
"description": "Helper for Strapi plugins development",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 8.0.0",
|
"node": ">= 8.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-knex",
|
"name": "strapi-knex",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Knex hook for the Strapi framework",
|
"description": "Knex hook for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-middleware-views",
|
"name": "strapi-middleware-views",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Views hook to enable server-side rendering for the Strapi framework",
|
"description": "Views hook to enable server-side rendering for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-mongoose",
|
"name": "strapi-mongoose",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Mongoose hook for the Strapi framework",
|
"description": "Mongoose hook for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -19,7 +19,7 @@
|
|||||||
"mongoose": "^5.0.0-rc1",
|
"mongoose": "^5.0.0-rc1",
|
||||||
"mongoose-float": "^1.0.2",
|
"mongoose-float": "^1.0.2",
|
||||||
"pluralize": "^6.0.0",
|
"pluralize": "^6.0.0",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"isHook": true
|
"isHook": true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-plugin-content-manager",
|
"name": "strapi-plugin-content-manager",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "A powerful UI to easily manage your data.",
|
"description": "A powerful UI to easily manage your data.",
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"name": "Content Manager",
|
"name": "Content Manager",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"react-select": "^1.0.0-rc.5",
|
"react-select": "^1.0.0-rc.5",
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3"
|
"strapi-helper-plugin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-plugin-content-type-builder",
|
"name": "strapi-plugin-content-type-builder",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Strapi plugin to create content type (API).",
|
"description": "Strapi plugin to create content type (API).",
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"name": "Content Type Builder",
|
"name": "Content Type Builder",
|
||||||
@ -24,11 +24,11 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pluralize": "^7.0.0",
|
"pluralize": "^7.0.0",
|
||||||
"strapi-generate": "3.0.0-alpha.8.3",
|
"strapi-generate": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-api": "3.0.0-alpha.8.3"
|
"strapi-generate-api": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3"
|
"strapi-helper-plugin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-plugin-email",
|
"name": "strapi-plugin-email",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "This is the description of the plugin.",
|
"description": "This is the description of the plugin.",
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"name": "Email",
|
"name": "Email",
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"sendmail": "^1.2.0"
|
"sendmail": "^1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3"
|
"strapi-helper-plugin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-plugin-settings-manager",
|
"name": "strapi-plugin-settings-manager",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Strapi plugin to manage settings.",
|
"description": "Strapi plugin to manage settings.",
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"name": "Settings Manager",
|
"name": "Settings Manager",
|
||||||
@ -25,7 +25,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"flag-icon-css": "^2.8.0",
|
"flag-icon-css": "^2.8.0",
|
||||||
"react-select": "^1.0.0-rc.5",
|
"react-select": "^1.0.0-rc.5",
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3"
|
"strapi-helper-plugin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -70,6 +70,10 @@ module.exports = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!_.get(strapi.plugins['users-permissions'].config.grant[provider], 'enabled')) {
|
||||||
|
return ctx.badRequest(null, 'This provider is disabled.');
|
||||||
|
}
|
||||||
|
|
||||||
// Connect the user thanks to the third-party provider.
|
// Connect the user thanks to the third-party provider.
|
||||||
let user, error;
|
let user, error;
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-plugin-users-permissions",
|
"name": "strapi-plugin-users-permissions",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Protect your API with a full-authentication process based on JWT",
|
"description": "Protect your API with a full-authentication process based on JWT",
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"name": "Auth & Permissions",
|
"name": "Auth & Permissions",
|
||||||
@ -32,7 +32,7 @@
|
|||||||
"uuid": "^3.1.0"
|
"uuid": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.8.3"
|
"strapi-helper-plugin": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Strapi team",
|
"name": "Strapi team",
|
||||||
|
@ -45,35 +45,34 @@ exports.connect = (provider, query) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const user = await strapi.query('user', 'users-permissions').findOne({email: profile.email});
|
const users = await strapi.query('user', 'users-permissions').find({
|
||||||
|
email: profile.email
|
||||||
|
});
|
||||||
|
|
||||||
if (!strapi.plugins['users-permissions'].config.advanced.allow_register) {
|
if (_.isEmpty(_.find(users, {provider})) && !strapi.plugins['users-permissions'].config.advanced.allow_register) {
|
||||||
return resolve([null, [{ messages: [{ id: 'Auth.advanced.allow_register' }] }], 'Register action is actualy not available.']);
|
return resolve([null, [{ messages: [{ id: 'Auth.advanced.allow_register' }] }], 'Register action is actualy not available.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user && user.provider === provider) {
|
if (!_.isEmpty(_.find(users, {provider}))) {
|
||||||
return resolve([user, null]);
|
return resolve([user, null]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user && user.provider !== provider && strapi.plugins['users-permissions'].config.advanced.unique_email) {
|
if (!_.isEmpty(_.find(users, user => user.provider !== provider)) && strapi.plugins['users-permissions'].config.advanced.unique_email) {
|
||||||
return resolve([null, [{ messages: [{ id: 'Auth.form.error.email.taken' }] }], 'Email is already taken.']);
|
return resolve([null, [{ messages: [{ id: 'Auth.form.error.email.taken' }] }], 'Email is already taken.']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user || _.get(user, 'provider') !== provider) {
|
// Retrieve role `guest`.
|
||||||
// Retrieve role `guest`.
|
const guest = await strapi.query('role', 'users-permissions').findOne({ type: 'guest' }, []);
|
||||||
const guest = await strapi.query('role', 'users-permissions').findOne({ type: 'guest' }, []);
|
|
||||||
|
|
||||||
// Create the new user.
|
// Create the new user.
|
||||||
const params = _.assign(profile, {
|
const params = _.assign(profile, {
|
||||||
provider: provider,
|
provider: provider,
|
||||||
role: guest._id || guest.id
|
role: guest._id || guest.id
|
||||||
});
|
});
|
||||||
|
|
||||||
const createdUser = await strapi.query('user', 'users-permissions').create(params);
|
const createdUser = await strapi.query('user', 'users-permissions').create(params);
|
||||||
|
|
||||||
return resolve([createdUser, null]);
|
return resolve([createdUser, null]);
|
||||||
}
|
|
||||||
resolve([user, null]);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
reject([null, err]);
|
reject([null, err]);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-redis",
|
"name": "strapi-redis",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Redis hook for the Strapi framework",
|
"description": "Redis hook for the Strapi framework",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -18,7 +18,7 @@
|
|||||||
"ioredis": "^3.1.2",
|
"ioredis": "^3.1.2",
|
||||||
"lodash": "^4.17.4",
|
"lodash": "^4.17.4",
|
||||||
"stack-trace": "0.0.10",
|
"stack-trace": "0.0.10",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"strapi": {
|
"strapi": {
|
||||||
"isHook": true
|
"isHook": true
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi-utils",
|
"name": "strapi-utils",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "Shared utilities for the Strapi packages",
|
"description": "Shared utilities for the Strapi packages",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "strapi",
|
"name": "strapi",
|
||||||
"version": "3.0.0-alpha.8.3",
|
"version": "3.0.0-alpha.9.1",
|
||||||
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
|
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
|
||||||
"homepage": "http://strapi.io",
|
"homepage": "http://strapi.io",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@ -55,14 +55,14 @@
|
|||||||
"rimraf": "^2.6.2",
|
"rimraf": "^2.6.2",
|
||||||
"semver": "^5.4.1",
|
"semver": "^5.4.1",
|
||||||
"stack-trace": "0.0.10",
|
"stack-trace": "0.0.10",
|
||||||
"strapi-generate": "3.0.0-alpha.8.3",
|
"strapi-generate": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-admin": "3.0.0-alpha.8.3",
|
"strapi-generate-admin": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-api": "3.0.0-alpha.8.3",
|
"strapi-generate-api": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-new": "3.0.0-alpha.8.3",
|
"strapi-generate-new": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-plugin": "3.0.0-alpha.8.3",
|
"strapi-generate-plugin": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-policy": "3.0.0-alpha.8.3",
|
"strapi-generate-policy": "3.0.0-alpha.9.1",
|
||||||
"strapi-generate-service": "3.0.0-alpha.8.3",
|
"strapi-generate-service": "3.0.0-alpha.9.1",
|
||||||
"strapi-utils": "3.0.0-alpha.8.3"
|
"strapi-utils": "3.0.0-alpha.9.1"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"email": "hi@strapi.io",
|
"email": "hi@strapi.io",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user