diff --git a/client/core/src/config.js b/client/core/src/config.js index dd11ccbfc..5b627b054 100644 --- a/client/core/src/config.js +++ b/client/core/src/config.js @@ -3,7 +3,7 @@ import {module} from './module'; config.$inject = ['$translateProvider', '$translatePartialLoaderProvider']; export function config($translateProvider, $translatePartialLoaderProvider) { $translatePartialLoaderProvider.addPart('core'); - + let conf = {urlTemplate: '/static/locale/{part}/{lang}.json'}; let langs = ['en', 'es']; let localLangs = { diff --git a/client/salix/index.js b/client/salix/index.js index cb9a3f178..86286a300 100644 --- a/client/salix/index.js +++ b/client/salix/index.js @@ -1 +1 @@ -export * from './src/app' +export * from './src/app'; diff --git a/client/salix/src/bootstrap.js b/client/salix/src/bootstrap.js index 183515c91..119bbd5f4 100644 --- a/client/salix/src/bootstrap.js +++ b/client/salix/src/bootstrap.js @@ -2,8 +2,8 @@ import {ng} from 'vendor'; import {NAME as SALIX} from './module'; export const bootstrap = () => { - const selector = 'selector' - + const selector = 'selector'; + let _script = document.currentScript || (() => { let scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; diff --git a/client/salix/src/configroutes.js b/client/salix/src/configroutes.js index de7f5c7c6..795ef0aba 100644 --- a/client/salix/src/configroutes.js +++ b/client/salix/src/configroutes.js @@ -16,8 +16,8 @@ function config($stateProvider, $urlRouterProvider) { splitingRegister.registerGraph(deps); function getParams(route) { - let params = '', - temporalParams = []; + let params = ''; + let temporalParams = []; if (!route.params) { return params; diff --git a/client/salix/src/run.js b/client/salix/src/run.js index 909e8715e..290b62683 100644 --- a/client/salix/src/run.js +++ b/client/salix/src/run.js @@ -3,7 +3,7 @@ import {module} from './module'; const HOOK_ABORTED_TRANSITION = 3; run.$inject = ['$rootScope', '$state']; -export function run ($rootScope, $state) { +export function run($rootScope, $state) { $rootScope.$on('$viewContentLoaded', () => {}); window.myAppErrorLog = []; $state.defaultErrorHandler(function(error) { diff --git a/db.json b/db.json index c15712c4f..6f2204e25 100644 --- a/db.json +++ b/db.json @@ -1,7 +1,7 @@ { "ids": { "User": 2, - "AccessToken": 2, + "AccessToken": 4, "Client": 23, "PaymentMethod": 4, "SalesPerson": 11, @@ -10,14 +10,16 @@ "Province": 44, "Agency": 4, "Account": 32, - "ClientObservation": 1272 + "ClientObservation": 1272, + "ACL": 2 }, "models": { "User": { "1": "{\"password\":\"$2a$10$af5k9noiG1GqxxTE9tyO4OJg/Bx1BZYm3d0sRf1gNlC57k9AK5ApK\",\"email\":\"admin@admin.com\",\"id\":1}" }, "AccessToken": { - "NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue": "{\"id\":\"NUf7o684TmteojFX9KmPOpaDLthjP5Def4wuy83Yjv31i43HHiWgV3FyBp6pX8Ue\",\"ttl\":1209600,\"created\":\"2016-11-21T11:06:11.113Z\",\"userId\":1}" + "0uzVYECqoa1aMAp4J74rsIIrmYqJtElgcDMOFL3kIaCrL09ljpurb1ad0kx7AjAr": "{\"id\":\"0uzVYECqoa1aMAp4J74rsIIrmYqJtElgcDMOFL3kIaCrL09ljpurb1ad0kx7AjAr\",\"ttl\":1209600,\"created\":\"2017-03-07T17:48:58.156Z\",\"userId\":1}", + "8KixErWXUSEU78jQp96OIRPAs8i9rWUITkbjTyUXaJfGiCQddh3lGYnfq1TKNYRh": "{\"id\":\"8KixErWXUSEU78jQp96OIRPAs8i9rWUITkbjTyUXaJfGiCQddh3lGYnfq1TKNYRh\",\"ttl\":1209600,\"created\":\"2017-03-14T08:07:52.112Z\",\"userId\":1}" }, "Client": { "12": "{\"name\":\"Verdnatura\",\"id\":12,\"fi\":\"B97367486\",\"salesPerson\":8,\"telefono\":\"963242100\",\"socialName\":\"Verdnatura Levante SL\",\"active\":true,\"user\":\"verdnatura\",\"fax\":\"963242100\",\"phone\":\"963242101\",\"email\":\"informatica@verdnatura.es\",\"surcharge\":true,\"cyc\":321,\"credit\":1000,\"iban\":\"456\",\"street\":\"Avenida Espioca, 100\",\"city\":\"Silla\",\"postcode\":\"1234567\",\"mobile\":\"654654654\",\"dueDay\":321,\"gestdoc\":23452343,\"province\":3,\"country\":1,\"modify\":\"BasicData\",\"navigate\":true,\"payMethod\":\"1\",\"coreVnh\":true,\"coreVnl\":true,\"invoiceByEmail\":true}", @@ -141,6 +143,7 @@ "1269": "{\"text\":\"yyyyy\",\"creationDate\":\"2017-02-07T09:11:11.000Z\",\"id\":1269}", "1270": "{\"text\":\"7777\",\"creationDate\":\"2017-02-07T09:12:13.000Z\",\"id\":1270}", "1271": "{\"text\":\"dddd\",\"creationDate\":\"2017-02-07T09:12:39.000Z\",\"id\":1271}" - } + }, + "ACL": {} } } \ No newline at end of file diff --git a/services/client/common/models/account.json b/services/client/common/models/Account.json similarity index 65% rename from services/client/common/models/account.json rename to services/client/common/models/Account.json index c228640a4..c43954727 100644 --- a/services/client/common/models/account.json +++ b/services/client/common/models/Account.json @@ -15,8 +15,12 @@ "type": "boolean" } }, - "validations": [], - "relations": {}, - "acls": [], - "methods": {} + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json index e0335f749..8b60a44b2 100644 --- a/services/client/common/models/Address.json +++ b/services/client/common/models/Address.json @@ -36,6 +36,7 @@ "type": "boolean" } }, + "validations": [], "relations": { "country": { "type": "belongsTo", @@ -47,5 +48,13 @@ "model": "Client", "foreignKey": "id" } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/common/models/Agency.json b/services/client/common/models/Agency.json index 431a07ce2..d6bf75e1a 100644 --- a/services/client/common/models/Agency.json +++ b/services/client/common/models/Agency.json @@ -12,5 +12,13 @@ "type": "string", "required": true } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 0e8e2caac..55ce4d070 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -1,6 +1,13 @@ { "name": "Client", "base": "MyModel", + "scopes": { + "test": { + "where": { + "name": "Verdnatura" + } + } + }, "validateUpsert": true, "properties": { "id": { @@ -80,6 +87,7 @@ "description": "Send invoices by email" } }, + "validations": [], "relations": { "account": { "type": "hasOne", @@ -92,12 +100,13 @@ "foreignKey": "client" } }, - "scopes": { - "test": { - "where": {"name": "Verdnatura"} + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" } - }, - "validations": [], - "acls": [], + ], "methods": {} } diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index 09d9cbc32..16472c541 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -29,5 +29,13 @@ "type": "belongsTo", "foreignKey": "id" } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json index a0f425f55..3df2ccb7a 100644 --- a/services/client/common/models/Country.json +++ b/services/client/common/models/Country.json @@ -12,5 +12,13 @@ "type": "string", "required": true } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } \ No newline at end of file diff --git a/services/client/common/models/PaymentMethod.json b/services/client/common/models/PaymentMethod.json index f78548dd2..7bf183ad3 100644 --- a/services/client/common/models/PaymentMethod.json +++ b/services/client/common/models/PaymentMethod.json @@ -12,5 +12,13 @@ "type": "string", "required": true } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json index 2279afc81..cced0d368 100644 --- a/services/client/common/models/Province.json +++ b/services/client/common/models/Province.json @@ -12,5 +12,13 @@ "type": "string", "required": true } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } \ No newline at end of file diff --git a/services/client/common/models/SalesPerson.json b/services/client/common/models/SalesPerson.json index be81be863..20c4aa53f 100644 --- a/services/client/common/models/SalesPerson.json +++ b/services/client/common/models/SalesPerson.json @@ -12,5 +12,13 @@ "type": "string", "required": true } - } + }, + "acls": [ + { + "accessType": "*", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } diff --git a/services/client/package.json b/services/client/package.json index 8374922a7..3656a4540 100644 --- a/services/client/package.json +++ b/services/client/package.json @@ -11,12 +11,12 @@ "compression": "^1.0.3", "cors": "^2.5.2", "helmet": "^1.3.0", + "loopback": "^2.38.0", "loopback-boot": "^2.6.5", - "loopback-component-explorer": "^2.4.0", + "loopback-component-explorer": "^2.7.0", + "loopback-datasource-juggler": "^2.54.0", "serve-favicon": "^2.0.1", - "strong-error-handler": "^1.0.1", - "loopback-datasource-juggler": "^2.39.0", - "loopback": "^2.22.0" + "strong-error-handler": "^1.2.1" }, "devDependencies": { "eslint": "^2.13.1", diff --git a/services/client/server/boot/authentication.js b/services/client/server/boot/authentication.js index 65e68ce37..2cd84e88a 100644 --- a/services/client/server/boot/authentication.js +++ b/services/client/server/boot/authentication.js @@ -1,4 +1,4 @@ -module.exports = function enableAuthentication(server) { +module.exports = function(server) { //server.enableAuth(); }; diff --git a/services/client/server/boot/validations.js b/services/client/server/boot/validations.js index aee5df117..b63b1ccaa 100644 --- a/services/client/server/boot/validations.js +++ b/services/client/server/boot/validations.js @@ -1,4 +1,4 @@ -module.exports = function (app) { +module.exports = function (server) { function toJson(object) { let json = {}; @@ -21,9 +21,9 @@ module.exports = function (app) { return json; } - app.get('/validations', function (req, res) { + server.get('/validations', function (req, res) { let json = {}; - let models = app.models; + let models = server.models; for(let modelName in models) { let model = models[modelName]; diff --git a/services/client/server/config.json b/services/client/server/config.json index cb129390a..289c888cc 100644 --- a/services/client/server/config.json +++ b/services/client/server/config.json @@ -2,6 +2,7 @@ "restApiRoot": "/api", "host": "0.0.0.0", "port": 3002, + "logoutSessionsOnSensitiveChanges": true, "remoting": { "context": false, "rest": { diff --git a/services/client/server/model-config.json b/services/client/server/model-config.json index 30d28228c..f2f708f52 100644 --- a/services/client/server/model-config.json +++ b/services/client/server/model-config.json @@ -14,23 +14,25 @@ ] }, "User": { - "dataSource": "db" + "dataSource": "db", + "public": true }, "AccessToken": { "dataSource": "db", - "public": false + "public": true, + "strict": true }, "ACL": { "dataSource": "db", - "public": false + "public": true }, "RoleMapping": { "dataSource": "db", - "public": false + "public": true }, "Role": { "dataSource": "db", - "public": false + "public": true }, "Client": { "dataSource": "db", @@ -68,4 +70,4 @@ "dataSource": "db", "public": true } -} \ No newline at end of file +}