| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Images are ready for the commit at 8f100c9. To use with deploy scripts, first export MAIN_IMAGE_TAG=4.1.x-393-g8f100c912a. |
Sorry, something went wrong.
There was a problem hiding this comment.
Please review the logic behind IsWriteAllowed in pkg/search/postgres/sac.go.
If the function is not needed, it could be removed.
The other changes look good. There are some possible improvement follow-ups.
Sorry, something went wrong.
| if err != nil { | ||
| return false | ||
| } | ||
| return sacQuery.GetBaseQuery().GetMatchNoneQuery() != nil |
There was a problem hiding this comment.
Write is allowed if the filter query is NOT MatchNoneQuery. I have the feeling this would return true if the sacQuery is a MatchNoneQuery. Am I mistaken here ?
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, I forgot to delete it. It's leftover from my try to make scope checker generic.
Sorry, something went wrong.
|
|
||
| func (s *GenericStore[T, PT]) upsert(ctx context.Context, objs ...PT) error { | ||
| if s.insertInto == nil { | ||
| err := errors.New("invalid operation, missing insertInto function") |
There was a problem hiding this comment.
nit: Why not making this error a file var or const ?
Sorry, something went wrong.
|
|
||
| func (s *GenericStore[T, PT]) copyFrom(ctx context.Context, objs ...PT) error { | ||
| if s.copyFromObj == nil { | ||
| err := errors.New("invalid operation, missing copyFromObj function") |
There was a problem hiding this comment.
nit: Why not making this error a file var or const ?
Sorry, something went wrong.
| } | ||
|
|
||
| if err := s.copyFromObj(ctx, s, tx, objs...); err != nil { | ||
| if err := tx.Rollback(ctx); err != nil { |
There was a problem hiding this comment.
nit: could we differentiate the rollback error from the copyFromObj one ?
Sorry, something went wrong.
| return err | ||
| } | ||
|
|
||
| conn, err := s.AcquireConn(ctx, ops.Get) |
There was a problem hiding this comment.
Although it was already so in the generated store function, I think it would make sense to use ops.Upsert here.
Can be tracked as a follow-up.
Sorry, something went wrong.
| utils.Should(err) | ||
| return err | ||
| } | ||
| conn, err := s.AcquireConn(ctx, ops.Get) |
There was a problem hiding this comment.
Although it was already so in the generated store function, I think it would make sense to use ops.Upsert here.
Can be tracked as a follow-up.
Sorry, something went wrong.
| return s.permissionChecker != nil | ||
| } | ||
|
|
||
| func (s *GenericStore[T, PT]) permissionCheckerUpsertAllows(ctx context.Context) error { |
There was a problem hiding this comment.
nit: naming - how about permissionCheckerAllowsUpsert ?
Sorry, something went wrong.
Sorry, something went wrong.
|
/retest |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Description
The last Method migrated from to generic store. I didn't find a way to make SAC checks generic so I inject them with a function.
Checklist
If any of these don't apply, please comment below.
Testing Performed
CI