graph2: Changed story tagging permissions to allow anyone to tag open stories.
the build was successful
the build was successful
This commit is contained in:
@@ -79,9 +79,15 @@ func (r *mutationResolver) AddStoryTag(ctx context.Context, input input.StoryTag
|
|||||||
return models.Story{}, errors.New("Story not found")
|
return models.Story{}, errors.New("Story not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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") {
|
if !token.PermittedUser(story.Author, "member", "story.edit") {
|
||||||
return models.Story{}, errors.New("You are not permitted to edit this story")
|
return models.Story{}, errors.New("You are not permitted to edit this story")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
story, err = stories.AddTag(story, input.Tag)
|
story, err = stories.AddTag(story, input.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -101,9 +107,15 @@ func (r *mutationResolver) RemoveStoryTag(ctx context.Context, input input.Story
|
|||||||
return models.Story{}, errors.New("Story not found")
|
return models.Story{}, errors.New("Story not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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") {
|
if !token.PermittedUser(story.Author, "member", "story.edit") {
|
||||||
return models.Story{}, errors.New("You are not permitted to edit this story")
|
return models.Story{}, errors.New("You are not permitted to edit this story")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
story, err = stories.RemoveTag(story, input.Tag)
|
story, err = stories.RemoveTag(story, input.Tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user