This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user