Merge branch 'master' into rename-hook-middleware

This commit is contained in:
Jim LAURIE 2018-07-19 11:04:57 +02:00 committed by GitHub
commit 8a10225680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 13 deletions

View File

@ -27,7 +27,7 @@ To install a new provider run:
$ npm install strapi-email-sendgrid@alpha --save
```
We have two providers available `strapi-email-sendgrid` and `strapi-upload-mailgun`, use the alpha tag to install one of them. Then, visit `/admin/plugins/email/configurations/development` and configure the provider.
We have two providers available `strapi-email-sendgrid` and `strapi-upload-mailgun`, use the alpha tag to install one of them. Then, visit `/admin/plugins/email/configurations/development` on your web browser and configure the provider.
If you want to create your own, make sure the name starts with `strapi-email-` (duplicating an existing one will be easier to create), modify the `auth` config object and customize the `send` functions.

View File

@ -133,7 +133,7 @@ To install a new provider run:
$ npm install strapi-upload-aws-s3@alpha --save
```
We have two providers available `strapi-upload-aws-s3` and `strapi-upload-cloudinary`, use the alpha tag to install one of them. Then, visit `/admin/plugins/upload/configurations/development` and configure the provider.
We have two providers available `strapi-upload-aws-s3` and `strapi-upload-cloudinary`, use the alpha tag to install one of them. Then, visit `/admin/plugins/upload/configurations/development` on your web browser and configure the provider.
If you want to create your own, make sure the name starts with `strapi-upload-` (duplicating an existing one will be easier to create), modify the `auth` config object and customize the `upload` and `delete` functions.

View File

@ -11,15 +11,15 @@ import { GET_GA_STATUS, GET_LAYOUT } from './constants';
function* getGaStatus() {
try {
const [allowGa, strapiVersion, currentEnvironment] = yield [
const [{ allowGa }, { strapiVersion }, { currentEnvironment }] = yield [
call(request, '/admin/gaConfig', { method: 'GET' }),
call(request, '/admin/strapiVersion', { method: 'GET' }),
call(request, '/admin/currentEnvironment', { method: 'GET' }),
];
yield put(getCurrEnvSucceeded(currentEnvironment.currentEnvironment));
yield put(getCurrEnvSucceeded(currentEnvironment));
yield put(getGaStatusSucceeded(allowGa));
yield put(getStrapiVersionSucceeded(strapiVersion.strapiVersion));
yield put(getStrapiVersionSucceeded(strapiVersion));
} catch(err) {
strapi.notification.error('notification.error');
}

View File

@ -27,7 +27,8 @@
"graphql-depth-limit": "^1.1.0",
"graphql-playground-middleware-koa": "^1.6.1",
"graphql-tools": "^2.23.1",
"graphql-type-json": "^0.2.0",
"graphql-type-json": "^0.2.1",
"graphql-type-datetime": "^0.2.2",
"pluralize": "^7.0.0",
"strapi-utils": "3.0.0-alpha.12.7.1"
},

View File

@ -14,6 +14,7 @@ const pluralize = require('pluralize');
const graphql = require('graphql');
const { makeExecutableSchema } = require('graphql-tools');
const GraphQLJSON = require('graphql-type-json');
const GraphQLDateTime = require('graphql-type-datetime');
const policyUtils = require('strapi-utils').policy;
module.exports = {
@ -167,6 +168,12 @@ module.exports = {
case 'float':
type = 'Float';
break;
case 'time':
case 'date':
case 'datetime':
case 'timestamp':
type = 'DateTime';
break;
case 'enumeration':
type = this.convertEnumType(definition, modelName, attributeName);
break;
@ -450,8 +457,8 @@ module.exports = {
// Add timestamps attributes.
if (_.get(model, 'options.timestamps') === true) {
Object.assign(initialState, {
createdAt: 'String!',
updatedAt: 'String!'
createdAt: 'DateTime!',
updatedAt: 'DateTime!'
});
Object.assign(acc.resolver[globalId], {
@ -777,10 +784,11 @@ module.exports = {
addCustomScalar: (resolvers) => {
Object.assign(resolvers, {
JSON: GraphQLJSON
JSON: GraphQLJSON,
DateTime: GraphQLDateTime,
});
return 'scalar JSON';
return 'scalar JSON \n scalar DateTime';
},
/**

View File

@ -199,7 +199,11 @@ module.exports = {
},
updatePermissions: async function (cb) {
const actions = strapi.plugins['users-permissions'].config.actions || [];
// fetch all the current permissions from the database, and format them into an array of actions.
const databasePermissions = await strapi.query('permission', 'users-permissions').find();
const actions = databasePermissions
.map(permission => `${permission.type}.${permission.controller}.${permission.action}`);
// Aggregate first level actions.
const appActions = Object.keys(strapi.api || {}).reduce((acc, api) => {
@ -232,7 +236,7 @@ module.exports = {
// Merge array into one.
const currentActions = appActions.concat(pluginsActions);
// Count permissions available.
const permissions = await strapi.query('permission', 'users-permissions').count();
const permissions = databasePermissions.length;
// Compare to know if actions have been added or removed from controllers.
if (!_.isEqual(actions, currentActions) || permissions < 1) {