diff --git a/core/server/data/importer/importers/data/users.js b/core/server/data/importer/importers/data/users.js index 3f55f29921..58209a5344 100644 --- a/core/server/data/importer/importers/data/users.js +++ b/core/server/data/importer/importers/data/users.js @@ -30,7 +30,7 @@ class UsersImporter extends BaseImporter { beforeImport() { debug('beforeImport'); - let self = this, role; + let self = this, role, lookup = {}; // Remove legacy field language this.dataToImport = _.filter(this.dataToImport, function (data) { @@ -44,6 +44,19 @@ class UsersImporter extends BaseImporter { model.status = 'locked'; }); + // NOTE: sort out duplicated roles based on incremental id + _.each(this.roles_users, function (attachedRole) { + if (lookup.hasOwnProperty(attachedRole.user_id)) { + if (lookup[attachedRole.user_id].id < attachedRole.id) { + lookup[attachedRole.user_id] = attachedRole; + } + } else { + lookup[attachedRole.user_id] = attachedRole; + } + }); + + this.roles_users = _.toArray(lookup); + _.each(this.roles_users, function (attachedRole) { role = _.find(self.roles, function (role) { if (attachedRole.role_id === role.id) { diff --git a/core/test/integration/data/importer/importers/data_spec.js b/core/test/integration/data/importer/importers/data_spec.js index ab03f7c905..ca675351a5 100644 --- a/core/test/integration/data/importer/importers/data_spec.js +++ b/core/test/integration/data/importer/importers/data_spec.js @@ -1604,4 +1604,58 @@ describe('Import (new test structure)', function () { }); }); }); + + describe('lts: multiple roles attached', function () { + var exportData; + + before(function doImport(done) { + // initialise the blog with some data + testUtils.initFixtures('roles', 'owner', 'settings').then(function () { + return testUtils.fixtures.loadExportFixture('export-lts-multiple-roles', + {lts: true} + ); + }).then(function (exported) { + exportData = exported; + return dataImporter.doImport(exportData); + }).then(function () { + done(); + }).catch(done); + }); + + after(testUtils.teardown); + + it('takes the latest role attached', function (done) { + var fetchImported = Promise.join( + knex('users').select(), + knex('roles_users').select(), + knex('roles').select() + ); + + fetchImported + .then(function (importedData) { + should.exist(importedData); + importedData.length.should.equal(3); + + var users = importedData[0], + rolesUsers = importedData[1], + roles = importedData[2]; + + users.length.should.equal(4); + + // original owner, search the owner by slug + _.find(rolesUsers, {user_id: _.find(users, {slug: testUtils.DataGenerator.Content.users[0].slug}).id}).role_id.should.eql(_.find(roles, {name: 'Owner'}).id); + + // first imported user, which was the original owner, now administator + _.find(rolesUsers, {user_id: _.find(users, {slug: exportData.data.users[0].slug}).id}).role_id.should.eql(_.find(roles, {name: 'Administrator'}).id); + + // second imported users, which has two roles attached, but the last role is the owner role, now administraotr + _.find(rolesUsers, {user_id: _.find(users, {slug: exportData.data.users[1].slug}).id}).role_id.should.eql(_.find(roles, {name: 'Administrator'}).id); + + // second imported users, which has two roles attached, but the last role is the editor role + _.find(rolesUsers, {user_id: _.find(users, {slug: exportData.data.users[2].slug}).id}).role_id.should.eql(_.find(roles, {name: 'Editor'}).id); + + done(); + }).catch(done); + }); + }); }); diff --git a/core/test/utils/fixtures/export/lts/export-lts-multiple-roles.json b/core/test/utils/fixtures/export/lts/export-lts-multiple-roles.json new file mode 100644 index 0000000000..53eb7ee4ea --- /dev/null +++ b/core/test/utils/fixtures/export/lts/export-lts-multiple-roles.json @@ -0,0 +1,1584 @@ +{ + "meta": { + "exported_on": 1496145843289, + "version": "009" + }, + "data": { + "app_fields": [], + "app_settings": [], + "apps": [], + "permissions": [ + { + "id": 1, + "uuid": "35296344-9049-4f11-a8e8-649fb13ed144", + "name": "Export database", + "object_type": "db", + "action_type": "exportContent", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 2, + "uuid": "1cd39c03-79da-4330-8614-ca829916ef54", + "name": "Import database", + "object_type": "db", + "action_type": "importContent", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 3, + "uuid": "9fa6cef5-29e7-4844-9e63-d5d4e561ca81", + "name": "Delete all content", + "object_type": "db", + "action_type": "deleteAllContent", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 4, + "uuid": "1320f9a9-99d7-4fd0-b722-f979ac1735fb", + "name": "Send mail", + "object_type": "mail", + "action_type": "send", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 5, + "uuid": "e349a9b1-dd9f-4cb4-a8b6-c869c4109a89", + "name": "Browse notifications", + "object_type": "notification", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 6, + "uuid": "586874af-8930-49c5-8638-2186f76d703d", + "name": "Add notifications", + "object_type": "notification", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 7, + "uuid": "c8b07790-266d-47c5-9521-e3c433299e82", + "name": "Delete notifications", + "object_type": "notification", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 8, + "uuid": "00c4d69d-1930-4705-b23a-6d67df57d56e", + "name": "Browse posts", + "object_type": "post", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 9, + "uuid": "cdbc7bdc-4bba-4884-bb27-3ad04f12d6f5", + "name": "Read posts", + "object_type": "post", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 10, + "uuid": "6bd5b490-bbaa-4bbd-8d6f-7300c6ee6a5b", + "name": "Edit posts", + "object_type": "post", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 11, + "uuid": "9c7f6522-b776-4d0f-bf01-2a59daf01acb", + "name": "Add posts", + "object_type": "post", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 12, + "uuid": "b3f52b26-7844-4e07-8910-2cd0c9ea3810", + "name": "Delete posts", + "object_type": "post", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 13, + "uuid": "c2f8a326-17c0-4d1e-af5e-f3d37187f7d1", + "name": "Browse settings", + "object_type": "setting", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 14, + "uuid": "00d1a492-a687-40ff-8932-b5fe9cc8048f", + "name": "Read settings", + "object_type": "setting", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 15, + "uuid": "479bba86-aca2-4ebb-9c5f-c37b75e23d50", + "name": "Edit settings", + "object_type": "setting", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 16, + "uuid": "2992e2b2-8910-420f-90e7-94ab69604fd1", + "name": "Generate slugs", + "object_type": "slug", + "action_type": "generate", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 17, + "uuid": "7b3324dd-5e35-415c-bdae-89791a7c50b6", + "name": "Browse tags", + "object_type": "tag", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 18, + "uuid": "dd8d61a7-f9a3-45aa-8ddf-4453a5027a0e", + "name": "Read tags", + "object_type": "tag", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 19, + "uuid": "2f8503cd-d404-42d7-9d9a-1dbe8cbc0dc0", + "name": "Edit tags", + "object_type": "tag", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 20, + "uuid": "12711f8c-0fc0-423c-86cb-59e6ad4c0b0c", + "name": "Add tags", + "object_type": "tag", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 21, + "uuid": "3651cfc5-fbf9-4ffa-998a-9df9e1f41399", + "name": "Delete tags", + "object_type": "tag", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 22, + "uuid": "9518a65b-d43a-447e-a9c6-17af32138da2", + "name": "Browse themes", + "object_type": "theme", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 23, + "uuid": "fb5e7352-7721-46b8-8efe-6ae4abb40cfc", + "name": "Edit themes", + "object_type": "theme", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 24, + "uuid": "4a816eb9-f203-426a-a270-1a24ee39af05", + "name": "Upload themes", + "object_type": "theme", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 25, + "uuid": "3e3ed32c-347b-4d8c-a2b2-3ba088e5599a", + "name": "Download themes", + "object_type": "theme", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 26, + "uuid": "f0d163be-7ec7-4559-ba7e-f7b97c93660f", + "name": "Delete themes", + "object_type": "theme", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 27, + "uuid": "8edd0d96-8011-4cff-bce9-c2c6b1f9880b", + "name": "Browse users", + "object_type": "user", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 28, + "uuid": "2e2d8869-50a1-4a9e-bcf3-7921a1865587", + "name": "Read users", + "object_type": "user", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 29, + "uuid": "18b31de3-6a12-43c2-a5f3-0046990e9fca", + "name": "Edit users", + "object_type": "user", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 30, + "uuid": "e377efc7-d805-4d73-97c6-df53a9a9afc3", + "name": "Add users", + "object_type": "user", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 31, + "uuid": "847c0902-be4a-406a-82d4-6bf508b7dde3", + "name": "Delete users", + "object_type": "user", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 32, + "uuid": "6a8e07ad-be29-4f0d-9923-d41db96d65a4", + "name": "Assign a role", + "object_type": "role", + "action_type": "assign", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 33, + "uuid": "20cb925a-89a1-4e43-a4c0-ded660103c06", + "name": "Browse roles", + "object_type": "role", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 34, + "uuid": "afb80530-37f4-44ed-bd51-98cbb242cc01", + "name": "Browse clients", + "object_type": "client", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 35, + "uuid": "4c7c013f-5512-42a9-9b31-1da087492137", + "name": "Read clients", + "object_type": "client", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 36, + "uuid": "6d725bd7-fe6e-4ff6-97a9-215f4fb6c231", + "name": "Edit clients", + "object_type": "client", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 37, + "uuid": "41d808ae-2302-40f8-87f7-673c6c39d091", + "name": "Add clients", + "object_type": "client", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 38, + "uuid": "d231f1d9-f068-4951-9924-a596fffa37e4", + "name": "Delete clients", + "object_type": "client", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 39, + "uuid": "8a0a91bf-4059-47df-9113-3b61666c392d", + "name": "Browse subscribers", + "object_type": "subscriber", + "action_type": "browse", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 40, + "uuid": "88c96dd0-036a-4569-9047-d7abd4806d87", + "name": "Read subscribers", + "object_type": "subscriber", + "action_type": "read", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 41, + "uuid": "04bfa0d2-df4a-4f68-983d-48391d864fe1", + "name": "Edit subscribers", + "object_type": "subscriber", + "action_type": "edit", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 42, + "uuid": "d4bfaa9c-ba97-4c4e-92a2-f7d9707fbd65", + "name": "Add subscribers", + "object_type": "subscriber", + "action_type": "add", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + }, + { + "id": 43, + "uuid": "f02cd225-07dd-47cc-90eb-eac2f541bbc3", + "name": "Delete subscribers", + "object_type": "subscriber", + "action_type": "destroy", + "object_id": null, + "created_at": "2016-10-28T13:43:35.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:35.000Z", + "updated_by": 1 + } + ], + "permissions_apps": [], + "permissions_roles": [ + { + "id": 1, + "role_id": 1, + "permission_id": 1 + }, + { + "id": 2, + "role_id": 1, + "permission_id": 2 + }, + { + "id": 3, + "role_id": 1, + "permission_id": 3 + }, + { + "id": 4, + "role_id": 1, + "permission_id": 4 + }, + { + "id": 5, + "role_id": 1, + "permission_id": 5 + }, + { + "id": 6, + "role_id": 1, + "permission_id": 6 + }, + { + "id": 7, + "role_id": 1, + "permission_id": 7 + }, + { + "id": 8, + "role_id": 1, + "permission_id": 8 + }, + { + "id": 9, + "role_id": 1, + "permission_id": 9 + }, + { + "id": 10, + "role_id": 1, + "permission_id": 10 + }, + { + "id": 11, + "role_id": 1, + "permission_id": 11 + }, + { + "id": 12, + "role_id": 1, + "permission_id": 12 + }, + { + "id": 13, + "role_id": 1, + "permission_id": 13 + }, + { + "id": 14, + "role_id": 1, + "permission_id": 14 + }, + { + "id": 15, + "role_id": 1, + "permission_id": 15 + }, + { + "id": 16, + "role_id": 1, + "permission_id": 16 + }, + { + "id": 17, + "role_id": 1, + "permission_id": 17 + }, + { + "id": 18, + "role_id": 1, + "permission_id": 18 + }, + { + "id": 19, + "role_id": 1, + "permission_id": 19 + }, + { + "id": 20, + "role_id": 1, + "permission_id": 20 + }, + { + "id": 21, + "role_id": 1, + "permission_id": 21 + }, + { + "id": 22, + "role_id": 1, + "permission_id": 22 + }, + { + "id": 23, + "role_id": 1, + "permission_id": 23 + }, + { + "id": 24, + "role_id": 1, + "permission_id": 24 + }, + { + "id": 25, + "role_id": 1, + "permission_id": 25 + }, + { + "id": 26, + "role_id": 1, + "permission_id": 26 + }, + { + "id": 27, + "role_id": 1, + "permission_id": 27 + }, + { + "id": 28, + "role_id": 1, + "permission_id": 28 + }, + { + "id": 29, + "role_id": 1, + "permission_id": 29 + }, + { + "id": 30, + "role_id": 1, + "permission_id": 30 + }, + { + "id": 31, + "role_id": 1, + "permission_id": 31 + }, + { + "id": 32, + "role_id": 1, + "permission_id": 32 + }, + { + "id": 33, + "role_id": 1, + "permission_id": 33 + }, + { + "id": 34, + "role_id": 1, + "permission_id": 34 + }, + { + "id": 35, + "role_id": 1, + "permission_id": 35 + }, + { + "id": 36, + "role_id": 1, + "permission_id": 36 + }, + { + "id": 37, + "role_id": 1, + "permission_id": 37 + }, + { + "id": 38, + "role_id": 1, + "permission_id": 38 + }, + { + "id": 39, + "role_id": 1, + "permission_id": 39 + }, + { + "id": 40, + "role_id": 1, + "permission_id": 40 + }, + { + "id": 41, + "role_id": 1, + "permission_id": 41 + }, + { + "id": 42, + "role_id": 1, + "permission_id": 42 + }, + { + "id": 43, + "role_id": 1, + "permission_id": 43 + }, + { + "id": 44, + "role_id": 2, + "permission_id": 8 + }, + { + "id": 45, + "role_id": 2, + "permission_id": 9 + }, + { + "id": 46, + "role_id": 2, + "permission_id": 10 + }, + { + "id": 47, + "role_id": 2, + "permission_id": 11 + }, + { + "id": 48, + "role_id": 2, + "permission_id": 12 + }, + { + "id": 49, + "role_id": 2, + "permission_id": 13 + }, + { + "id": 50, + "role_id": 2, + "permission_id": 14 + }, + { + "id": 51, + "role_id": 2, + "permission_id": 16 + }, + { + "id": 52, + "role_id": 2, + "permission_id": 17 + }, + { + "id": 53, + "role_id": 2, + "permission_id": 18 + }, + { + "id": 54, + "role_id": 2, + "permission_id": 19 + }, + { + "id": 55, + "role_id": 2, + "permission_id": 20 + }, + { + "id": 56, + "role_id": 2, + "permission_id": 21 + }, + { + "id": 57, + "role_id": 2, + "permission_id": 27 + }, + { + "id": 58, + "role_id": 2, + "permission_id": 28 + }, + { + "id": 59, + "role_id": 2, + "permission_id": 29 + }, + { + "id": 60, + "role_id": 2, + "permission_id": 30 + }, + { + "id": 61, + "role_id": 2, + "permission_id": 31 + }, + { + "id": 62, + "role_id": 2, + "permission_id": 32 + }, + { + "id": 63, + "role_id": 2, + "permission_id": 33 + }, + { + "id": 64, + "role_id": 2, + "permission_id": 34 + }, + { + "id": 65, + "role_id": 2, + "permission_id": 35 + }, + { + "id": 66, + "role_id": 2, + "permission_id": 36 + }, + { + "id": 67, + "role_id": 2, + "permission_id": 37 + }, + { + "id": 68, + "role_id": 2, + "permission_id": 38 + }, + { + "id": 69, + "role_id": 2, + "permission_id": 42 + }, + { + "id": 70, + "role_id": 3, + "permission_id": 8 + }, + { + "id": 71, + "role_id": 3, + "permission_id": 9 + }, + { + "id": 72, + "role_id": 3, + "permission_id": 11 + }, + { + "id": 73, + "role_id": 3, + "permission_id": 13 + }, + { + "id": 74, + "role_id": 3, + "permission_id": 14 + }, + { + "id": 75, + "role_id": 3, + "permission_id": 16 + }, + { + "id": 76, + "role_id": 3, + "permission_id": 17 + }, + { + "id": 77, + "role_id": 3, + "permission_id": 18 + }, + { + "id": 78, + "role_id": 3, + "permission_id": 20 + }, + { + "id": 79, + "role_id": 3, + "permission_id": 27 + }, + { + "id": 80, + "role_id": 3, + "permission_id": 28 + }, + { + "id": 81, + "role_id": 3, + "permission_id": 33 + }, + { + "id": 82, + "role_id": 3, + "permission_id": 34 + }, + { + "id": 83, + "role_id": 3, + "permission_id": 35 + }, + { + "id": 84, + "role_id": 3, + "permission_id": 36 + }, + { + "id": 85, + "role_id": 3, + "permission_id": 37 + }, + { + "id": 86, + "role_id": 3, + "permission_id": 38 + }, + { + "id": 87, + "role_id": 3, + "permission_id": 42 + } + ], + "permissions_users": [], + "posts": [ + { + "id": 4751, + "uuid": "c2ef3b5e-4b48-496b-8a35-ecb04fb5f8a0", + "title": "Welcome to this test import. This post has a long title.", + "slug": "welcome-to-this-test-import-this-post-has-a-long-title", + "markdown": "Welcome to this test import. This post has a long title.", + "mobiledoc": null, + "html": "

Welcome to this test import. This post has a long title.

", + "amp": null, + "image": "/content/images/2017/05/post-image.jpg", + "featured": 0, + "page": 0, + "status": "draft", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "author_id": 1, + "created_at": "2017-05-20T08:42:02.000Z", + "created_by": 1, + "updated_at": "2017-05-20T12:01:52.000Z", + "updated_by": 1, + "published_at": null, + "published_by": null + }, + { + "id": 4752, + "uuid": "277bbc97-2470-484c-b979-45bce515de46", + "title": "About", + "slug": "about", + "markdown": "This is a draft static page", + "mobiledoc": null, + "html": "

This is a draft static page

", + "amp": null, + "image": null, + "featured": 0, + "page": 1, + "status": "draft", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "author_id": 1, + "created_at": "2017-05-21T10:39:50.000Z", + "created_by": 1, + "updated_at": "2017-05-21T10:40:50.000Z", + "updated_by": 1, + "published_at": null, + "published_by": null + }, + { + "id": 4753, + "uuid": "a8bf79a3-7252-4feb-ad81-d206fa802f9b", + "title": "Published post", + "slug": "published-post", + "markdown": "This is a published post", + "mobiledoc": null, + "html": "

This is a published post

", + "amp": null, + "image": null, + "featured": 0, + "page": 0, + "status": "draft", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "author_id": 1, + "created_at": "2017-05-22T10:40:27.000Z", + "created_by": 1, + "updated_at": "2017-05-22T10:40:37.000Z", + "updated_by": 1, + "published_at": null, + "published_by": null + }, + { + "id": 4754, + "uuid": "a6dbe1cb-affb-4d62-b69a-6244abf5681c", + "title": "Welcome", + "slug": "welcome", + "markdown": "This is a published static page", + "mobiledoc": null, + "html": "

This is a published static page

", + "amp": null, + "image": null, + "featured": 0, + "page": 0, + "status": "published", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "author_id": 1, + "created_at": "2017-05-23T10:40:59.000Z", + "created_by": 1, + "updated_at": "2017-05-23T10:41:09.000Z", + "updated_by": 1, + "published_at": "2017-05-23T10:41:09.000Z", + "published_by": 1 + }, + { + "id": 4755, + "uuid": "3be3404b-8474-4789-8c6e-48bbea11c509", + "title": "Scheduled post", + "slug": "scheduled-post", + "markdown": "This a post scheduled for publication", + "mobiledoc": null, + "html": "

This a post scheduled for publication

", + "amp": null, + "image": null, + "featured": 0, + "page": 0, + "status": "scheduled", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "author_id": 1, + "created_at": "2017-05-24T10:41:19.000Z", + "created_by": 1, + "updated_at": "2017-05-24T10:42:15.000Z", + "updated_by": 1, + "published_at": "2017-08-24T10:41:00.000Z", + "published_by": null + } + ], + "posts_tags": [ + { + "id": 3002, + "post_id": 4751, + "tag_id": 1029, + "sort_order": 0 + } + ], + "roles": [ + { + "id": 1, + "uuid": "57644e26-9a9b-46dd-8b4e-26d373699da1", + "name": "Administrator", + "description": "Administrators", + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 2, + "uuid": "faffb323-46b1-45c7-a204-b16b9cb67b4f", + "name": "Editor", + "description": "Editors", + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 3, + "uuid": "20d35c2f-29a1-4713-b885-b784c8941832", + "name": "Author", + "description": "Authors", + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + }, + { + "id": 4, + "uuid": "a064aaf1-ac17-402b-a0ce-a790836ac607", + "name": "Owner", + "description": "Blog Owner", + "created_at": "2016-10-28T13:43:34.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:34.000Z", + "updated_by": 1 + } + ], + "roles_users": [ + { + "id": 1, + "role_id": 4, + "user_id": 1 + }, + { + "id": 2, + "role_id": 3, + "user_id": 2 + }, + { + "id": 3, + "role_id": 4, + "user_id": 2 + }, + { + "id": 4, + "role_id": 3, + "user_id": 3 + }, + { + "id": 5, + "role_id": 2, + "user_id": 3 + } + ], + "settings": [ + { + "id": 1, + "uuid": "82a9a5bc-efe6-48df-bc65-86a12cc998ff", + "key": "databaseVersion", + "value": "009", + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 2, + "uuid": "ec04fd09-b3ec-4796-a808-746888b9d183", + "key": "dbHash", + "value": "0c664583-f1b5-42a3-829d-1ab234626b54", + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 3, + "uuid": "f72bcee1-75e4-475d-a5a2-91e11bb6f505", + "key": "nextUpdateCheck", + "value": null, + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 4, + "uuid": "99c53971-28cd-4609-afc6-def7cf6802f3", + "key": "displayUpdateNotification", + "value": null, + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 5, + "uuid": "39134372-0b97-4e00-aa57-2d3a4fd87229", + "key": "seenNotifications", + "value": "[]", + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 6, + "uuid": "df6fca03-3248-48c7-92ef-c1d808e6ffe3", + "key": "migrations", + "value": "{}", + "type": "core", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T13:43:36.000Z", + "updated_by": 1 + }, + { + "id": 7, + "uuid": "30ce73ad-a601-4ceb-9703-21af19f563bc", + "key": "title", + "value": "LTS blog", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 8, + "uuid": "c7167c6e-abfb-4977-bba4-00836a871f76", + "key": "description", + "value": "Just a blogging platform.", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 9, + "uuid": "83a78eec-1f12-4ef1-8e3e-83b95206f076", + "key": "logo", + "value": "/content/images/2017/05/bloglogo.jpeg", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 10, + "uuid": "2333af7a-ee4e-401b-9134-f3c62a770373", + "key": "cover", + "value": "/content/images/2017/05/blogcover.jpeg", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 11, + "uuid": "d7ecebc5-8513-4c04-bf45-ea8457d21c7a", + "key": "defaultLang", + "value": "en_US", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 12, + "uuid": "d0826db3-687d-4338-802f-f353de656490", + "key": "postsPerPage", + "value": "5", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 13, + "uuid": "e3628791-f446-49f6-9dc6-80b4198b2b44", + "key": "activeTimezone", + "value": "Etc/UTC", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 14, + "uuid": "d65fa4b9-b64b-43a6-b936-2c90346b4ed1", + "key": "forceI18n", + "value": "true", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 15, + "uuid": "c8a10432-9391-428f-8735-061ee3545f8b", + "key": "permalinks", + "value": "/:year/:month/:day/:slug/", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 16, + "uuid": "7f11112f-95b1-49aa-bdf6-9fb4ac65d074", + "key": "ghost_head", + "value": "", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 17, + "uuid": "cc5b524e-1186-4ff8-bd4b-fdfded4ba05b", + "key": "ghost_foot", + "value": "", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 18, + "uuid": "46ebfbf3-895e-4f7f-a98f-bb9c168bc10e", + "key": "facebook", + "value": "", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 19, + "uuid": "c9010813-f1db-4523-a6c0-282aa0d3d5f3", + "key": "twitter", + "value": "", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 20, + "uuid": "a1476e4c-f05f-48c1-80ea-35a242210db7", + "key": "labs", + "value": "{}", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 21, + "uuid": "dc6da094-2b49-4601-965f-a52bbf842b0d", + "key": "navigation", + "value": "[{\"label\":\"Home\",\"url\":\"/\"}]", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 22, + "uuid": "82669b03-9807-42a6-b6ff-08e19cab4c22", + "key": "slack", + "value": "[{\"url\":\"\"}]", + "type": "blog", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 23, + "uuid": "b94edd9a-6cbe-4498-98cc-920ba763b773", + "key": "activeApps", + "value": "[]", + "type": "app", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2016-10-28T14:15:49.000Z", + "updated_by": 1 + }, + { + "id": 24, + "uuid": "1a0f6186-b709-4c2f-a673-6f7531803af3", + "key": "installedApps", + "value": "[]", + "type": "app", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T11:36:59.000Z", + "updated_by": 1 + }, + { + "id": 25, + "uuid": "83730573-cc5a-4989-b3d3-df48aaf54396", + "key": "isPrivate", + "value": "true", + "type": "private", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 26, + "uuid": "2d364cdb-06c3-4760-bcdb-a81a6fbe6a41", + "key": "password", + "value": "privateBlogPassword", + "type": "private", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 27, + "uuid": "feceb99d-09f0-437c-ba5b-3e250d89d498", + "key": "activeTheme", + "value": "casper", + "type": "theme", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + }, + { + "id": 28, + "uuid": "bd24dc02-9705-48c2-babd-3f63a865b209", + "key": "amp", + "value": "true", + "type": "blog", + "created_at": "2017-01-15T13:49:03.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:03:55.000Z", + "updated_by": 1 + } + ], + "subscribers": [], + "tags": [ + { + "id": 1029, + "uuid": "1bbc4d06-5d6e-4960-85f7-2ca3b8f9406c", + "name": "tag1", + "slug": "tag1", + "description": null, + "image": "/content/images/2017/05/tagImage-1.jpeg", + "parent_id": null, + "visibility": "public", + "meta_title": null, + "meta_description": null, + "created_at": "2017-05-30T08:44:09.000Z", + "created_by": 36, + "updated_at": "2017-05-30T12:03:10.000Z", + "updated_by": 1 + } + ], + "users": [ + { + "id": 1, + "uuid": "1e2a7354-f580-4deb-9801-ca286628125a", + "name": "Joe Blogg's Brother", + "slug": "joe-bloggs-brother", + "password": "$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKABC", + "email": "jbloggsbrother@example.com", + "image": "/content/images/2017/05/authorlogo.jpeg", + "cover": "/content/images/2017/05/authorcover.jpeg", + "bio": "I'm Joe's brother, the good looking one!", + "website": "http://joebloggsbrother.com", + "location": null, + "facebook": null, + "twitter": null, + "accessibility": null, + "status": "active", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "tour": null, + "last_login": "2017-05-30T10:39:32.000Z", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:02:35.000Z", + "updated_by": 1 + }, + { + "id": 2, + "uuid": "1e2a7354-f580-4deb-9801-ca286628125b", + "name": "multiple roles", + "slug": "muiltple-roles", + "password": "$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKABC", + "email": "mr@example.com", + "image": "/content/images/2017/05/authorlogo.jpeg", + "cover": "/content/images/2017/05/authorcover.jpeg", + "bio": "I'm Joe's brother, the good looking one!", + "website": "http://joebloggsbrother.com", + "location": null, + "facebook": null, + "twitter": null, + "accessibility": null, + "status": "active", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "tour": null, + "last_login": "2017-05-30T10:39:32.000Z", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:02:35.000Z", + "updated_by": 1 + }, + { + "id": 3, + "uuid": "1e2a7354-f580-4deb-9801-ca286628125b", + "name": "multiple roles 2", + "slug": "muiltple-roles-2", + "password": "$2a$10$.pZeeBE0gHXd0PTnbT/ph.GEKgd0Wd3q2pWna3ynTGBkPKnGIKABC", + "email": "mr2@example.com", + "image": "/content/images/2017/05/authorlogo.jpeg", + "cover": "/content/images/2017/05/authorcover.jpeg", + "bio": "I'm Joe's brother, the good looking one!", + "website": "http://joebloggsbrother.com", + "location": null, + "facebook": null, + "twitter": null, + "accessibility": null, + "status": "active", + "language": "en_US", + "visibility": "public", + "meta_title": null, + "meta_description": null, + "tour": null, + "last_login": "2017-05-30T10:39:32.000Z", + "created_at": "2016-10-28T13:43:36.000Z", + "created_by": 1, + "updated_at": "2017-05-30T12:02:35.000Z", + "updated_by": 1 + } + ] + } +}