Skip to content

Commit

Permalink
Fix backward compatibility for allow rules in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Sep 5, 2024
1 parent e011833 commit e792f72
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions roles/tests/serverAsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,24 @@ Meteor.publish('client_assignments', async () => {
})

// To allow inserting on the client, needed for testing.
Meteor.roleAssignment.allow({
insert () { return true },
insertAsync () { return true },
update () { return true },
updateAsync () { return true },
remove () { return true },
removeAsync () { return true }
})
if (Meteor.release.split('@')[1][1] === '2') {
Meteor.roleAssignment.allow({
insert () { return true },
update () { return true },
remove () { return true }
})
} else {
// Meteor 3+
Meteor.roleAssignment.allow({
insert () { return true },
insertAsync () { return true },
update () { return true },
updateAsync () { return true },
remove () { return true },
removeAsync () { return true }
})
}


const hasProp = (target, prop) => Object.hasOwnProperty.call(target, prop)

Expand Down

0 comments on commit e792f72

Please sign in to comment.