mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 07:50:12 +01:00
- Try to have some progress on Wekan Sandstorm API. I did not get it fully working yet.
Thanks to xet7.
This commit is contained in:
parent
cf7d3b5a7e
commit
be03a191c4
2 changed files with 22 additions and 1 deletions
|
|
@ -226,7 +226,7 @@ const pkgdef :Spk.PackageDefinition = (
|
||||||
verbPhrase = (defaultText = "removed from card"),
|
verbPhrase = (defaultText = "removed from card"),
|
||||||
), ],
|
), ],
|
||||||
),
|
),
|
||||||
apiPath = "/",
|
apiPath = "/api",
|
||||||
saveIdentityCaps = true,
|
saveIdentityCaps = true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,27 @@ Meteor.startup(() => {
|
||||||
Authentication = {};
|
Authentication = {};
|
||||||
|
|
||||||
Authentication.checkUserId = function (userId) {
|
Authentication.checkUserId = function (userId) {
|
||||||
|
if (userId === undefined) {
|
||||||
|
// 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});
|
||||||
|
if (user) {
|
||||||
|
userId = user._id;
|
||||||
|
}
|
||||||
|
//return user && user._id;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_httpMethods(newMethods);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (userId === undefined) {
|
if (userId === undefined) {
|
||||||
const error = new Meteor.Error('Unauthorized', 'Unauthorized');
|
const error = new Meteor.Error('Unauthorized', 'Unauthorized');
|
||||||
error.statusCode = 401;
|
error.statusCode = 401;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue