Akhil Narang
6461592b5d
Merge pull request #32192 from henriquefalconer/fix/field-level-permissions-filtering
...
fix: Field Level Permissions Not Applied Correctly in frappe.get_list
2025-08-01 16:35:08 +05:30
Akhil Narang
ce4f7f7418
chore: extend function blacklist
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-07-15 17:05:08 +05:30
Akhil Narang
0934d5117d
fix: strengthen subquery check
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-07-15 17:05:08 +05:30
Akhil Narang
8d62e4de01
Revert "fix(db_query): don't allow unclosed quotes"
...
This reverts commit 6e6150d193 .
2025-07-15 17:05:08 +05:30
Akhil Narang
6e6150d193
fix(db_query): don't allow unclosed quotes
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-07-07 17:37:06 +05:30
Akhil Narang
41a13a0b07
fix: tighten function check in validate_order_by_and_group_by
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-07-07 17:37:06 +05:30
Sagar Vora
7c4b6b3dc1
fix: check permissions as per specified user
2025-06-09 23:31:50 +05:30
Ankush Menat
ddbaf09125
fix: Standard field falsy comparisons in db_query ( #32791 )
...
Extends the fix to standard fields. e0f63a928f
2025-06-05 09:55:05 +05:30
Ankush Menat
c249e75fe4
fix(db_query): allow filtering name: None ( #32644 )
...
This doesn't make any sense, but ig it might get introduced via indirect
calls, so better to handle this in code explicitly.
closes https://github.com/frappe/frappe/issues/32643
2025-05-23 10:02:14 +05:30
Ankush Menat
dbb1fcba99
perf: avoid ifnull for is set and is not set
2025-05-02 12:35:58 +05:30
Ankush Menat
6d32ffcc6c
perf: optimize != operator when field can be null
2025-05-02 12:11:27 +05:30
Ankush Menat
e0f63a928f
fix: avoid bad default of flt on string types
...
🤦 this whole thing needs a refactor, fixing all bugs first to
ensure we don't screw up something in process
2025-05-02 12:00:36 +05:30
Ankush Menat
23ffdc87ae
perf: Split ifnull into two conditions
...
This produces better query plan with index intersection using 2
conditions instead of fulltable scan on dumb condition
TODO: LOTS OF TESTS
2025-05-02 11:17:53 +05:30
Ankush Menat
c317462379
fix(DX): Better formatted SQL queries from DB Query
...
Avoid unnecessary tabs, thought of using dedent but unnecessary overhead
for small stylistic benefit inside code vs. stylistic benefit in logs.
2025-05-02 11:10:05 +05:30
Ankush Menat
42f1d1b460
fix(db_query): double-escaped value ( #32376 )
2025-05-02 11:09:11 +05:30
Ankush Menat
dcb476c990
perf: cast dynamic links while filtering ( #32294 )
...
lessen impact of https://github.com/frappe/frappe/issues/32287
2025-04-25 05:43:01 +00:00
Akhil Narang
7255c5fdf2
fix(db_query): improve subquery check
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-22 11:40:09 +05:30
Akhil Narang
9cf718b8f6
fix(db_query): use re.DOTALL
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-22 11:30:29 +05:30
Henrique
d3c01452c4
fix: correct field level permissions filtering in frappe.get_list
2025-04-18 02:19:55 -03:00
Akhil Narang
ad32216040
fix: support sqlite
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-04-15 13:59:16 +05:30
Sagar Vora
6ca6e2aebd
perf: improve get_permitted_fields logic
2025-03-17 08:55:32 +05:30
Sagar Vora
628ddfd494
perf: remove repeated calls to get_permitted_fieldnames
2025-03-16 23:39:46 +05:30
Ankush Menat
3bfc9fa8da
perf: Don't update list view settings on every query ( #31743 )
...
It literally doesn't do anything ever.
User settings are explicitly updated using `user_settings.save` endpoint.
2025-03-16 05:35:39 +00:00
Ankush Menat
357b6fb11a
perf: don't parse comments just to get comment count ( #28921 )
...
This parsing isn't necessary and we are copying all of _comments just to count
how many there are.
Imagine 2500 documents w/ 1-2 auto generated comments each.
2025-03-13 05:00:21 +00:00
Akhil Narang
bada8cabcb
fix(db_query): improve regex
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-07 16:57:27 +05:30
Akhil Narang
3c01bf3d5c
fix: check properly for blacklisted function usage
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2025-03-05 14:17:39 +05:30
Ankush Menat
dd44b3dba6
perf: cast int-link field filters to string ( #31396 )
...
Comparing varchar field with ints makes indexes unusable in MariaDB.
This PR is just one small fix for DB query, similar fixes won't be made
for DB APIs which do not assume anything about database schema.
2025-02-24 10:39:55 +00:00
Ankush Menat
fdba41c682
perf: misc client cache improvements ( #29070 )
...
* perf: Reduce penalty for lack of redis connection
If redis isn't running than this client cache is slower than default
implementation because of the extra locking overhead.
* test: update perf redis counts
* perf: cache table columns in client-cache
* fix: race condition on cache-client_cache init
Rare but apparant in synthetic benchmarks.
Cache is set but client cache is still being initialized then request
will fail.
* perf: Don't run notifications when loading document
WHAT?
* fix: use cached doc to repopulate
* perf: reduce get_meta calls
2025-01-07 16:14:43 +05:30
David Arnold
75377aaaf5
refactor(typing): type filters ( #28218 )
...
* chore(typing): type filters
* chore(typing): type filters for get_list et al
* fix: dashboard chart filter expression
* test: fix case with new-style right hand object to equality check
* chore: place new typed filter under typing verification
* chore: remove debug print statment
* chore: inverse logic of type guard
* fix: add float to filter value types
* chore: clarify value naming
2024-12-04 23:18:53 +00:00
Akhil Narang
84ef6ec677
refactor: fixup with ruff 0.8.1
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-12-04 13:18:04 +05:30
Ankush Menat
820a6edae8
fix: Skip virtual fields in all select queries ( #26700 )
2024-06-06 09:43:36 +00:00
Ankush Menat
005e74b20d
perf: Avoid coalesce for between filters ( #26531 )
...
- Avoid on `between` + date
- Avoid on timestamp fields
- Avoid on `>` and `>=` comparisons
2024-05-22 09:32:59 +00:00
Akhil Narang
306c923986
chore: minor code cleanup
...
- Use walrus operator where possible
- Drop redundant checks - we anyway can't iterate over an empty list
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-04-10 17:22:45 +05:30
Revant Nandgaonkar
7e16e902d9
feat: allow wildcard for doctype in permission hooks ( #25729 )
...
* feat: allow wildcard for doctype in permission hooks
* fix: pass doctype to permission query
* fix: combine methods instead of alternate
* test: wildcard has_permssion hook
* test: wildcard has_permssion make note public
* fix: fetch list of hooks once
2024-04-10 11:44:37 +05:30
Ankush Menat
432c8cf48c
Merge pull request #25624 from ankush/creation
...
fix!: Switch to `creation` as default sort order
2024-03-27 13:25:53 +05:30
Ankush Menat
ff1f8ddbda
fix: allow any sequence container ( #25664 )
2024-03-27 06:31:15 +00:00
Ankush Menat
dbcf7ad30c
refactor: update usage of modified everywhere
2024-03-27 11:23:13 +05:30
Ankush Menat
071e269548
fix!: Switch to creation as default sort order
2024-03-27 11:18:28 +05:30
Dany Robert
6e02df7ea2
fix: ordered fields on get_list returning list ( #25663 )
...
* fix: ordered `fields` on get_list returning list
* chore: linters
2024-03-27 05:11:09 +00:00
Ankush Menat
a12fc118f4
perf: remove useless sorting on docstatus ( #25571 )
2024-03-21 06:17:23 +00:00
Ankush Menat
f642b1881f
fix: invalid select star expansions
2024-03-20 16:31:02 +05:30
Ankush Menat
065674236c
refactor: duplicate check for *
2024-03-20 12:29:58 +05:30
Ankush Menat
5eca52b2c7
fix: only trim tab if it starts with tab
2024-03-20 12:29:58 +05:30
Ankush Menat
ea193ecd48
Revert "Revert "fix: search_link fails when txt contains parentheses ( #22892 )""
...
This reverts commit c0cf13b8e8 .
2024-03-20 12:29:57 +05:30
Ankush Menat
8a7beebf30
fix: handle distinct for fieldname ( #25511 )
...
`distinct count(fieldname)` is supported well but `count(distinct fieldname)` fails if fieldname contains full field with table name included. This PR just adds basic handling for it.
Needs to be rewritten entirely in QB __some day__.
2024-03-18 13:38:29 +00:00
Ankush Menat
a28921750d
fix(DX): Avoid use of args in virtual doctype
2024-03-11 15:20:35 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
...
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748
style: re-format with ruff
2024-02-05 18:53:33 +05:30
Ankush Menat
3bea50d519
fix: Return empty result if no perm level access ( #24591 )
2024-01-29 19:48:19 +05:30
Suraj Shetty
0f4a1d8f10
fix: Handle invalid descendant filter
2024-01-19 15:49:02 +05:30