From beb7862ae81d3b223641bae526de822c126fcf21 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 8 Oct 2021 16:04:08 +0100 Subject: [PATCH] Process permissions after conditional clauses --- db/delete.go | 4 ++-- db/select.go | 4 ++-- db/update.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/delete.go b/db/delete.go index 86862ff4..c94fef7c 100644 --- a/db/delete.go +++ b/db/delete.go @@ -142,13 +142,13 @@ func (d *document) runDelete(ctx context.Context, stm *sql.DeleteStatement) (int return nil, nil } - if ok, err = d.allow(ctx, met); err != nil { + if ok, err = d.check(ctx, stm.Cond); err != nil { return nil, err } else if ok == false { return nil, nil } - if ok, err = d.check(ctx, stm.Cond); err != nil { + if ok, err = d.allow(ctx, met); err != nil { return nil, err } else if ok == false { return nil, nil diff --git a/db/select.go b/db/select.go index 1bd9ad0d..5163f426 100644 --- a/db/select.go +++ b/db/select.go @@ -168,13 +168,13 @@ func (d *document) runSelect(ctx context.Context, stm *sql.SelectStatement) (int return nil, nil } - if ok, err = d.allow(ctx, met); err != nil { + if ok, err = d.check(ctx, stm.Cond); err != nil { return nil, err } else if ok == false { return nil, nil } - if ok, err = d.check(ctx, stm.Cond); err != nil { + if ok, err = d.allow(ctx, met); err != nil { return nil, err } else if ok == false { return nil, nil diff --git a/db/update.go b/db/update.go index 04d5d635..e6f1b949 100644 --- a/db/update.go +++ b/db/update.go @@ -142,13 +142,13 @@ func (d *document) runUpdate(ctx context.Context, stm *sql.UpdateStatement) (int met = _UPDATE } - if ok, err = d.allow(ctx, met); err != nil { + if ok, err = d.check(ctx, stm.Cond); err != nil { return nil, err } else if ok == false { return nil, nil } - if ok, err = d.check(ctx, stm.Cond); err != nil { + if ok, err = d.allow(ctx, met); err != nil { return nil, err } else if ok == false { return nil, nil