mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Extracted board access check function
This commit is contained in:
parent
95e2025ff9
commit
1e8d9f02f3
2 changed files with 10 additions and 4 deletions
|
|
@ -39,5 +39,14 @@ Meteor.startup(() => {
|
|||
}
|
||||
}
|
||||
|
||||
// Helper function. Will throw an error if the user does not have read only access to the given board
|
||||
Authentication.checkBoardAccess = function(userId, boardId) {
|
||||
Authentication.checkLoggedIn(userId);
|
||||
|
||||
const board = Boards.findOne({ _id: boardId });
|
||||
const normalAccess = board.permission === 'public' || board.members.some(e => e.userId === userId);
|
||||
Authentication.checkAdminOrCondition(userId, normalAccess);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue