mirror of
https://github.com/wekan/wekan.git
synced 2025-12-23 19:00:12 +01:00
Move every Users.findOne(idOrFirstObjectSelector, options) to the ReactiveCache
This commit is contained in:
parent
68610e5066
commit
0767f50af8
17 changed files with 43 additions and 33 deletions
|
|
@ -21,7 +21,7 @@ Meteor.startup(() => {
|
|||
error.statusCode = 401;
|
||||
throw error;
|
||||
}
|
||||
const admin = Users.findOne({ _id: userId, isAdmin: true });
|
||||
const admin = ReactiveCache.getUser({ _id: userId, isAdmin: true });
|
||||
|
||||
if (admin === undefined) {
|
||||
const error = new Meteor.Error('Forbidden', 'Forbidden');
|
||||
|
|
@ -44,7 +44,7 @@ Meteor.startup(() => {
|
|||
// This throws an error if otherReq is false and the user is not an admin
|
||||
Authentication.checkAdminOrCondition = function(userId, otherReq) {
|
||||
if (otherReq) return;
|
||||
const admin = Users.findOne({ _id: userId, isAdmin: true });
|
||||
const admin = ReactiveCache.getUser({ _id: userId, isAdmin: true });
|
||||
if (admin === undefined) {
|
||||
const error = new Meteor.Error('Forbidden', 'Forbidden');
|
||||
error.statusCode = 403;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue