Skip to content

Commit

Permalink
Merge pull request strongloop#1301 from strongloop/feature/disable-in…
Browse files Browse the repository at this point in the history
…clude-access-tokens

Upgrade test fixtures to 2.x project layouts
  • Loading branch information
raymondfeng committed Apr 20, 2015
2 parents 69b4972 + 12e19e3 commit ca004ad
Show file tree
Hide file tree
Showing 45 changed files with 495 additions and 389 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"karma-mocha": "^0.1.10",
"karma-phantomjs-launcher": "^0.1.4",
"karma-script-launcher": "^0.1.0",
"loopback-boot": "^1.1.0",
"loopback-boot": "^2.7.0",
"loopback-datasource-juggler": "^2.19.1",
"loopback-testing": "^1.1.0",
"mocha": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion test/access-control.integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var loopback = require('../');
var lt = require('loopback-testing');
var path = require('path');
var ACCESS_CONTROL_APP = path.join(__dirname, 'fixtures', 'access-control');
var app = require(path.join(ACCESS_CONTROL_APP, 'app.js'));
var app = require(path.join(ACCESS_CONTROL_APP, 'server/server.js'));
var assert = require('assert');
var USER = {email: '[email protected]', password: 'test'};
var CURRENT_USER = {email: '[email protected]', password: 'test'};
Expand Down
2 changes: 2 additions & 0 deletions test/access-token.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
var loopback = require('../');
var extend = require('util')._extend;
var Token = loopback.AccessToken.extend('MyToken');
var ds = loopback.createDataSource({connector: loopback.Memory});
Token.attachTo(ds);
var ACL = loopback.ACL;

describe('loopback.token(options)', function() {
Expand Down
4 changes: 0 additions & 4 deletions test/fixtures/access-control/app.json

This file was deleted.

19 changes: 19 additions & 0 deletions test/fixtures/access-control/common/models/access-token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "accessToken",
"base": "AccessToken",
"baseUrl": "access-tokens",
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
},
{
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "$everyone",
"property": "create"
}
]
}
42 changes: 42 additions & 0 deletions test/fixtures/access-control/common/models/account.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "account",
"relations": {
"transactions": {
"model": "transaction",
"type": "hasMany"
},
"user": {
"model": "user",
"type": "belongsTo",
"foreignKey": "userId"
}
},
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
},
{
"accessType": "*",
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "$owner"
},
{
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$owner",
"property": "deleteById"
},
{
"accessType": "*",
"permission": "DENY",
"property": "find",
"principalType": "ROLE",
"principalId": "$dummy"
}
],
"properties": {}
}
12 changes: 12 additions & 0 deletions test/fixtures/access-control/common/models/alert.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "alert",
"acls": [
{
"accessType": "WRITE",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
}
],
"properties": {}
}
28 changes: 28 additions & 0 deletions test/fixtures/access-control/common/models/bank.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "bank",
"relations": {
"users": {
"model": "user",
"type": "hasMany"
},
"accounts": {
"model": "account",
"type": "hasMany"
}
},
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
},
{
"accessType": "READ",
"permission": "ALLOW",
"principalType": "ROLE",
"principalId": "$everyone"
}
],
"properties": {}
}
12 changes: 12 additions & 0 deletions test/fixtures/access-control/common/models/email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "email",
"base": "Email",
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
}
]
}
12 changes: 12 additions & 0 deletions test/fixtures/access-control/common/models/transaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "transaction",
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
}
],
"properties": {}
}
23 changes: 23 additions & 0 deletions test/fixtures/access-control/common/models/user.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "user",
"base": "User",
"relations": {
"accessTokens": {
"model": "accessToken",
"type": "hasMany",
"foreignKey": "userId"
},
"transactions": {
"model": "transaction",
"type": "hasMany"
}
},
"acls": [
{
"accessType": "*",
"permission": "DENY",
"principalType": "ROLE",
"principalId": "$everyone"
}
]
}
171 changes: 0 additions & 171 deletions test/fixtures/access-control/models.json

This file was deleted.

5 changes: 5 additions & 0 deletions test/fixtures/access-control/server/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"port": 3000,
"host": "0.0.0.0",
"legacyExplorer": false
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"db": {
"defaultForType": "db",
"connector": "memory"
},
"mail": {
"defaultForType": "mail",
"connector": "mail"
}
}
Loading

0 comments on commit ca004ad

Please sign in to comment.