Check permissions on the initial document when deleting
When deleting a document, we need to check the visibility permissions using the initial document, as the current document will now have been emptied. As a result, no delete notifications were being delivered to LIVE queries.
This commit is contained in:
parent
55ece805e4
commit
6fe4db6a58
1 changed files with 10 additions and 1 deletions
11
db/check.go
11
db/check.go
|
@ -87,7 +87,16 @@ func (d *document) grant(ctx context.Context, met method) (ok bool, err error) {
|
|||
// a scoped request, return an error.
|
||||
|
||||
if p, ok := tb.Perms.(*sql.PermExpression); ok {
|
||||
val, err = d.i.e.fetch(ctx, p.Select, d.current)
|
||||
switch met {
|
||||
case _SELECT:
|
||||
val, err = d.i.e.fetch(ctx, p.Select, d.current)
|
||||
case _CREATE:
|
||||
val, err = d.i.e.fetch(ctx, p.Select, d.current)
|
||||
case _UPDATE:
|
||||
val, err = d.i.e.fetch(ctx, p.Select, d.current)
|
||||
case _DELETE:
|
||||
val, err = d.i.e.fetch(ctx, p.Select, d.initial)
|
||||
}
|
||||
}
|
||||
|
||||
// If the permissions expressions
|
||||
|
|
Loading…
Reference in a new issue