migrate permissions and admin flag to user.role
This commit is contained in:
@@ -38,10 +38,9 @@ var USER_0 = {
|
||||
displayName: '',
|
||||
twoFactorAuthenticationEnabled: false,
|
||||
twoFactorAuthenticationSecret: '',
|
||||
admin: false,
|
||||
role: 'user',
|
||||
active: true,
|
||||
source: '',
|
||||
permissions: null
|
||||
source: ''
|
||||
};
|
||||
|
||||
var USER_1 = {
|
||||
@@ -57,10 +56,9 @@ var USER_1 = {
|
||||
displayName: 'Herbert 1',
|
||||
twoFactorAuthenticationEnabled: false,
|
||||
twoFactorAuthenticationSecret: '',
|
||||
admin: false,
|
||||
role: 'user',
|
||||
active: true,
|
||||
source: '',
|
||||
permissions: null
|
||||
source: ''
|
||||
};
|
||||
|
||||
var USER_2 = {
|
||||
@@ -76,10 +74,9 @@ var USER_2 = {
|
||||
displayName: 'Herbert 2',
|
||||
twoFactorAuthenticationEnabled: false,
|
||||
twoFactorAuthenticationSecret: '',
|
||||
admin: false,
|
||||
role: 'user',
|
||||
active: true,
|
||||
source: '',
|
||||
permissions: null
|
||||
source: ''
|
||||
};
|
||||
|
||||
const DOMAIN_0 = {
|
||||
@@ -606,9 +603,9 @@ describe('database', function () {
|
||||
});
|
||||
|
||||
it('can get all admins', function (done) {
|
||||
userdb.getAllAdmins(function (error, all) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(all.length).to.equal(0);
|
||||
userdb.getByRole('owner', function (error, all) {
|
||||
expect(error).to.be.ok();
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -621,6 +618,14 @@ describe('database', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('can get all users', function (done) {
|
||||
userdb.getByRole('user', function (error, all) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(all.length).to.equal(3);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('can update the user', function (done) {
|
||||
userdb.update(USER_0.id, { email: 'some@thing.com', displayName: 'Heiter' }, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
|
||||
Reference in New Issue
Block a user