graph2: Changed story tagging permissions to allow anyone to tag open stories.
the build was successful

This commit is contained in:
2019-01-12 11:38:19 +01:00
parent 1ea04f1577
commit e0b93c6b4b
+16 -4
View File
@@ -79,8 +79,14 @@ func (r *mutationResolver) AddStoryTag(ctx context.Context, input input.StoryTag
return models.Story{}, errors.New("Story not found")
}
if !token.PermittedUser(story.Author, "member", "story.edit") {
return models.Story{}, errors.New("You are not permitted to edit this story")
if story.Open {
if !token.Permitted("member") {
return models.Story{}, errors.New("You are not permitted to edit this story")
}
} else {
if !token.PermittedUser(story.Author, "member", "story.edit") {
return models.Story{}, errors.New("You are not permitted to edit this story")
}
}
story, err = stories.AddTag(story, input.Tag)
@@ -101,8 +107,14 @@ func (r *mutationResolver) RemoveStoryTag(ctx context.Context, input input.Story
return models.Story{}, errors.New("Story not found")
}
if !token.PermittedUser(story.Author, "member", "story.edit") {
return models.Story{}, errors.New("You are not permitted to edit this story")
if story.Open {
if !token.Permitted("member") {
return models.Story{}, errors.New("You are not permitted to edit this story")
}
} else {
if !token.PermittedUser(story.Author, "member", "story.edit") {
return models.Story{}, errors.New("You are not permitted to edit this story")
}
}
story, err = stories.RemoveTag(story, input.Tag)