summaryrefslogtreecommitdiffstats
path: root/sandstorm.js
diff options
context:
space:
mode:
Diffstat (limited to 'sandstorm.js')
-rw-r--r--sandstorm.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/sandstorm.js b/sandstorm.js
index 2e79c27c..2a966d62 100644
--- a/sandstorm.js
+++ b/sandstorm.js
@@ -316,6 +316,23 @@ if (isSandstorm && Meteor.isServer) {
Migrations.add('enforce-public-visibility-for-sandstorm', () => {
Boards.update('sandstorm', { $set: { permission: 'public' }});
});
+
+ // Monkey patch to work around the problem described in
+ // https://github.com/sandstorm-io/meteor-accounts-sandstorm/pull/31
+ const _httpMethods = HTTP.methods;
+ HTTP.methods = (newMethods) => {
+ Object.keys(newMethods).forEach((key) => {
+ if (newMethods[key].auth) {
+ newMethods[key].auth = function() {
+ const sandstormID = this.req.headers['x-sandstorm-user-id'];
+ const user = Meteor.users.findOne({"services.sandstorm.id": sandstormID});
+ return user && user._id;
+ };
+ }
+ });
+ _httpMethods(newMethods);
+ };
+
}
if (isSandstorm && Meteor.isClient) {