ACLs habilitadas

This commit is contained in:
Juan Ferrer Toribio 2017-03-14 13:08:55 +01:00
parent 7059eadfc7
commit f1c5a45657
20 changed files with 118 additions and 42 deletions

View File

@ -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 = {

View File

@ -1 +1 @@
export * from './src/app'
export * from './src/app';

View File

@ -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];

View File

@ -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;

View File

@ -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) {

11
db.json
View File

@ -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": {}
}
}

View File

@ -15,8 +15,12 @@
"type": "boolean"
}
},
"validations": [],
"relations": {},
"acls": [],
"methods": {}
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -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"
}
]
}

View File

@ -12,5 +12,13 @@
"type": "string",
"required": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -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": {}
}

View File

@ -29,5 +29,13 @@
"type": "belongsTo",
"foreignKey": "id"
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -12,5 +12,13 @@
"type": "string",
"required": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -12,5 +12,13 @@
"type": "string",
"required": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -12,5 +12,13 @@
"type": "string",
"required": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -12,5 +12,13 @@
"type": "string",
"required": true
}
}
},
"acls": [
{
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -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",

View File

@ -1,4 +1,4 @@
module.exports = function enableAuthentication(server) {
module.exports = function(server) {
//server.enableAuth();
};

View File

@ -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];

View File

@ -2,6 +2,7 @@
"restApiRoot": "/api",
"host": "0.0.0.0",
"port": 3002,
"logoutSessionsOnSensitiveChanges": true,
"remoting": {
"context": false,
"rest": {

View File

@ -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
}
}
}