Compare commits

...
3 Commits
Author SHA1 Message Date
gisle b7d5059d60 graph2: Fixed chapter using story permissions.
the build was successful
2018-10-16 19:01:11 +02:00
gisle 9fbdc767ad models2: Added 'post.remove' to default user permissionss.
the build was successful
2018-10-16 18:49:14 +02:00
gisle daeaaf5fa9 rpdata-as2storyimport: Fixed category vailidty check failing when it is valid, not when it isn't.
the build was successful
2018-10-16 18:30:24 +02:00
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ func main() {
}
category := models.StoryCategory(result.Category)
if category.IsValid() {
if !category.IsValid() {
log.Println(result.Name, "does not have a valid category:", result.Category)
continue
}
+3 -3
View File
@@ -28,7 +28,7 @@ func (r *mutationResolver) AddChapter(ctx context.Context, input input.ChapterAd
}
token := auth.TokenFromContext(ctx)
if !token.Authenticated() {
if !token.Permitted("member", "story.add") {
return models.Chapter{}, errors.New("Unauthorized")
}
@@ -55,7 +55,7 @@ func (r *mutationResolver) EditChapter(ctx context.Context, input input.ChapterE
}
token := auth.TokenFromContext(ctx)
if !token.Authenticated() || !token.PermittedUser(chapter.Author, "member", "story.edit") {
if !token.Authenticated() || !token.PermittedUser(chapter.Author, "member", "chapter.edit") {
return models.Chapter{}, errors.New("Unauthorized")
}
@@ -73,7 +73,7 @@ func (r *mutationResolver) RemoveChapter(ctx context.Context, input input.Chapte
}
token := auth.TokenFromContext(ctx)
if !token.Authenticated() || !token.PermittedUser(chapter.Author, "member", "story.remove") {
if !token.Authenticated() || !token.PermittedUser(chapter.Author, "member", "chapter.remove") {
return models.Chapter{}, errors.New("Unauthorized")
}
+1
View File
@@ -19,6 +19,7 @@ func Ensure(id string) (models.User, error) {
"log.edit",
"post.edit",
"post.move",
"post.remove",
"file.upload",
},
}