mirror of
https://github.com/wekan/wekan.git
synced 2025-04-23 13:37:09 -04:00
Add dwrensha's Sandstorm patch to Wekan so it does not need to be maintained separately.
This commit is contained in:
parent
f9f529e53f
commit
bda15daa78
1 changed files with 17 additions and 0 deletions
17
sandstorm.js
17
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue