summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2017-07-30 17:59:06 +0300
committerLauri Ojansivu <x@xet7.org>2017-07-30 17:59:06 +0300
commitbda15daa78556223117a5846941aafd1212f14d3 (patch)
tree1bd7b8a06f62e1816f56c3f712eec94187d99904
parentf9f529e53f980d889df5bb1f818da55268284535 (diff)
downloadwekan-bda15daa78556223117a5846941aafd1212f14d3.tar.gz
wekan-bda15daa78556223117a5846941aafd1212f14d3.tar.bz2
wekan-bda15daa78556223117a5846941aafd1212f14d3.zip
Add dwrensha's Sandstorm patch to Wekan so it does not need to be maintained separately.
-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) {