diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 5d9ab64699..81a301ac52 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,6 +1,6 @@
# Contribute to Strapi
-👍🎉 First off, thanks for taking the time to contribute! 🎉👍
+First off, thanks for taking the time to contribute! 🎉👍
The following is a set of guidelines for contributing to Strapi and its packages.
@@ -32,40 +32,115 @@ If you send a pull request, please do it again the `master` branch. We are devel
## Setup Development Environment
To facilitate the contribution, we drastically reduce the amount of commands necessary to install the entire development environment. First of all, you need to check if you're using the recommended versions of Node.js (v8) and npm (v5).
-**Then, please follow the instructions below:**
+Then, please follow the instructions below:
-1. [Fork the repository](https://github.com/strapi/strapi) to your own GitHub account.
-2. Clone it to your computer `git clone git@github.com:strapi/strapi.git`.
-3. Run `npm run setup` at the root of the directory.
+#### 1. ▪️ Fork the repository
-> Note: If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
+[Go to the repository](https://github.com/strapi/strapi) and fork it to your own GitHub account.
-> Note: You can run `npm run setup:build` to build the plugins' admin (the setup time will be longer).
+#### 2. 💿 Clone the repository
+```bash
+git clone git@github.com:strapi/strapi.git
+```
-The development environment has been installed. Now, you have to create a development project to live-test your updates.
+#### 3. ⏳ Installation
+
+Go to the root of the repository.
+```bash
+cd strapi
+```
-1. Go to a folder on your computer `cd /path/to/my/folder`.
-2. Create a new project `strapi new myDevelopmentProject --dev`.
-3. Start your app with `strapi start`.
+**Two setup are available... with or without the front-end builds.**
-Awesome! You are now able to make bug fixes or enhancements in the framework layer of Strapi. **To make updates in the administration panel, you need to go a little bit further.**
+Without the front-end builds, you won't be able to access to the administration panel via http://localhost:1337/admin, you'll have to run the administration separately and access it through http://localhost:4000/admin.
-4. Open a new tab or new terminal window.
-5. Go to the `my-app/admin` folder of your currently running app.
-6. Run `npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin)
+
+
+Without the front-end builds (recommended)
+```bash
+npm run setup
+```
+or with the front-end builds
+```bash
+npm run setup:build
+```
+
+> ⚠️ If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
+
+#### 4. 🏗 Create a new project
+
+You can open a new terminal window and go into any folder you want for the next steps.
+```bash
+cd /.../workspace/
+```
+
+The command to generate a project is the same, except you have to add the `--dev` argument at the end of line.
+```bash
+strapi new my-project --dev
+```
+
+#### 5. 🚀 Start the project
+
+First, you have to start the server.
+```bash
+cd ./my-project
+strapi start
+```
+
+The server (API) is available at http://localhost:1337
+
+> ⚠️ If you've followed the recommended setup, you should not be able to reach the administration panel at http://localhost:1337/admin.
+
+Then, you have to start the Webpack server to build and run the administration.
+```bash
+cd ./my-project/admin
+npm run start
+```
+
+The administration panel is available at http://localhost:4000/admin
+
+**Awesome! You are now able to contribute to Strapi.**
+
+---
## Plugin Development Setup
-To create a new plugin, you'll have to run the following commands
+To create a new plugin, you'll have to run the following commands:
-1. In your project folder `cd myDevelopmentProject && strapi generate:plugin my-plugin`.
-2. Make sure that the `strapi-helper-plugin` is linked to your plugin
- - In the folder where strapi is cloned `cd pathToStrapiRepo/strapi/packages/strapi-helper-plugin && npm link`.
- - In your project folder `cd pathToMyProject/myDevelopmentProject/plugins/my-plugin && npm link strapi-helper-plugin`.
-3. Start the server in the admin folder `cd pathToMyProject/myDevelopmentProject/admin && npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin).
+#### 1. 🏗 Generate a new plugin
-***
+```bash
+cd ./my-project
+strapi generate:plugin my-plugin
+```
+
+#### 2. ✅ Verify the symlink
+
+Make you that the `strapi-helper-plugin` is linked to your project.
+
+Please run this command in the repository folder where Strapi is cloned:
+```bash
+cd /repository/strapi/packages/strapi-helper-plugin
+npm link
+```
+
+Link the `strapi-helper-plugin` node_modules in the plugin folder:
+```bash
+cd ./my-project/plugins/my-plugin
+npm link strapi-helper-plugin
+```
+
+#### 3. 🚀 Start the project
+
+```bash
+cd ./my-project/admin
+npm run start
+```
+
+The administration panel is available at http://localhost:4000/admin
+
+---
## Reporting an issue
diff --git a/README.md b/README.md
index 8d8a1610c0..6d152b0053 100755
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
The most advanced open-source Content Management Framework to build powerful API with no effort.
+The most advanced open-source Content Management Framework (headless-CMS) to build powerful API with no effort.
diff --git a/packages/strapi-admin/admin/src/containers/HomePage/index.js b/packages/strapi-admin/admin/src/containers/HomePage/index.js
index 39a12cc6aa..a307417f03 100644
--- a/packages/strapi-admin/admin/src/containers/HomePage/index.js
+++ b/packages/strapi-admin/admin/src/containers/HomePage/index.js
@@ -137,7 +137,7 @@ export class HomePage extends React.PureComponent {
const data = this.showFirstBlock()
? {
className: styles.homePageTutorialButton,
- href: 'https://strapi.io/documentation/getting-started/quick-start.html',
+ href: 'https://strapi.io/documentation/getting-started/quick-start.html#create-your-first-api',
id: 'app.components.HomePage.button.quickStart',
primary: true,
}
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
index 4de39e11f8..6f58869926 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/actions.js
@@ -8,8 +8,10 @@ import {
DOWNLOAD_PLUGIN,
DOWNLOAD_PLUGIN_ERROR,
DOWNLOAD_PLUGIN_SUCCEEDED,
- GET_PLUGINS,
- GET_PLUGINS_SUCCEEDED,
+ GET_AVAILABLE_PLUGINS,
+ GET_AVAILABLE_PLUGINS_SUCCEEDED,
+ GET_INSTALLED_PLUGINS,
+ GET_INSTALLED_PLUGINS_SUCCEEDED,
ON_CHANGE,
} from './constants';
@@ -32,19 +34,32 @@ export function downloadPluginSucceeded() {
};
}
-export function getPlugins() {
+export function getAvailablePlugins() {
return {
- type: GET_PLUGINS,
+ type: GET_AVAILABLE_PLUGINS,
};
}
-export function getPluginsSucceeded(availablePlugins) {
+export function getAvailablePluginsSucceeded(availablePlugins) {
return {
- type: GET_PLUGINS_SUCCEEDED,
+ type: GET_AVAILABLE_PLUGINS_SUCCEEDED,
availablePlugins,
};
}
+export function getInstalledPlugins() {
+ return {
+ type: GET_INSTALLED_PLUGINS,
+ };
+}
+
+export function getInstalledPluginsSucceeded(installedPlugins) {
+ return {
+ type: GET_INSTALLED_PLUGINS_SUCCEEDED,
+ installedPlugins,
+ };
+}
+
export function onChange({ target }) {
return {
type: ON_CHANGE,
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
index 2141383d83..06650ea0e6 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/constants.js
@@ -7,6 +7,8 @@
export const DOWNLOAD_PLUGIN = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN';
export const DOWNLOAD_PLUGIN_ERROR = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_ERROR';
export const DOWNLOAD_PLUGIN_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_SUCCEEDED';
-export const GET_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS';
-export const GET_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS_SUCCEEDED';
+export const GET_AVAILABLE_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS';
+export const GET_AVAILABLE_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS_SUCCEEDED';
+export const GET_INSTALLED_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS';
+export const GET_INSTALLED_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS_SUCCEEDED';
export const ON_CHANGE = 'StrapiAdmin/InstallPluginPage/ON_CHANGE';
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
index 49634bb882..c1c4016891 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/index.js
@@ -11,7 +11,7 @@ import { Helmet } from 'react-helmet';
import { FormattedMessage } from 'react-intl';
import { bindActionCreators, compose } from 'redux';
import cn from 'classnames';
-import { get, isUndefined, map } from 'lodash';
+import { map } from 'lodash';
import {
disableGlobalOverlayBlocker,
@@ -32,7 +32,8 @@ import injectReducer from 'utils/injectReducer';
import {
downloadPlugin,
- getPlugins,
+ getAvailablePlugins,
+ getInstalledPlugins,
onChange,
} from './actions';
@@ -55,8 +56,11 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
// Don't fetch the available plugins if it has already been done
if (!this.props.didFetchPlugins) {
- this.props.getPlugins();
+ this.props.getAvailablePlugins();
}
+
+ // Get installed plugins
+ this.props.getInstalledPlugins();
}
componentWillUnmount() {
@@ -65,10 +69,10 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
}
render() {
- if (!this.props.didFetchPlugins) {
+ if (!this.props.didFetchPlugins || !this.props.didFetchInstalledPlugins) {
return
;
}
-
+
return (
@@ -112,7 +116,7 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
key={plugin.id}
plugin={plugin}
showSupportUsButton={plugin.id === 'support-us'}
- isAlreadyInstalled={!isUndefined(get(this.context.plugins.toJS(), plugin.id))}
+ isAlreadyInstalled={this.props.installedPlugins.includes(plugin.id)}
downloadPlugin={(e) => {
e.preventDefault();
e.stopPropagation();
@@ -134,19 +138,18 @@ InstallPluginPage.childContextTypes = {
downloadPlugin: PropTypes.func.isRequired,
};
-InstallPluginPage.contextTypes = {
- plugins: PropTypes.object.isRequired,
-};
-
InstallPluginPage.propTypes = {
availablePlugins: PropTypes.array.isRequired,
blockApp: PropTypes.bool.isRequired,
+ didFetchInstalledPlugins: PropTypes.bool.isRequired,
didFetchPlugins: PropTypes.bool.isRequired,
disableGlobalOverlayBlocker: PropTypes.func.isRequired,
downloadPlugin: PropTypes.func.isRequired,
enableGlobalOverlayBlocker: PropTypes.func.isRequired,
- getPlugins: PropTypes.func.isRequired,
+ getAvailablePlugins: PropTypes.func.isRequired,
+ getInstalledPlugins: PropTypes.func.isRequired,
history: PropTypes.object.isRequired,
+ installedPlugins: PropTypes.array.isRequired,
// onChange: PropTypes.func.isRequired,
// search: PropTypes.string.isRequired,
};
@@ -159,7 +162,8 @@ function mapDispatchToProps(dispatch) {
disableGlobalOverlayBlocker,
downloadPlugin,
enableGlobalOverlayBlocker,
- getPlugins,
+ getAvailablePlugins,
+ getInstalledPlugins,
onChange,
},
dispatch,
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
index cc70f6f36c..2f7f007b46 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/reducer.js
@@ -9,14 +9,17 @@ import {
DOWNLOAD_PLUGIN,
DOWNLOAD_PLUGIN_ERROR,
DOWNLOAD_PLUGIN_SUCCEEDED,
- GET_PLUGINS_SUCCEEDED,
+ GET_AVAILABLE_PLUGINS_SUCCEEDED,
+ GET_INSTALLED_PLUGINS_SUCCEEDED,
ON_CHANGE,
} from './constants';
const initialState = fromJS({
availablePlugins: List([]),
+ installedPlugins: List([]),
blockApp: false,
didFetchPlugins: false,
+ didFetchInstalledPlugins: false,
pluginToDownload: '',
search: '',
});
@@ -35,10 +38,14 @@ function installPluginPageReducer(state = initialState, action) {
return state
.set('blockApp', false)
.set('pluginToDownload', '');
- case GET_PLUGINS_SUCCEEDED:
+ case GET_AVAILABLE_PLUGINS_SUCCEEDED:
return state
.set('didFetchPlugins', true)
.set('availablePlugins', List(action.availablePlugins));
+ case GET_INSTALLED_PLUGINS_SUCCEEDED:
+ return state
+ .set('didFetchInstalledPlugins', true)
+ .set('installedPlugins', List(action.installedPlugins));
case ON_CHANGE:
return state.updateIn(action.keys, () => action.value);
default:
diff --git a/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js b/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
index ee8c18c416..0a2384a6b0 100644
--- a/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
+++ b/packages/strapi-admin/admin/src/containers/InstallPluginPage/saga.js
@@ -15,9 +15,10 @@ import { selectLocale } from '../LanguageProvider/selectors';
import {
downloadPluginError,
downloadPluginSucceeded,
- getPluginsSucceeded,
+ getAvailablePluginsSucceeded,
+ getInstalledPluginsSucceeded,
} from './actions';
-import { DOWNLOAD_PLUGIN, GET_PLUGINS } from './constants';
+import { DOWNLOAD_PLUGIN, GET_AVAILABLE_PLUGINS, GET_INSTALLED_PLUGINS } from './constants';
import { makeSelectPluginToDownload } from './selectors';
@@ -49,7 +50,7 @@ export function* pluginDownload() {
}
}
-export function* pluginsGet() {
+export function* getAvailablePlugins() {
try {
// Get current locale.
const locale = yield select(selectLocale());
@@ -73,20 +74,44 @@ export function* pluginsGet() {
availablePlugins = [];
}
- yield put(getPluginsSucceeded(availablePlugins));
+ yield put(getAvailablePluginsSucceeded(availablePlugins));
} catch(err) {
strapi.notification.error('notification.error');
}
}
+export function* getInstalledPlugins() {
+ try {
+ const opts = {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ };
+ let installedPlugins;
+
+ try {
+ // Retrieve plugins list.
+ installedPlugins = yield call(request, '/admin/plugins', opts);
+ } catch (e) {
+ installedPlugins = [];
+ }
+
+ yield put(getInstalledPluginsSucceeded(Object.keys(installedPlugins.plugins)));
+ } catch(err) {
+ strapi.notification.error('notification.error');
+ }
+}
// Individual exports for testing
export default function* defaultSaga() {
- const loadPluginsWatcher = yield fork(takeLatest, GET_PLUGINS, pluginsGet);
+ const loadAvailablePluginsWatcher = yield fork(takeLatest, GET_AVAILABLE_PLUGINS, getAvailablePlugins);
+ const loadInstalledPluginsWatcher = yield fork(takeLatest, GET_INSTALLED_PLUGINS, getInstalledPlugins);
yield fork(takeLatest, DOWNLOAD_PLUGIN, pluginDownload);
yield take(LOCATION_CHANGE);
- yield cancel(loadPluginsWatcher);
+ yield cancel(loadAvailablePluginsWatcher);
+ yield cancel(loadInstalledPluginsWatcher);
}
diff --git a/packages/strapi-admin/admin/src/translations/de.json b/packages/strapi-admin/admin/src/translations/de.json
index dffa3c4271..e302899aba 100644
--- a/packages/strapi-admin/admin/src/translations/de.json
+++ b/packages/strapi-admin/admin/src/translations/de.json
@@ -16,12 +16,12 @@
"app.components.HomePage.welcome": "Willkommen an Bord!",
"app.components.HomePage.welcome.again": "Willkommen",
"app.components.HomePage.create": "Erstelle deinen ersten Inhaltstyp",
- "app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht an\u0020",
- "app.components.HomePage.welcomeBlock.content.issues": "Fehler",
- "app.components.HomePage.welcomeBlock.content.raise": "\u0020oder erhöhen\u0020",
+ "app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht in\u0020",
+ "app.components.HomePage.welcomeBlock.content.issues": "Ticket.",
+ "app.components.HomePage.welcomeBlock.content.raise": "\u0020oder eröffne\u0020",
"app.components.HomePage.createBlock.content.first": "Das\u0020",
- "app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unsere\u0020",
- "app.components.HomePage.createBlock.content.tutorial": "\u0020Anleitung.",
+ "app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unser\u0020",
+ "app.components.HomePage.createBlock.content.tutorial": "\u0020Tutorial.",
"app.components.HomePage.welcomeBlock.content.again": "Wir hoffen, dass du Fortschritte bei deinem Projekt machst.... Lese das Neueste über Strapi. Wir geben unser Bestes, um das Produkt auf der Grundlage deines Feedbacks zu verbessern.",
"app.components.HomePage.cta": "BESTÄTIGEN",
"app.components.HomePage.community": "Finde die Community im Web",
@@ -44,7 +44,7 @@
"app.components.InstallPluginPage.helmet": "Marktplatz - Plugins",
"app.components.InstallPluginPage.title": "Marktplatz - Plugins",
- "app.components.InstallPluginPage.description": "Erweitere problemlos deine App",
+ "app.components.InstallPluginPage.description": "Erweitere problemlos deine App.",
"app.components.InstallPluginPage.plugin.support-us.description": "Unterstütze uns durch den Kauf eines Strapi T-Shirts. Das erlaubt uns, weiter an dem Projekt arbeiten zu können und es so gut wie nur möglich zu gestalten!",
"app.components.InstallPluginPage.InputSearch.label": " ",
"app.components.InstallPluginPage.InputSearch.placeholder": "Suche nach einem Plugin... (z.B.: Authentifizierung)",
@@ -126,20 +126,20 @@
"components.ListRow.empty": "Es gibt keine Daten.",
- "components.Wysiwyg.collapse": "Collapse",
- "components.Wysiwyg.selectOptions.title": "Add a title",
- "components.Wysiwyg.selectOptions.H1": "Title H1",
- "components.Wysiwyg.selectOptions.H2": "Title H2",
- "components.Wysiwyg.selectOptions.H3": "Title H3",
- "components.Wysiwyg.selectOptions.H4": "Title H4",
- "components.Wysiwyg.selectOptions.H5": "Title H5",
- "components.Wysiwyg.selectOptions.H6": "Title H6",
- "components.Wysiwyg.ToggleMode.markdown": "Switch to markdown",
- "components.Wysiwyg.ToggleMode.preview": "Switch to preview",
- "components.WysiwygBottomControls.charactersIndicators": "characters",
- "components.WysiwygBottomControls.uploadFiles": "Attach files by dragging & dropping, {browse}, or pasting from the clipboard.",
- "components.WysiwygBottomControls.uploadFiles.browse": "selecting them",
- "components.WysiwygBottomControls.fullscreen": "Expand",
+ "components.Wysiwyg.collapse": "Verkleinern",
+ "components.Wysiwyg.selectOptions.title": "Füge einen Überschrift hinzu",
+ "components.Wysiwyg.selectOptions.H1": "Überschrift H1",
+ "components.Wysiwyg.selectOptions.H2": "Überschrift H2",
+ "components.Wysiwyg.selectOptions.H3": "Überschrift H3",
+ "components.Wysiwyg.selectOptions.H4": "Überschrift H4",
+ "components.Wysiwyg.selectOptions.H5": "Überschrift H5",
+ "components.Wysiwyg.selectOptions.H6": "Überschrift H6",
+ "components.Wysiwyg.ToggleMode.markdown": "Wechsel zu Markdown",
+ "components.Wysiwyg.ToggleMode.preview": "Wechsel zur Vorschau",
+ "components.WysiwygBottomControls.charactersIndicators": "Zeichen",
+ "components.WysiwygBottomControls.uploadFiles": "Ziehe eine Datei hierher, {browse} eine Datei zum hochladen aus oder füge sie aus der Zwischenablage ein.",
+ "components.WysiwygBottomControls.uploadFiles.browse": "wähle",
+ "components.WysiwygBottomControls.fullscreen": "Vergrößern",
"HomePage.notification.newsLetter.success": "Newsletter erfolgreich abonniert",
@@ -148,7 +148,7 @@
"Analytics": "Analytics",
"Auth & Permissions": "Authentifizierung & Berechtigungen",
- "Content Manager": "Content-Manager",
+ "Content Manager": "Inhalts-Manager",
"Content Type Builder": "Inhaltstyp-Manager",
"Files Upload": "Dateien hochladen",
"Settings Manager": "Einstellungs-Manager",
diff --git a/packages/strapi-admin/package.json b/packages/strapi-admin/package.json
index b5778e1491..ac84a280e2 100755
--- a/packages/strapi-admin/package.json
+++ b/packages/strapi-admin/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-admin",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Strapi Admin",
"repository": {
"type": "git",
@@ -31,8 +31,8 @@
},
"devDependencies": {
"sanitize.css": "^4.1.0",
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1",
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi",
@@ -51,4 +51,4 @@
"npm": ">= 5.0.0"
},
"license": "MIT"
-}
+}
\ No newline at end of file
diff --git a/packages/strapi-email-amazon-ses/package.json b/packages/strapi-email-amazon-ses/package.json
index 1c58d73fa1..47ece20ed4 100644
--- a/packages/strapi-email-amazon-ses/package.json
+++ b/packages/strapi-email-amazon-ses/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-email-amazon-ses",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Amazon SES provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-email-mailgun/package.json b/packages/strapi-email-mailgun/package.json
index c59e63d4ab..5509d9eaeb 100644
--- a/packages/strapi-email-mailgun/package.json
+++ b/packages/strapi-email-mailgun/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-email-mailgun",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Mailgun provider for strapi email plugin",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-email-sendgrid/package.json b/packages/strapi-email-sendgrid/package.json
index c9f50abcee..317ae57c95 100644
--- a/packages/strapi-email-sendgrid/package.json
+++ b/packages/strapi-email-sendgrid/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-email-sendgrid",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Sendgrid provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-email-sendmail/package.json b/packages/strapi-email-sendmail/package.json
index fa046d68f2..2e5b075970 100644
--- a/packages/strapi-email-sendmail/package.json
+++ b/packages/strapi-email-sendmail/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-email-sendmail",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Sendmail provider for strapi email",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-generate-admin/package.json b/packages/strapi-generate-admin/package.json
index eb031e75d9..8be68236f4 100755
--- a/packages/strapi-generate-admin/package.json
+++ b/packages/strapi-generate-admin/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-admin",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate the default admin panel for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,9 +14,9 @@
},
"dependencies": {
"fs-extra": "^4.0.1",
- "lodash": "^4.17.4",
- "strapi-admin": "3.0.0-alpha.13.0.1",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "lodash": "^4.17.5",
+ "strapi-admin": "3.0.0-alpha.13.1",
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"email": "hi@strapi.io",
diff --git a/packages/strapi-generate-api/package.json b/packages/strapi-generate-api/package.json
index bfb0c13df0..5c45719c0a 100755
--- a/packages/strapi-generate-api/package.json
+++ b/packages/strapi-generate-api/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-api",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate an API for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@@ -13,7 +13,7 @@
"lib": "./lib"
},
"dependencies": {
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"pluralize": "^6.0.0"
},
"scripts": {
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-controller/package.json b/packages/strapi-generate-controller/package.json
index 5cd499799d..23eeed6231 100755
--- a/packages/strapi-generate-controller/package.json
+++ b/packages/strapi-generate-controller/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-controller",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate a controller for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,7 +14,7 @@
"lib": "./lib"
},
"dependencies": {
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"scripts": {
"prepublish": "npm prune"
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-model/package.json b/packages/strapi-generate-model/package.json
index fbad572226..d297308cea 100755
--- a/packages/strapi-generate-model/package.json
+++ b/packages/strapi-generate-model/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-model",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate a model for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,7 +14,7 @@
"lib": "./lib"
},
"dependencies": {
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"scripts": {
"prepublish": "npm prune"
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-new/lib/after.js b/packages/strapi-generate-new/lib/after.js
index f704dc6d5e..17a8e38092 100755
--- a/packages/strapi-generate-new/lib/after.js
+++ b/packages/strapi-generate-new/lib/after.js
@@ -187,10 +187,10 @@ module.exports = (scope, cb) => {
console.log();
console.log(`👌 Your new application ${green(scope.name)} is ready at ${cyan(scope.rootPath)}.`);
console.log();
- console.log('⚡️ change directory:');
+ console.log('⚡️ Change directory:');
console.log(`$ ${green(`cd ${scope.name}`)}`);
console.log();
- console.log('⚡️ start application:');
+ console.log('⚡️ Start application:');
console.log(`$ ${green('strapi start')}`);
cb();
diff --git a/packages/strapi-generate-new/lib/before.js b/packages/strapi-generate-new/lib/before.js
index 4182643982..411063f82e 100755
--- a/packages/strapi-generate-new/lib/before.js
+++ b/packages/strapi-generate-new/lib/before.js
@@ -132,7 +132,7 @@ module.exports = (scope, cb) => {
type: 'input',
name: 'database',
message: 'Database name:',
- default: _.get(scope.database, 'database', 'strapi')
+ default: _.get(scope.database, 'database', scope.name)
},
{
when: !hasDatabaseConfig,
diff --git a/packages/strapi-generate-new/package.json b/packages/strapi-generate-new/package.json
index e59055ecd3..7d00a873c8 100755
--- a/packages/strapi-generate-new/package.json
+++ b/packages/strapi-generate-new/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-new",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate a new Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@@ -17,9 +17,9 @@
"fs-extra": "^4.0.0",
"inquirer": "^4.0.2",
"listr": "^0.14.1",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"ora": "^2.1.0",
- "strapi-utils": "3.0.0-alpha.13.0.1",
+ "strapi-utils": "3.0.0-alpha.13.1",
"uuid": "^3.1.0"
},
"scripts": {
@@ -49,4 +49,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-plugin/package.json b/packages/strapi-generate-plugin/package.json
index 79188e5162..f8a862e611 100755
--- a/packages/strapi-generate-plugin/package.json
+++ b/packages/strapi-generate-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-plugin",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate an plugin for a Strapi application.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,7 +14,7 @@
},
"dependencies": {
"fs-extra": "^4.0.0",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"pluralize": "^6.0.0"
},
"scripts": {
@@ -44,4 +44,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-policy/package.json b/packages/strapi-generate-policy/package.json
index e37c9fc5aa..bad4e49062 100755
--- a/packages/strapi-generate-policy/package.json
+++ b/packages/strapi-generate-policy/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-policy",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate a policy for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,7 +14,7 @@
"lib": "./lib"
},
"dependencies": {
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"scripts": {
"prepublishOnly": "npm prune"
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate-service/package.json b/packages/strapi-generate-service/package.json
index ec20e0f2e4..f16d1811d1 100755
--- a/packages/strapi-generate-service/package.json
+++ b/packages/strapi-generate-service/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate-service",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Generate a service for a Strapi API.",
"homepage": "http://strapi.io",
"keywords": [
@@ -14,7 +14,7 @@
"lib": "./lib"
},
"dependencies": {
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"scripts": {
"prepublishOnly": "npm prune"
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-generate/package.json b/packages/strapi-generate/package.json
index ecdd5c347e..32279fc009 100755
--- a/packages/strapi-generate/package.json
+++ b/packages/strapi-generate/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-generate",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Master of ceremonies for the Strapi generators.",
"homepage": "http://strapi.io",
"keywords": [
@@ -15,9 +15,9 @@
"dependencies": {
"async": "^2.5.0",
"fs-extra": "^4.0.0",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"reportback": "^2.0.1",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js
index 708d4bb4e5..3e446c207e 100755
--- a/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js
+++ b/packages/strapi-helper-plugin/lib/internals/webpack/webpack.base.babel.js
@@ -51,7 +51,10 @@ if (isAdmin && !isSetup) {
);
try {
- const server = require(serverConfig);
+ const { templateConfiguration } = require(path.join(adminPath, 'node_modules', 'strapi-utils'));
+
+ let server = require(serverConfig);
+ server = templateConfiguration(server);
if (process.env.PWD.indexOf('/admin') !== -1) {
if (_.get(server, 'admin.build.host')) {
@@ -61,7 +64,7 @@ if (isAdmin && !isSetup) {
}
URLs.publicPath = URLs.host;
- URLs.backend = _.get(server, 'admin.build.backend', `/`);
+ URLs.backend = _.get(server, 'admin.build.backend', '/');
if (_.get(server, 'admin.build.plugins.source') === 'backend') {
URLs.mode = 'backend';
diff --git a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
index c3d3e8de52..5f7d28c846 100644
--- a/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/BackHeader/styles.scss
@@ -4,7 +4,7 @@
height: 6rem;
width: 6.5rem;
line-height: 6rem;
- z-index: 999;
+ z-index: 1040;
text-align: center;
background-color: #FFFFFF;
color: #81848A;
diff --git a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
index 4073f1c0c9..ff676fed82 100644
--- a/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/ImgPreview/styles.scss
@@ -20,7 +20,7 @@
background-repeat: no-repeat !important;
white-space: nowrap;
- z-index: 1;
+ z-index: 1 !important;
> img {
position: absolute;
top: 0;
@@ -49,7 +49,7 @@
display: block;
position: absolute;
top: 37px;
- z-index: 9999;
+ z-index: 999;
padding: 12px 40px 0 40px;
line-height: 18px;
color: #fff !important;
diff --git a/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss b/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
index 0a52aadf99..f035392e83 100644
--- a/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
+++ b/packages/strapi-helper-plugin/lib/src/components/ImgPreviewRemoveIcon/styles.scss
@@ -6,6 +6,6 @@
height: 20px;
color: #fff;
font-size: 11px;
- z-index: 9999;
+ z-index: 999;
cursor: pointer;
}
diff --git a/packages/strapi-helper-plugin/package.json b/packages/strapi-helper-plugin/package.json
index 3a0519748f..82628e9877 100755
--- a/packages/strapi-helper-plugin/package.json
+++ b/packages/strapi-helper-plugin/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-helper-plugin",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Helper for Strapi plugins development",
"engines": {
"node": ">= 9.0.0",
@@ -73,7 +73,7 @@
"intl": "^1.2.5",
"invariant": "2.2.1",
"json-loader": "^0.5.7",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"lodash-webpack-plugin": "^0.11.4",
"mocha": "3.1.2",
"moment": "^2.16.0",
diff --git a/packages/strapi-hook-bookshelf/lib/index.js b/packages/strapi-hook-bookshelf/lib/index.js
index f91837dcc3..ff0d8fc8d0 100755
--- a/packages/strapi-hook-bookshelf/lib/index.js
+++ b/packages/strapi-hook-bookshelf/lib/index.js
@@ -26,9 +26,6 @@ const GLOBALS = {};
* Bookshelf hook
*/
-/* eslint-disable no-unused-vars */
-/* eslint-disable prefer-template */
-/* eslint-disable no-case-declarations */
module.exports = function(strapi) {
const hook = _.merge({
/**
@@ -79,17 +76,16 @@ module.exports = function(strapi) {
_.forEach(models, (definition, model) => {
definition.globalName = _.upperFirst(_.camelCase(definition.globalId));
- _.defaults(definition, {
- primaryKey: 'id'
- });
-
// Define local GLOBALS to expose every models in this file.
GLOBALS[definition.globalId] = {};
// Add some informations about ORM & client connection & tableName
definition.orm = 'bookshelf';
definition.client = _.get(connection.settings, 'client');
-
+ _.defaults(definition, {
+ primaryKey: 'id',
+ primaryKeyType: _.get(definition, 'options.idAttributeType', 'integer')
+ });
// Register the final model for Bookshelf.
const loadedModel = _.assign({
tableName: definition.collectionName,
@@ -287,7 +283,7 @@ module.exports = function(strapi) {
: Promise.resolve();
});
- this.on('saving', (instance, attrs) => {
+ this.on('saving', (instance, attrs, options) => { //eslint-disable-line
instance.attributes = mapper(instance.attributes);
attrs = mapper(attrs);
@@ -394,13 +390,16 @@ module.exports = function(strapi) {
case 'oneToOne':
case 'manyToOne':
case 'oneWay':
- type = definition.client === 'pg' ? 'integer' : 'int';
+ type = definition.primaryKeyType;
break;
default:
return null;
}
} else {
switch (attribute.type) {
+ case 'uuid':
+ type = definition.client === 'pg' ? 'uuid' : 'varchar(36)';
+ break;
case 'text':
type = definition.client === 'pg' ? type = 'text' : 'longtext';
break;
@@ -521,7 +520,13 @@ module.exports = function(strapi) {
if (!tableExist) {
- const columns = generateColumns(attributes, [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`]).join(',\n\r');
+ let idAttributeBuilder = [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`];
+ if (definition.primaryKeyType === 'uuid' && definition.client === 'pg') {
+ idAttributeBuilder = ['id uuid NOT NULL DEFAULT uuid_generate_v4() NOT NULL PRIMARY KEY'];
+ } else if (definition.primaryKeyType !== 'integer') {
+ idAttributeBuilder = [`id ${getType({type: definition.primaryKeyType})} NOT NULL PRIMARY KEY`];
+ }
+ const columns = generateColumns(attributes, idAttributeBuilder).join(',\n\r');
// Create table
await ORM.knex.raw(`
@@ -593,7 +598,6 @@ module.exports = function(strapi) {
const changeRequired = definition.client === 'pg'
? `ALTER COLUMN ${quote}${attribute}${quote} ${attributes[attribute].required ? 'SET' : 'DROP'} NOT NULL`
: `CHANGE ${quote}${attribute}${quote} ${quote}${attribute}${quote} ${type} ${attributes[attribute].required ? 'NOT' : ''} NULL`;
-
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeType}`);
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeRequired}`);
}
@@ -631,10 +635,10 @@ module.exports = function(strapi) {
if (morphRelations) {
const attributes = {
[`${loadedModel.tableName}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${morphRelations.alias}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${morphRelations.alias}_type`]: {
type: 'text'
@@ -661,10 +665,10 @@ module.exports = function(strapi) {
const attributes = {
[`${pluralize.singular(manyRelations.collection)}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
},
[`${pluralize.singular(definition.globalId.toLowerCase())}_id`]: {
- type: 'integer'
+ type: definition.primaryKeyType
}
};
@@ -999,7 +1003,7 @@ module.exports = function(strapi) {
cb();
},
- getQueryParams: (value, type, key) => {
+ getQueryParams: (value, type, key) =>{
const result = {};
switch (type) {
@@ -1046,18 +1050,18 @@ module.exports = function(strapi) {
};
break;
case '_sort':
- result.key = `sort`;
+ result.key = 'sort';
result.value = {
key,
order: value.toUpperCase()
};
break;
case '_start':
- result.key = `start`;
+ result.key = 'start';
result.value = parseFloat(value);
break;
case '_limit':
- result.key = `limit`;
+ result.key = 'limit';
result.value = parseFloat(value);
break;
case '_contains':
diff --git a/packages/strapi-hook-bookshelf/package.json b/packages/strapi-hook-bookshelf/package.json
index f7a76f0dbd..07156e5c76 100755
--- a/packages/strapi-hook-bookshelf/package.json
+++ b/packages/strapi-hook-bookshelf/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-hook-bookshelf",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Bookshelf hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -18,10 +18,10 @@
"dependencies": {
"bookshelf": "^0.12.1",
"inquirer": "^5.2.0",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"pluralize": "^6.0.0",
- "strapi-hook-knex": "3.0.0-alpha.13.0.1",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-hook-knex": "3.0.0-alpha.13.1",
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"strapi": {
"dependencies": [
@@ -55,4 +55,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-hook-ejs/package.json b/packages/strapi-hook-ejs/package.json
index df594d486b..6c38f3bf9a 100755
--- a/packages/strapi-hook-ejs/package.json
+++ b/packages/strapi-hook-ejs/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-hook-ejs",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "EJS hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
-}
\ No newline at end of file
+}
diff --git a/packages/strapi-hook-knex/package.json b/packages/strapi-hook-knex/package.json
index c327e2f0bd..ae017125cf 100755
--- a/packages/strapi-hook-knex/package.json
+++ b/packages/strapi-hook-knex/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-hook-knex",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Knex hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -17,7 +17,7 @@
"main": "./lib",
"dependencies": {
"knex": "^0.13.0",
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"author": {
"email": "hi@strapi.io",
diff --git a/packages/strapi-hook-mongoose/package.json b/packages/strapi-hook-mongoose/package.json
index e6855a3f8d..c36a6b86c4 100755
--- a/packages/strapi-hook-mongoose/package.json
+++ b/packages/strapi-hook-mongoose/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-hook-mongoose",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Mongoose hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -15,11 +15,11 @@
},
"main": "./lib",
"dependencies": {
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"mongoose": "^5.0.16",
"mongoose-float": "^1.0.2",
"pluralize": "^6.0.0",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"email": "hi@strapi.io",
diff --git a/packages/strapi-hook-redis/package.json b/packages/strapi-hook-redis/package.json
index dc332efa68..717c607002 100755
--- a/packages/strapi-hook-redis/package.json
+++ b/packages/strapi-hook-redis/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-hook-redis",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Redis hook for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -16,9 +16,9 @@
"main": "./lib",
"dependencies": {
"ioredis": "^3.1.2",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"stack-trace": "0.0.10",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"email": "hi@strapi.io",
diff --git a/packages/strapi-lint/package.json b/packages/strapi-lint/package.json
index 2eb9b99121..544762ef2e 100644
--- a/packages/strapi-lint/package.json
+++ b/packages/strapi-lint/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-lint",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Strapi eslint and prettier configurations",
"directories": {
"lib": "lib"
diff --git a/packages/strapi-middleware-views/package.json b/packages/strapi-middleware-views/package.json
index 7021e73eab..6bef9b55e6 100755
--- a/packages/strapi-middleware-views/package.json
+++ b/packages/strapi-middleware-views/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-middleware-views",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Views middleware to enable server-side rendering for the Strapi framework",
"homepage": "http://strapi.io",
"keywords": [
@@ -17,7 +17,7 @@
"dependencies": {
"consolidate": "^0.14.5",
"koa-views": "^6.1.1",
- "lodash": "^4.17.4"
+ "lodash": "^4.17.5"
},
"author": {
"email": "hi@strapi.io",
diff --git a/packages/strapi-plugin-content-manager/admin/src/translations/de.json b/packages/strapi-plugin-content-manager/admin/src/translations/de.json
index c771c16643..48e0430f9f 100644
--- a/packages/strapi-plugin-content-manager/admin/src/translations/de.json
+++ b/packages/strapi-plugin-content-manager/admin/src/translations/de.json
@@ -1,6 +1,6 @@
{
- "plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
- "plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
+ "plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
+ "plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
"containers.Home.pluginHeaderTitle": "Inhalts-Manager",
"containers.Home.introduction": "Um deine Einträge zu verwalten, klicke auf den entsprechenden Link im Menü links. Dieses Plugin ist noch in aktiver Entwicklung und seine Einstellungen können nicht optimal angepasst werden.",
@@ -24,7 +24,7 @@
"containers.SettingsPage.Block.generalSettings.description": "Konfiguriere die Standardoptionen für deine Inhaltstypen.",
"containers.SettingsPage.Block.generalSettings.title" : "Allgemeines",
"containers.SettingsPage.Block.contentType.title": "Inhaltstypen",
- "containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen",
+ "containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen.",
"containers.SettingsPage.pluginHeaderDescription": "Konfigurieren Sie die Standardeinstellungen für alle Ihre Inhaltstypen.",
"components.AddFilterCTA.add": "Filter",
diff --git a/packages/strapi-plugin-content-manager/package.json b/packages/strapi-plugin-content-manager/package.json
index 6689bb8c02..c796abcee5 100755
--- a/packages/strapi-plugin-content-manager/package.json
+++ b/packages/strapi-plugin-content-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-manager",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "A powerful UI to easily manage your data.",
"strapi": {
"name": "Content Manager",
@@ -29,7 +29,7 @@
"react-select": "^1.2.1",
"react-sortable-hoc": "^0.8.3",
"showdown": "^1.8.6",
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
index c0513dfa95..390b17bf66 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
@@ -514,12 +514,9 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
}
renderModalBodyChooseAttributes = () => {
- const attributesDisplay = forms.attributesDisplay.items;
-
- // Don't display the media field if the upload plugin isn't installed
- if (!has(this.context.plugins.toJS(), 'upload')) {
- attributesDisplay.splice(8, 1);
- }
+ const attributesDisplay = has(this.context.plugins.toJS(), 'upload')
+ ? forms.attributesDisplay.items
+ : forms.attributesDisplay.items.filter(obj => obj.type !== 'media'); // Don't display the media field if the upload plugin isn't installed
return (
map(attributesDisplay, (attribute, key) => (
diff --git a/packages/strapi-plugin-content-type-builder/package.json b/packages/strapi-plugin-content-type-builder/package.json
index 727a8d695c..fe8ecbdfa6 100755
--- a/packages/strapi-plugin-content-type-builder/package.json
+++ b/packages/strapi-plugin-content-type-builder/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-content-type-builder",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Strapi plugin to create content type (API).",
"strapi": {
"name": "Content Type Builder",
@@ -23,11 +23,11 @@
},
"dependencies": {
"pluralize": "^7.0.0",
- "strapi-generate": "3.0.0-alpha.13.0.1",
- "strapi-generate-api": "3.0.0-alpha.13.0.1"
+ "strapi-generate": "3.0.0-alpha.13.1",
+ "strapi-generate-api": "3.0.0-alpha.13.1"
},
"devDependencies": {
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-plugin-email/package.json b/packages/strapi-plugin-email/package.json
index 20cab4dc6d..0bc639c496 100644
--- a/packages/strapi-plugin-email/package.json
+++ b/packages/strapi-plugin-email/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-email",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Email",
@@ -22,11 +22,11 @@
"prepublishOnly": "IS_MONOREPO=true npm run build"
},
"dependencies": {
- "strapi-email-sendmail": "3.0.0-alpha.13.0.1"
+ "strapi-email-sendmail": "3.0.0-alpha.13.1"
},
"devDependencies": {
"react-copy-to-clipboard": "5.0.1",
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-plugin-graphql/package.json b/packages/strapi-plugin-graphql/package.json
index 482d315d9f..67b9741144 100644
--- a/packages/strapi-plugin-graphql/package.json
+++ b/packages/strapi-plugin-graphql/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-graphql",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "This is the description of the plugin.",
"strapi": {
"name": "graphql",
@@ -30,7 +30,7 @@
"graphql-type-json": "^0.2.1",
"graphql-type-datetime": "^0.2.2",
"pluralize": "^7.0.0",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"name": "A Strapi developer",
diff --git a/packages/strapi-plugin-graphql/services/GraphQL.js b/packages/strapi-plugin-graphql/services/GraphQL.js
index eb911fae2b..12444bf3d4 100644
--- a/packages/strapi-plugin-graphql/services/GraphQL.js
+++ b/packages/strapi-plugin-graphql/services/GraphQL.js
@@ -630,7 +630,8 @@ module.exports = {
};
if (association.type === 'model') {
- params.id = obj[association.alias];
+ const rel = obj[association.alias];
+ params.id = typeof rel === 'object' && 'id' in rel ? rel.id : rel;
} else {
// Get refering model.
const ref = association.plugin ?
diff --git a/packages/strapi-plugin-settings-manager/package.json b/packages/strapi-plugin-settings-manager/package.json
index 33763835d5..c5f3899e38 100755
--- a/packages/strapi-plugin-settings-manager/package.json
+++ b/packages/strapi-plugin-settings-manager/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-settings-manager",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Strapi plugin to manage settings.",
"strapi": {
"name": "Settings Manager",
@@ -25,7 +25,7 @@
"devDependencies": {
"flag-icon-css": "^2.8.0",
"react-select": "^1.0.0-rc.5",
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-plugin-upload/admin/src/translations/de.json b/packages/strapi-plugin-upload/admin/src/translations/de.json
index e0b03b6caa..75c6e44d12 100644
--- a/packages/strapi-plugin-upload/admin/src/translations/de.json
+++ b/packages/strapi-plugin-upload/admin/src/translations/de.json
@@ -13,8 +13,8 @@
"EntriesNumber.number": "{number} Datei gefunden",
"EntriesNumber.number.plural": "{number} Dateien gefunden",
- "HomePage.title": "Hochladen",
- "HomePage.description": "Übersicht über alle hochgeladenen Dateien",
+ "HomePage.title": "Dateien hochladen",
+ "HomePage.description": "Übersicht über alle hochgeladenen Dateien.",
"HomePage.InputSearch.placeholder": "Suche nach einer Datei...",
"Li.linkCopied": "Link in die Zwischenablage kopiert",
diff --git a/packages/strapi-plugin-upload/package.json b/packages/strapi-plugin-upload/package.json
index 46c67b8057..7719cf62a8 100644
--- a/packages/strapi-plugin-upload/package.json
+++ b/packages/strapi-plugin-upload/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-upload",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "This is the description of the plugin.",
"strapi": {
"name": "Files Upload",
@@ -23,12 +23,12 @@
},
"dependencies": {
"react-copy-to-clipboard": "^5.0.1",
- "strapi-upload-local": "3.0.0-alpha.13.0.1",
+ "strapi-upload-local": "3.0.0-alpha.13.1",
"stream-to-array": "^2.3.0",
"uuid": "^3.2.1"
},
"devDependencies": {
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "A Strapi developer",
diff --git a/packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js b/packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js
index 6dc4c61617..8a981114a7 100644
--- a/packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js
+++ b/packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js
@@ -51,6 +51,8 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
return `${strapi.backendURL}/connect/google/callback`;
case 'github':
return get(this.props.values, 'redirect_uri', '');
+ case 'microsoft':
+ return `${strapi.backendURL}/connect/microsoft/callback`;
default: {
const value = get(this.props.values, 'callback', '');
diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
index 5c3d751d39..b9e70f52be 100644
--- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
+++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/actions.js
@@ -60,7 +60,7 @@ export function setForm(formType, email) {
password: '',
confirmPassword: '',
email: '',
- news: true,
+ news: false,
};
break;
case 'register-success':
diff --git a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
index 075de9f189..08a23dbdc2 100644
--- a/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/containers/AuthPage/form.json
@@ -80,7 +80,7 @@
},
"name": "news",
"type": "checkbox",
- "value": true
+ "value": false
}
],
"register-success": [
diff --git a/packages/strapi-plugin-users-permissions/admin/src/translations/de.json b/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
index 60ed4e4b33..4e304d04a4 100755
--- a/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/translations/de.json
@@ -89,8 +89,8 @@
"HeaderNav.link.providers": "Methoden",
"HeaderNav.link.roles": "Rollen",
- "HomePage.header.title": "Benutzer & Befugnisse",
- "HomePage.header.description": "Lege Rollen und deren Befugnisse fest",
+ "HomePage.header.title": "Benutzer & Berechtigungen",
+ "HomePage.header.description": "Lege Rollen und deren Berechtigungen fest.",
"InputSearch.placeholder": "Suche nach einem Benutzer",
diff --git a/packages/strapi-plugin-users-permissions/admin/src/translations/en.json b/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
index f9878a46be..e2b42f95f4 100755
--- a/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
+++ b/packages/strapi-plugin-users-permissions/admin/src/translations/en.json
@@ -43,8 +43,10 @@
"Auth.form.error.code.provide": "Incorrect code provided.",
"Auth.form.error.password.matching": "Passwords do not match.",
"Auth.form.error.params.provide": "Incorrect params provided.",
- "Auth.form.error.username.taken": "Username is already taken",
- "Auth.form.error.email.taken": "Email is already taken",
+ "Auth.form.error.username.taken": "Username is already taken.",
+ "Auth.form.error.email.taken": "Email is already taken.",
+ "Auth.form.error.blocked": "Your account has been blocked by the administrator.",
+ "Auth.form.error.ratelimit": "Too many attempts, please try again in a minute.",
"Auth.link.forgot-password": "Forgot your password?",
"Auth.link.ready": "Ready to sign in?",
@@ -167,6 +169,7 @@
"PopUpForm.Providers.facebook.providerConfig.redirectURL": "The redirect URL to add in your Facebook application configurations",
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
+ "PopUpForm.Providers.microsoft.providerConfig.redirectURL": "The redirect URL to add in your Microsoft application configurations",
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
"PopUpForm.Providers.twitter.providerConfig.redirectURL": "The redirect URL to add in your Twitter application configurations",
diff --git a/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js b/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js
index b4fbbae6f1..e8e034196c 100644
--- a/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js
+++ b/packages/strapi-plugin-users-permissions/config/functions/bootstrap.js
@@ -77,6 +77,14 @@ module.exports = async cb => {
'user:email'
]
},
+ microsoft: {
+ enabled: false,
+ icon: 'windows',
+ key: '',
+ secret: '',
+ callback: '/auth/microsoft/callback',
+ scope: ['user.read']
+ },
twitter: {
enabled: false,
icon: 'twitter',
diff --git a/packages/strapi-plugin-users-permissions/config/policies/permissions.js b/packages/strapi-plugin-users-permissions/config/policies/permissions.js
index 3407b5ee41..230e6ccc74 100644
--- a/packages/strapi-plugin-users-permissions/config/policies/permissions.js
+++ b/packages/strapi-plugin-users-permissions/config/policies/permissions.js
@@ -23,6 +23,10 @@ module.exports = async (ctx, next) => {
if (role.type === 'root') {
return await next();
}
+
+ if (ctx.state.user.blocked === true) {
+ return ctx.unauthorized(`Your account has been blocked by the administrator.`);
+ }
}
// Retrieve `public` role.
if (!role) {
@@ -43,7 +47,7 @@ module.exports = async (ctx, next) => {
return ctx.request.graphql = strapi.errors.forbidden();
}
- ctx.forbidden();
+ return ctx.forbidden();
}
// Execute the policies.
diff --git a/packages/strapi-plugin-users-permissions/config/policies/rateLimit.js b/packages/strapi-plugin-users-permissions/config/policies/rateLimit.js
new file mode 100644
index 0000000000..e5267d2c69
--- /dev/null
+++ b/packages/strapi-plugin-users-permissions/config/policies/rateLimit.js
@@ -0,0 +1,12 @@
+const RateLimit = require('koa2-ratelimit').RateLimit;
+
+module.exports = async (ctx, next) => {
+ const message = ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.ratelimit' }] }] : 'Too many attempts, please try again in a minute.';
+
+ return RateLimit.middleware(Object.assign({}, {
+ interval: 1*60*1000,
+ max: 5,
+ prefixKey: `${ctx.request.url}:${ctx.request.ip}`,
+ message
+ }, strapi.plugins['users-permissions'].config.ratelimit))(ctx, next);
+};
diff --git a/packages/strapi-plugin-users-permissions/config/request.json b/packages/strapi-plugin-users-permissions/config/request.json
new file mode 100644
index 0000000000..7a74471551
--- /dev/null
+++ b/packages/strapi-plugin-users-permissions/config/request.json
@@ -0,0 +1,6 @@
+{
+ "ratelimit": {
+ "interval": 60000,
+ "max": 10
+ }
+}
diff --git a/packages/strapi-plugin-users-permissions/config/routes.json b/packages/strapi-plugin-users-permissions/config/routes.json
index 5d43993b0d..3e9981be23 100644
--- a/packages/strapi-plugin-users-permissions/config/routes.json
+++ b/packages/strapi-plugin-users-permissions/config/routes.json
@@ -153,7 +153,7 @@
"path": "/connect/*",
"handler": "Auth.connect",
"config": {
- "policies": [],
+ "policies": ["plugins.users-permissions.ratelimit"],
"prefix": ""
}
},
@@ -162,7 +162,7 @@
"path": "/auth/local",
"handler": "Auth.callback",
"config": {
- "policies": [],
+ "policies": ["plugins.users-permissions.ratelimit"],
"prefix": ""
}
},
@@ -171,7 +171,7 @@
"path": "/auth/local/register",
"handler": "Auth.register",
"config": {
- "policies": [],
+ "policies": ["plugins.users-permissions.ratelimit"],
"prefix": ""
}
},
@@ -189,7 +189,7 @@
"path": "/auth/forgot-password",
"handler": "Auth.forgotPassword",
"config": {
- "policies": [],
+ "policies": ["plugins.users-permissions.ratelimit"],
"prefix": ""
}
},
@@ -198,7 +198,7 @@
"path": "/auth/reset-password",
"handler": "Auth.changePassword",
"config": {
- "policies": [],
+ "policies": ["plugins.users-permissions.ratelimit"],
"prefix": ""
}
},
diff --git a/packages/strapi-plugin-users-permissions/controllers/Auth.js b/packages/strapi-plugin-users-permissions/controllers/Auth.js
index a97a9df50d..1744e6d78e 100644
--- a/packages/strapi-plugin-users-permissions/controllers/Auth.js
+++ b/packages/strapi-plugin-users-permissions/controllers/Auth.js
@@ -52,6 +52,10 @@ module.exports = {
// Check if the user exists.
const user = await strapi.query('user', 'users-permissions').findOne(query, ['role']);
+ if (user.blocked === true) {
+ return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.');
+ }
+
if (!user) {
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.');
}
diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json
index 99479b1cba..bc588c5255 100644
--- a/packages/strapi-plugin-users-permissions/models/User.settings.json
+++ b/packages/strapi-plugin-users-permissions/models/User.settings.json
@@ -33,6 +33,11 @@
"configurable": false,
"private": true
},
+ "blocked": {
+ "type": "boolean",
+ "default": false,
+ "configurable": false
+ },
"role": {
"model": "role",
"via": "users",
@@ -40,4 +45,4 @@
"configurable": false
}
}
-}
+}
\ No newline at end of file
diff --git a/packages/strapi-plugin-users-permissions/package.json b/packages/strapi-plugin-users-permissions/package.json
index 49a6cc2b7e..9b3116a73a 100644
--- a/packages/strapi-plugin-users-permissions/package.json
+++ b/packages/strapi-plugin-users-permissions/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-plugin-users-permissions",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Protect your API with a full-authentication process based on JWT",
"strapi": {
"name": "Roles & Permissions",
@@ -26,12 +26,13 @@
"grant-koa": "^3.8.1",
"jsonwebtoken": "^8.1.0",
"koa": "^2.1.0",
+ "koa2-ratelimit": "^0.6.1",
"purest": "^2.0.1",
"request": "^2.83.0",
"uuid": "^3.1.0"
},
"devDependencies": {
- "strapi-helper-plugin": "3.0.0-alpha.13.0.1"
+ "strapi-helper-plugin": "3.0.0-alpha.13.1"
},
"author": {
"name": "Strapi team",
diff --git a/packages/strapi-plugin-users-permissions/services/Providers.js b/packages/strapi-plugin-users-permissions/services/Providers.js
index da8f651186..e278a1eadf 100644
--- a/packages/strapi-plugin-users-permissions/services/Providers.js
+++ b/packages/strapi-plugin-users-permissions/services/Providers.js
@@ -208,6 +208,40 @@ const getProfile = async (provider, query, callback) => {
});
break;
}
+ case 'microsoft': {
+ const microsoft = new Purest({
+ provider: 'microsoft',
+ config:{
+ 'microsoft': {
+ 'https://graph.microsoft.com': {
+ '__domain': {
+ 'auth': {
+ 'auth': {'bearer': '[0]'}
+ }
+ },
+ '[version]/{endpoint}': {
+ '__path': {
+ 'alias': '__default',
+ 'version': 'v1.0'
+ }
+ }
+ }
+ }
+ }
+ });
+
+ microsoft.query().get('me').auth(access_token).request((err, res, body) => {
+ if (err) {
+ callback(err);
+ } else {
+ callback(null, {
+ username: body.userPrincipalName,
+ email: body.userPrincipalName
+ });
+ }
+ });
+ break;
+ }
case 'twitter': {
const twitter = new Purest({
provider: 'twitter',
diff --git a/packages/strapi-upload-aws-s3/package.json b/packages/strapi-upload-aws-s3/package.json
index 2888b061bf..9654f6663f 100644
--- a/packages/strapi-upload-aws-s3/package.json
+++ b/packages/strapi-upload-aws-s3/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-upload-aws-s3",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "AWS S3 provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-upload-cloudinary/package.json b/packages/strapi-upload-cloudinary/package.json
index 5c92874574..bc176a0c98 100644
--- a/packages/strapi-upload-cloudinary/package.json
+++ b/packages/strapi-upload-cloudinary/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-upload-cloudinary",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Cloudinary provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-upload-local/package.json b/packages/strapi-upload-local/package.json
index 979b53e868..78e988fd49 100644
--- a/packages/strapi-upload-local/package.json
+++ b/packages/strapi-upload-local/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-upload-local",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Local provider for strapi upload",
"homepage": "http://strapi.io",
"keywords": [
diff --git a/packages/strapi-upload-rackspace/package.json b/packages/strapi-upload-rackspace/package.json
index a0e60d2516..1a9bf3f374 100644
--- a/packages/strapi-upload-rackspace/package.json
+++ b/packages/strapi-upload-rackspace/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-upload-rackspace",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Rackspace provider for strapi upload",
"main": "./lib",
"scripts": {
diff --git a/packages/strapi-utils/lib/index.js b/packages/strapi-utils/lib/index.js
index ae57227e18..7c9ce99755 100755
--- a/packages/strapi-utils/lib/index.js
+++ b/packages/strapi-utils/lib/index.js
@@ -15,5 +15,6 @@ module.exports = {
models: require('./models'),
packageManager: require('./packageManager'),
policy: require('./policy'),
- regex: require('./regex')
+ regex: require('./regex'),
+ templateConfiguration: require('./templateConfiguration')
};
diff --git a/packages/strapi-utils/lib/templateConfiguration.js b/packages/strapi-utils/lib/templateConfiguration.js
new file mode 100644
index 0000000000..810a7352a8
--- /dev/null
+++ b/packages/strapi-utils/lib/templateConfiguration.js
@@ -0,0 +1,26 @@
+const { isString, isPlainObject } = require('lodash');
+
+const regex = /\$\{[^()]*\}/g;
+
+/**
+ * Allow dynamic config values through the native ES6 template string function.
+ */
+const templateConfiguration = (obj) => {
+ // Allow values which looks like such as an ES6 literal string without parenthesis inside (aka function call).
+ return Object.keys(obj).reduce((acc, key) => {
+ if (isPlainObject(obj[key]) && !isString(obj[key])) {
+ acc[key] = templateConfiguration(obj[key]);
+
+ } else if (isString(obj[key]) && obj[key].match(regex) !== null) {
+ // eslint-disable-next-line prefer-template
+ acc[key] = eval('`' + obj[key] + '`');
+
+ } else {
+ acc[key] = obj[key];
+ }
+
+ return acc;
+ }, {});
+};
+
+module.exports = templateConfiguration;
diff --git a/packages/strapi-utils/package.json b/packages/strapi-utils/package.json
index 0c4a7ef156..72d598a69a 100755
--- a/packages/strapi-utils/package.json
+++ b/packages/strapi-utils/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi-utils",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.1",
"description": "Shared utilities for the Strapi packages",
"homepage": "http://strapi.io",
"keywords": [
@@ -21,7 +21,7 @@
"commander": "^2.11.0",
"joi-json": "^2.0.1",
"knex": "^0.13.0",
- "lodash": "^4.17.4",
+ "lodash": "^4.17.5",
"pino": "^4.7.1",
"shelljs": "^0.7.7"
},
diff --git a/packages/strapi/lib/core/configurations.js b/packages/strapi/lib/core/configurations.js
index c011683707..8fa9da809b 100755
--- a/packages/strapi/lib/core/configurations.js
+++ b/packages/strapi/lib/core/configurations.js
@@ -3,7 +3,8 @@
// Dependencies.
const path = require('path');
const glob = require('glob');
-const { merge, setWith, get, upperFirst, isString, isEmpty, isObject, pullAll, defaults, isPlainObject, assign, clone, cloneDeep, camelCase } = require('lodash');
+const { merge, setWith, get, upperFirst, isEmpty, isObject, pullAll, defaults, assign, clone, cloneDeep, camelCase } = require('lodash');
+const { templateConfiguration } = require('strapi-utils');
const utils = require('../utils');
module.exports.nested = function() {
@@ -84,14 +85,14 @@ module.exports.app = async function() {
this.config.currentEnvironment = this.config.environments[this.config.environment] || {};
// Set current connections.
- this.config.connections = get(this.config.currentEnvironment, `database.connections`, {});
+ this.config.connections = get(this.config.currentEnvironment, 'database.connections', {});
if (get(this.config, 'language.enabled')) {
this.config.language.locales = Object.keys(get(strapi.config, 'locales', {}));
}
// Template literal string.
- this.config = templateConfigurations(this.config);
+ this.config = templateConfiguration(this.config);
// Initialize main router to use it in middlewares.
this.router = this.koaMiddlewares.routerJoi();
@@ -304,7 +305,7 @@ module.exports.app = async function() {
this.config.hook.settings = Object.keys(this.hook).reduce((acc, current) => {
// Try to find the settings in the current environment, then in the main configurations.
- const currentSettings = merge(get(cloneDeep(this.hook[current]), ['defaults', current], {}), flattenHooksConfig[current] || this.config.currentEnvironment[current] || this.config[current]);
+ const currentSettings = merge(get(cloneDeep(this.hook[current]), ['defaults', current], {}), flattenHooksConfig[current] || get(this.config.currentEnvironment, ['hook', current]) || get(this.config, ['hook', current]));
acc[current] = !isObject(currentSettings) ? {} : currentSettings;
if (!acc[current].hasOwnProperty('enabled')) {
@@ -359,24 +360,3 @@ const enableHookNestedDependencies = function (name, flattenHooksConfig, force =
}
}
};
-
-/**
- * Allow dynamic config values through
- * the native ES6 template string function.
- */
-const regex = /\$\{[^()]*\}/g;
-const templateConfigurations = function (obj) {
- // Allow values which looks like such as
- // an ES6 literal string without parenthesis inside (aka function call).
- return Object.keys(obj).reduce((acc, key) => {
- if (isPlainObject(obj[key]) && !isString(obj[key])) {
- acc[key] = templateConfigurations(obj[key]);
- } else if (isString(obj[key]) && obj[key].match(regex) !== null) {
- acc[key] = eval('`' + obj[key] + '`'); // eslint-disable-line prefer-template
- } else {
- acc[key] = obj[key];
- }
-
- return acc;
- }, {});
-};
diff --git a/packages/strapi/package.json b/packages/strapi/package.json
index 2d7645d505..4cec3003a7 100755
--- a/packages/strapi/package.json
+++ b/packages/strapi/package.json
@@ -1,6 +1,6 @@
{
"name": "strapi",
- "version": "3.0.0-alpha.13.0.1",
+ "version": "3.0.0-alpha.13.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.",
"homepage": "http://strapi.io",
"keywords": [
@@ -49,22 +49,22 @@
"koa-router-joi": "^1.0.1",
"koa-session": "^5.5.1",
"koa-static": "^4.0.1",
- "lodash": "^4.16.5",
+ "lodash": "^4.17.5",
"node-fetch": "^1.7.3",
"node-schedule": "^1.2.0",
"rimraf": "^2.6.2",
"semver": "^5.4.1",
"stack-trace": "0.0.10",
- "strapi-generate": "3.0.0-alpha.13.0.1",
- "strapi-generate-admin": "3.0.0-alpha.13.0.1",
- "strapi-generate-api": "3.0.0-alpha.13.0.1",
- "strapi-generate-controller": "3.0.0-alpha.13.0.1",
- "strapi-generate-model": "3.0.0-alpha.13.0.1",
- "strapi-generate-new": "3.0.0-alpha.13.0.1",
- "strapi-generate-plugin": "3.0.0-alpha.13.0.1",
- "strapi-generate-policy": "3.0.0-alpha.13.0.1",
- "strapi-generate-service": "3.0.0-alpha.13.0.1",
- "strapi-utils": "3.0.0-alpha.13.0.1"
+ "strapi-generate": "3.0.0-alpha.13.1",
+ "strapi-generate-admin": "3.0.0-alpha.13.1",
+ "strapi-generate-api": "3.0.0-alpha.13.1",
+ "strapi-generate-controller": "3.0.0-alpha.13.1",
+ "strapi-generate-model": "3.0.0-alpha.13.1",
+ "strapi-generate-new": "3.0.0-alpha.13.1",
+ "strapi-generate-plugin": "3.0.0-alpha.13.1",
+ "strapi-generate-policy": "3.0.0-alpha.13.1",
+ "strapi-generate-service": "3.0.0-alpha.13.1",
+ "strapi-utils": "3.0.0-alpha.13.1"
},
"author": {
"email": "hi@strapi.io",