mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
- fixed webfinger test to work with docker(hackfix)
- fixed permissions middleware to properly authenticate users
This commit is contained in:
parent
9ecdfdab44
commit
4b04a6bb5c
@ -98,12 +98,12 @@ describe('webfinger', () => {
|
|||||||
expect(json).toHaveBeenCalledWith({
|
expect(json).toHaveBeenCalledWith({
|
||||||
links: [
|
links: [
|
||||||
{
|
{
|
||||||
href: 'http://localhost:3000/activitypub/users/some-user',
|
href: 'http://webapp:3000/activitypub/users/some-user',
|
||||||
rel: 'self',
|
rel: 'self',
|
||||||
type: 'application/activity+json',
|
type: 'application/activity+json',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
subject: 'acct:some-user@localhost:3000',
|
subject: 'acct:some-user@webapp:3000',
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,15 +29,25 @@ const onlyYourself = rule({
|
|||||||
|
|
||||||
const isMyOwn = rule({
|
const isMyOwn = rule({
|
||||||
cache: 'no_cache',
|
cache: 'no_cache',
|
||||||
})(async (parent, args, context, info) => {
|
})(async (parent, args, { user }, info) => {
|
||||||
return context.user.id === parent.id
|
return user && user.id === parent.id
|
||||||
})
|
})
|
||||||
|
|
||||||
const isMySocialMedia = rule({
|
const isMySocialMedia = rule({
|
||||||
cache: 'no_cache',
|
cache: 'no_cache',
|
||||||
})(async (_, args, { user }) => {
|
})(async (_, args, { user }) => {
|
||||||
|
// We need a User
|
||||||
|
if (!user){
|
||||||
|
return false
|
||||||
|
}
|
||||||
let socialMedia = await neode.find('SocialMedia', args.id)
|
let socialMedia = await neode.find('SocialMedia', args.id)
|
||||||
socialMedia = await socialMedia.toJson()
|
// Did we find a social media node?
|
||||||
|
if(!socialMedia){
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
socialMedia = await socialMedia.toJson() // whats this for?
|
||||||
|
|
||||||
|
//Is it my social media entry?
|
||||||
return socialMedia.ownedBy.node.id === user.id
|
return socialMedia.ownedBy.node.id === user.id
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user