mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 08:20:12 +01:00
22 lines
483 B
JavaScript
22 lines
483 B
JavaScript
|
|
Meteor.startup(() => {
|
||
|
|
Authentication = {};
|
||
|
|
|
||
|
|
Authentication.checkUserId = function (userId) {
|
||
|
|
if (userId === undefined) {
|
||
|
|
const error = new Meteor.Error('Unauthorized', 'Unauthorized');
|
||
|
|
error.statusCode = 401;
|
||
|
|
throw error;
|
||
|
|
}
|
||
|
|
const admin = Users.findOne({ _id: userId, isAdmin: true });
|
||
|
|
|
||
|
|
if (admin === undefined) {
|
||
|
|
const error = new Meteor.Error('Forbidden', 'Forbidden');
|
||
|
|
error.statusCode = 403;
|
||
|
|
throw error;
|
||
|
|
}
|
||
|
|
|
||
|
|
};
|
||
|
|
|
||
|
|
});
|
||
|
|
|