Use SCOPE_ANY everywhere

This commit is contained in:
Girish Ramakrishnan
2018-04-30 21:44:24 -07:00
parent e7c8791356
commit 61d803f528
5 changed files with 18 additions and 14 deletions

View File

@@ -6,7 +6,8 @@
/* global before:false */
/* global after:false */
var appdb = require('../../appdb.js'),
var accesscontrol = require('../../accesscontrol.js'),
appdb = require('../../appdb.js'),
apps = require('../../apps.js'),
assert = require('assert'),
async = require('async'),
@@ -215,7 +216,7 @@ function startBox(done) {
token_1 = tokendb.generateToken();
// HACK to get a token for second user (passwords are generated and the user should have gotten a password setup link...)
tokendb.add(token_1, user_1_id, 'test-client-id', Date.now() + 1000000, '*', callback);
tokendb.add(token_1, user_1_id, 'test-client-id', Date.now() + 1000000, accesscontrol.SCOPE_ANY, callback);
},
function (callback) {
@@ -628,7 +629,7 @@ describe('App API', function () {
describe('App installation', function () {
this.timeout(100000);
var apiHockInstance = hock.createHock({ throwOnUnmatched: false }), apiHockServer;
var apiHockInstance = hock.createHock({ throwOnUnmatched: false });
var validCert1, validKey1;

View File

@@ -5,7 +5,8 @@
/* global before:false */
/* global after:false */
var async = require('async'),
var accesscontrol = require('../../accesscontrol.js'),
async = require('async'),
config = require('../../config.js'),
database = require('../../database.js'),
expect = require('expect.js'),
@@ -166,7 +167,7 @@ describe('Cloudron', function () {
userId_1 = result.body.id;
// HACK to get a token for second user (passwords are generated and the user should have gotten a password setup link...)
tokendb.add(token_1, userId_1, 'test-client-id', Date.now() + 100000, '*', callback);
tokendb.add(token_1, userId_1, 'test-client-id', Date.now() + 100000, accesscontrol.SCOPE_ANY, callback);
});
}
], done);

View File

@@ -6,13 +6,14 @@
'use strict';
var config = require('../../config.js'),
var accesscontrol = require('../../accesscontrol.js'),
config = require('../../config.js'),
database = require('../../database.js'),
tokendb = require('../../tokendb.js'),
expect = require('expect.js'),
mailer = require('../../mailer.js'),
superagent = require('superagent'),
server = require('../../server.js');
server = require('../../server.js'),
tokendb = require('../../tokendb.js');
const SERVER_URL = 'http://localhost:' + config.get('port');
@@ -116,7 +117,7 @@ describe('Profile API', function () {
var token = tokendb.generateToken();
var expires = Date.now() - 2000; // 1 sec
tokendb.add(token, user_0.id, null, expires, '*', function (error) {
tokendb.add(token, user_0.id, null, expires, accesscontrol.SCOPE_ANY, function (error) {
expect(error).to.not.be.ok();
superagent.get(SERVER_URL + '/api/v1/user/profile').query({ access_token: token }).end(function (error, result) {