settings: make user_directory setting route
This commit is contained in:
@@ -9,11 +9,10 @@ const common = require('./common.js'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
expect = require('expect.js'),
|
||||
settings = require('../settings.js'),
|
||||
tokens = require('../tokens.js'),
|
||||
safe = require('safetydance');
|
||||
|
||||
describe('Settings', function () {
|
||||
const { setup, cleanup, admin } = common;
|
||||
const { setup, cleanup } = common;
|
||||
|
||||
before(setup);
|
||||
after(cleanup);
|
||||
@@ -62,22 +61,6 @@ describe('Settings', function () {
|
||||
await settings.setBackupPolicy({ schedule: '00 00 2,23 * * 0,1,2', retention: { keepWithinSecs: 1 }});
|
||||
});
|
||||
|
||||
it('can get default profile config', async function () {
|
||||
const profileConfig = await settings.getProfileConfig();
|
||||
expect(profileConfig.lockUserProfiles).to.be(false);
|
||||
expect(profileConfig.mandatory2FA).to.be(false);
|
||||
});
|
||||
|
||||
it('can set default profile config', async function () {
|
||||
await tokens.add({ name: 'token1', identifier: admin.id, clientId: tokens.ID_WEBADMIN, expires: Number.MAX_SAFE_INTEGER, lastUsedTime: null });
|
||||
let result = await tokens.listByUserId(admin.id);
|
||||
expect(result.length).to.be(1); // just confirm the token was really added!
|
||||
|
||||
await settings.setProfileConfig({ mandatory2FA: true, lockUserProfiles: true });
|
||||
result = await tokens.listByUserId(admin.id);
|
||||
expect(result.length).to.be(0); // should have been removed by mandatory 2fa setting change
|
||||
});
|
||||
|
||||
it('can get all values', async function () {
|
||||
const allSettings = await settings.list();
|
||||
expect(allSettings[settings.TIME_ZONE_KEY]).to.be.a('string');
|
||||
|
||||
@@ -9,6 +9,7 @@ const BoxError = require('../boxerror.js'),
|
||||
common = require('./common.js'),
|
||||
expect = require('expect.js'),
|
||||
safe = require('safetydance'),
|
||||
tokens = require('../tokens.js'),
|
||||
users = require('../users.js'),
|
||||
_ = require('underscore');
|
||||
|
||||
@@ -542,4 +543,22 @@ describe('User', function () {
|
||||
|
||||
it('can re-create user after user was removed', createOwner);
|
||||
});
|
||||
|
||||
describe('profile config', function () {
|
||||
it('can get default profile config', async function () {
|
||||
const profileConfig = await users.getProfileConfig();
|
||||
expect(profileConfig.lockUserProfiles).to.be(false);
|
||||
expect(profileConfig.mandatory2FA).to.be(false);
|
||||
});
|
||||
|
||||
it('can set default profile config', async function () {
|
||||
await tokens.add({ name: 'token1', identifier: admin.id, clientId: tokens.ID_WEBADMIN, expires: Number.MAX_SAFE_INTEGER, lastUsedTime: null });
|
||||
let result = await tokens.listByUserId(admin.id);
|
||||
expect(result.length).to.be(1); // just confirm the token was really added!
|
||||
|
||||
await users.setProfileConfig({ mandatory2FA: true, lockUserProfiles: true });
|
||||
result = await tokens.listByUserId(admin.id);
|
||||
expect(result.length).to.be(0); // should have been removed by mandatory 2fa setting change
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user