Skip to content

Commit

Permalink
Work around the problem described in
Browse files Browse the repository at this point in the history
  • Loading branch information
David Renshaw committed Nov 29, 2016
1 parent aa97867 commit f2fe28a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ mquandalle:moment
ongoworks:speakingurl
raix:handlebar-helpers
tap:i18n
http

# UI components
blaze
Expand Down
16 changes: 16 additions & 0 deletions sandstorm.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,22 @@ 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) {
Expand Down

0 comments on commit f2fe28a

Please sign in to comment.