This commit is contained in:
John Supplee 2021-07-20 19:24:40 -04:00
commit 0ce2f9ea43
204 changed files with 13619 additions and 2379 deletions

View file

@ -1,21 +1,26 @@
// https://atmospherejs.com/lucasantoniassi/accounts-lockout
// server
import { AccountsLockout } from 'meteor/lucasantoniassi:accounts-lockout';
Meteor.startup(() => {
// https://atmospherejs.com/lucasantoniassi/accounts-lockout
// server
new AccountsLockout({
knownUsers: {
failuresBeforeLockout:
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE || 3,
lockoutPeriod: process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD || 60,
failureWindow:
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW || 15,
},
unknownUsers: {
failuresBeforeLockout:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE || 3,
lockoutPeriod:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD || 60,
failureWindow:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW || 15,
},
}).startup();
if (Meteor.isServer) {
import { AccountsLockout } from 'meteor/wekan-accounts-lockout';
new AccountsLockout({
knownUsers: {
failuresBeforeLockout:
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE || 3,
lockoutPeriod: process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD || 60,
failureWindow:
process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW || 15,
},
unknownUsers: {
failuresBeforeLockout:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE || 3,
lockoutPeriod:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD || 60,
failureWindow:
process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW || 15,
},
}).startup();
}
});

View file

@ -0,0 +1 @@
import './utils.tests';

View file

@ -0,0 +1,106 @@
/* eslint-env mocha */
import { Random } from 'meteor/random';
import { expect } from 'chai';
import '../utils';
describe('utils', function() {
describe(allowIsBoardAdmin.name, function() {
it('returns if a board has an admin', function() {
const userId = Random.id();
const board = {
hasAdmin: id => {
return id === userId;
}
};
expect(allowIsBoardAdmin(userId, board)).to.equal(true);
expect(allowIsBoardAdmin(Random.id(), board)).to.equal(false);
});
});
describe(allowIsBoardMember.name, function() {
it('returns if a board has a member', function() {
const userId = Random.id();
const board = {
hasMember: id => {
return id === userId;
}
};
expect(allowIsBoardMember(userId, board)).to.equal(true);
expect(allowIsBoardMember(Random.id(), board)).to.equal(false);
});
});
describe(allowIsAnyBoardMember.name, function() {
it('returns if any board has a member', function() {
const userId = Random.id();
const boardsExpectedTrue = [{
hasMember: id => {
return id === userId;
}
}];
expect(allowIsAnyBoardMember(userId, boardsExpectedTrue)).to.equal(true);
expect(allowIsAnyBoardMember(Random.id(), boardsExpectedTrue)).to.equal(false);
const boardsExpectedFalse = [{
hasMember: () => false
}];
expect(allowIsAnyBoardMember(userId, boardsExpectedFalse)).to.equal(false);
expect(allowIsAnyBoardMember(Random.id(), boardsExpectedFalse)).to.equal(false);
});
});
describe(allowIsBoardMemberCommentOnly.name, function() {
it('returns if a board has a member that is not comment-only member', function() {
const userId = Random.id();
const board = {
hasMember: id => {
return id === userId;
},
hasCommentOnly: id => {
return id !== userId;
}
};
expect(allowIsBoardMemberCommentOnly(userId, board)).to.equal(true);
expect(allowIsBoardMemberCommentOnly(Random.id(), board)).to.equal(false);
});
});
describe(allowIsBoardMemberNoComments.name, function() {
it('returns if a board has a member that has comment any comments', function() {
const userId = Random.id();
const board = {
hasMember: id => {
return id === userId;
},
hasNoComments: id => {
return id !== userId;
}
};
expect(allowIsBoardMemberNoComments(userId, board)).to.equal(true);
expect(allowIsBoardMemberNoComments(Random.id(), board)).to.equal(false);
});
});
describe(allowIsBoardMemberByCard.name, function() {
it('returns if the board for a given card has a member', function() {
const userId = Random.id();
const board = {
hasMember: id => {
return id === userId;
}
};
const card = {
board: () => board
};
expect(allowIsBoardMemberByCard(userId, card)).to.equal(true);
expect(allowIsBoardMemberByCard(Random.id(), card)).to.equal(false);
});
});
});

View file

@ -34,6 +34,8 @@ Meteor.publish('boards', function() {
description: 1,
color: 1,
members: 1,
orgs: 1,
teams: 1,
permission: 1,
type: 1,
sort: 1,

View file

@ -12,13 +12,13 @@ Meteor.publish('org', function(query, limit) {
limit,
sort: { createdAt: -1 },
fields: {
displayName: 1,
desc: 1,
name: 1,
website: 1,
teams: 1,
orgDisplayName: 1,
orgDesc: 1,
orgShortName: 1,
orgWebsite: 1,
orgTeams: 1,
createdAt: 1,
loginDisabled: 1,
orgIsActive: 1,
},
});
}

View file

@ -21,6 +21,8 @@ Meteor.publish('people', function(query, limit) {
loginDisabled: 1,
authenticationMethod: 1,
importUsernames: 1,
orgs: 1,
teams: 1,
},
});
}

View file

@ -23,6 +23,7 @@ Meteor.publish('setting', () => {
customHTMLbeforeBodyEnd: 1,
displayAuthenticationMethod: 1,
defaultAuthenticationMethod: 1,
spinnerName: 1,
},
},
);

View file

@ -12,13 +12,13 @@ Meteor.publish('team', function(query, limit) {
limit,
sort: { createdAt: -1 },
fields: {
displayName: 1,
desc: 1,
name: 1,
website: 1,
teamDisplayName: 1,
teamDesc: 1,
teamShortName: 1,
teamWebsite: 1,
teams: 1,
createdAt: 1,
loginDisabled: 1,
teamIsActive: 1,
},
});
}

3
server/spinner.js Normal file
View file

@ -0,0 +1,3 @@
Meteor.startup(() => {
Meteor.settings.public.WAIT_SPINNER = process.env.WAIT_SPINNER;
});