From ad2a455466ad9385131662ebd0ecab9bde71364e Mon Sep 17 00:00:00 2001 From: AdrianGunia Date: Sun, 28 Jan 2018 19:45:48 +0100 Subject: [PATCH 1/2] fix bug(save user via gui) --- .../controllers/ContentTypeBuilder.js | 3 +-- .../models/Role.settings.json | 5 ++--- .../models/User.settings.json | 11 +++++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js index 3e9ead917d..a7911b4d1e 100755 --- a/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js +++ b/packages/strapi-plugin-content-type-builder/controllers/ContentTypeBuilder.js @@ -90,10 +90,9 @@ module.exports = { if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]); if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]); if (strapi.models[_.toLower(name)] && name !== model) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.exist' }] }]); - if (!strapi.models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); + if (!strapi.models[_.toLower(model)] && plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]); if (!_.isNaN(parseFloat(name[0]))) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.name' }] }]); if (plugin && !strapi.plugins[_.toLower(plugin)]) return ctx.badRequest(null, [{ message: [{ id: 'request.error.plugin.name' }] }]); - if (plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ message: [{ id: 'request.error.model.unknow' }] }]); const [formatedAttributes, attributesErrors] = Service.formatAttributes(attributes, name.toLowerCase(), plugin); diff --git a/packages/strapi-plugin-users-permissions/models/Role.settings.json b/packages/strapi-plugin-users-permissions/models/Role.settings.json index cdb41d5235..66fa504376 100644 --- a/packages/strapi-plugin-users-permissions/models/Role.settings.json +++ b/packages/strapi-plugin-users-permissions/models/Role.settings.json @@ -23,8 +23,7 @@ "users": { "collection": "user", "via": "role", - "plugin": "users-permissions", - "configurable": false + "plugin": "users-permissions" }, "permissions": { "collection": "permission", @@ -33,4 +32,4 @@ "configurable": false } } -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json index e64b741cbb..a8829246ec 100644 --- a/packages/strapi-plugin-users-permissions/models/User.settings.json +++ b/packages/strapi-plugin-users-permissions/models/User.settings.json @@ -36,6 +36,13 @@ "via": "users", "plugin": "users-permissions", "configurable": false + }, + "ddddd": { + "type": "string" + }, + "mlkml": { + "type": "string" } - } -} + }, + "collectionName": "users-permissions_user" +} \ No newline at end of file From 84365091f63096afebc60730f7dde9dfc0b1b084 Mon Sep 17 00:00:00 2001 From: AdrianGunia Date: Sun, 28 Jan 2018 19:50:37 +0100 Subject: [PATCH 2/2] drop usless change --- .../models/Role.settings.json | 5 +++-- .../models/User.settings.json | 11 ++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/packages/strapi-plugin-users-permissions/models/Role.settings.json b/packages/strapi-plugin-users-permissions/models/Role.settings.json index 66fa504376..cdb41d5235 100644 --- a/packages/strapi-plugin-users-permissions/models/Role.settings.json +++ b/packages/strapi-plugin-users-permissions/models/Role.settings.json @@ -23,7 +23,8 @@ "users": { "collection": "user", "via": "role", - "plugin": "users-permissions" + "plugin": "users-permissions", + "configurable": false }, "permissions": { "collection": "permission", @@ -32,4 +33,4 @@ "configurable": false } } -} \ No newline at end of file +} diff --git a/packages/strapi-plugin-users-permissions/models/User.settings.json b/packages/strapi-plugin-users-permissions/models/User.settings.json index a8829246ec..e64b741cbb 100644 --- a/packages/strapi-plugin-users-permissions/models/User.settings.json +++ b/packages/strapi-plugin-users-permissions/models/User.settings.json @@ -36,13 +36,6 @@ "via": "users", "plugin": "users-permissions", "configurable": false - }, - "ddddd": { - "type": "string" - }, - "mlkml": { - "type": "string" } - }, - "collectionName": "users-permissions_user" -} \ No newline at end of file + } +}