mirror of
https://github.com/wekan/wekan.git
synced 2026-01-03 16:18:49 +01:00
board export now checks authentication
This commit is contained in:
parent
7cfc72da99
commit
18697d45f6
6 changed files with 52 additions and 21 deletions
|
|
@ -79,6 +79,33 @@ Boards.attachSchema(new SimpleSchema({
|
|||
|
||||
|
||||
Boards.helpers({
|
||||
/**
|
||||
* Is current logged-in user authorized to view this board?
|
||||
*/
|
||||
isVisibleByUser() {
|
||||
if(this.isPublic()) {
|
||||
// public boards are visible to everyone
|
||||
return true;
|
||||
} else {
|
||||
// otherwise you have to be logged-in and active member
|
||||
return this.isActiveMember(Meteor.userId());
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Is the user one of the active members of the board?
|
||||
*
|
||||
* @param userId
|
||||
* @returns {boolean} the member that matches, or undefined/false
|
||||
*/
|
||||
isActiveMember(userId) {
|
||||
if(userId) {
|
||||
return this.members.find((member) => (member.userId === userId && member.isActive));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
isPublic() {
|
||||
return this.permission === 'public';
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue