Finished refactor of story/chapter/comment related stuff.
the build was successful

This commit is contained in:
2019-08-25 16:10:10 +02:00
parent 8c4670580c
commit 2eed815993
22 changed files with 737 additions and 502 deletions
+6 -2
View File
@@ -15,8 +15,12 @@ func CheckPermission(ctx context.Context, op string, obj interface{}) error {
return ErrUnauthenticated
}
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
return CheckPermission(ctx, op, &obj)
if v := reflect.ValueOf(obj); v.Kind() == reflect.Struct {
ptr := reflect.PtrTo(v.Type())
ptrValue := reflect.New(ptr.Elem())
ptrValue.Elem().Set(v)
obj = ptrValue.Interface()
}
var authorized = false