Use sync code in allow/deny for 2.x

This commit is contained in:
Harry Adel 2026-02-19 00:26:47 +02:00
parent f934aea2a5
commit e77be37450
28 changed files with 594 additions and 410 deletions

View file

@ -58,8 +58,8 @@ Translation.attachSchema(
if (Meteor.isServer) {
Translation.allow({
async insert(userId, doc) {
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
insert(userId, doc) {
const user = Meteor.users.findOne(userId);
if (user?.isAdmin)
return true;
if (!user) {
@ -67,8 +67,8 @@ if (Meteor.isServer) {
}
return doc._id === userId;
},
async update(userId, doc) {
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
update(userId, doc) {
const user = Meteor.users.findOne(userId);
if (user?.isAdmin)
return true;
if (!user) {
@ -76,8 +76,8 @@ if (Meteor.isServer) {
}
return doc._id === userId;
},
async remove(userId, doc) {
const user = await ReactiveCache.getUser(userId) || await ReactiveCache.getCurrentUser();
remove(userId, doc) {
const user = Meteor.users.findOne(userId);
if (user?.isAdmin)
return true;
if (!user) {