mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Setup isModerator permission for disable relation
This commit is contained in:
parent
420ea8a4d6
commit
85d9d7043e
@ -55,7 +55,10 @@ const permissions = shield({
|
||||
report: isAuthenticated,
|
||||
CreateBadge: isAdmin,
|
||||
UpdateBadge: isAdmin,
|
||||
DeleteBadge: isAdmin
|
||||
DeleteBadge: isAdmin,
|
||||
|
||||
AddPostDisabledBy: isModerator,
|
||||
RemovePostDisabledBy: isModerator,
|
||||
// addFruitToBasket: isAuthenticated
|
||||
// CreateUser: allow,
|
||||
},
|
||||
|
||||
@ -214,10 +214,25 @@ describe('AddPostDisabledBy', () => {
|
||||
}
|
||||
}
|
||||
`
|
||||
it.todo('throws authorization error')
|
||||
it('throws authorization error', async () => {
|
||||
client = new GraphQLClient(host)
|
||||
await expect(client.request(mutation)).rejects.toThrow('Not Authorised')
|
||||
})
|
||||
|
||||
describe('authenticated', () => {
|
||||
it.todo('throws authorization error')
|
||||
let headers
|
||||
beforeEach(async () => {
|
||||
await factory.create('User', {
|
||||
email: 'someUser@example.org',
|
||||
password: '1234'
|
||||
})
|
||||
headers = await login({ email: 'someUser@example.org', password: '1234' })
|
||||
client = new GraphQLClient(host, { headers })
|
||||
})
|
||||
|
||||
it('throws authorization error', async () => {
|
||||
await expect(client.request(mutation)).rejects.toThrow('Not Authorised')
|
||||
})
|
||||
|
||||
describe('as moderator', () => {
|
||||
it.todo('throws authorization error')
|
||||
@ -231,10 +246,38 @@ describe('AddPostDisabledBy', () => {
|
||||
})
|
||||
|
||||
describe('RemovePostDisabledBy', () => {
|
||||
it.todo('throws authorization error')
|
||||
const mutation = `
|
||||
mutation {
|
||||
AddPostDisabledBy(from: { id: "u8" }, to: { id: "p9" }) {
|
||||
from {
|
||||
id
|
||||
}
|
||||
to {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
it('throws authorization error', async () => {
|
||||
client = new GraphQLClient(host)
|
||||
await expect(client.request(mutation)).rejects.toThrow('Not Authorised')
|
||||
})
|
||||
|
||||
describe('authenticated', () => {
|
||||
it.todo('throws authorization error')
|
||||
let headers
|
||||
beforeEach(async () => {
|
||||
await factory.create('User', {
|
||||
email: 'someUser@example.org',
|
||||
password: '1234'
|
||||
})
|
||||
headers = await login({ email: 'someUser@example.org', password: '1234' })
|
||||
client = new GraphQLClient(host, { headers })
|
||||
})
|
||||
|
||||
it('throws authorization error', async () => {
|
||||
await expect(client.request(mutation)).rejects.toThrow('Not Authorised')
|
||||
})
|
||||
|
||||
describe('as moderator', () => {
|
||||
it.todo('throws authorization error')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user