Commit graph

303 commits

Author SHA1 Message Date
Gavin D'souza
0f71dd411b style: DatabaseQuery.execute's permission cond block 2021-12-24 14:01:26 +05:30
Gavin D'souza
33b7d7d74f fix: Handle custom child tables via check_parent_permission
Check `tabCustom Field` and `tabDocfield` for matching parent existence.
2021-12-24 13:28:40 +05:30
Aradhya
0ea0f7dfa3 fix: fixed default ordering in execute 2021-11-25 16:39:44 +05:30
Aradhya
30278a3939 refactor: removed no_order to support order_by None as valid input 2021-11-23 13:29:59 +05:30
Aradhya
ae59fd7c58 feat: added no_order to execute 2021-11-19 22:58:32 +05:30
Gavin D'souza
ccb53c0f5b fix: If column comparision is done, dont check for ifnull/coalesce 2021-10-29 14:19:28 +05:30
Gavin D'souza
9bf043eddf fix(db_query): Change fallback to min datetime 2021-10-29 13:24:28 +05:30
Gavin D'souza
9be8a0895d Merge branch 'develop' into between-formatting 2021-10-29 13:13:55 +05:30
Suraj Shetty
9189c62437 fix: Pass parent_doctype while checking permission for child_table in db_query 2021-10-27 13:52:34 +05:30
Suraj Shetty
64822df6ff
Merge branch 'develop' into fix-has-permission-for-child-doc 2021-10-27 13:07:44 +05:30
Suraj Shetty
0f98b4d174 fix: Make parent_doctype mandatory while accessing child doctype 2021-10-27 12:59:42 +05:30
Aradhya-Tripathi
94f2a6e275 feat: Added run kwarg to get_all, get_values 2021-10-23 15:08:02 +05:30
Mohammad Hasnain
08ac2eda0a Merge branch 'develop' into between-formatting 2021-10-20 19:37:43 +05:30
Mohammad Hasnain
d7b7afeb14 fix: format between for creation/ modified 2021-10-19 16:18:21 +05:30
Sagar Vora
5c86dc80c7
fix: if_owner constraint being applied wrongly (#14471)
* fix: `if_owner` constraint being applied wrongly

* test: check if owner on `frappe.get_list`

Co-authored-by: Pruthvi Patel <pruthvipatel145@gmail.com>
2021-10-19 15:03:17 +05:30
Gavin D'souza
09557ab8c7 fix(db_query): Add fallback value irrespective of operator 2021-09-16 15:22:37 +05:30
Gavin D'souza
6973a34828 Merge branch 'develop' into compare-columns-db_query 2021-09-16 11:40:33 +05:30
Gavin D'souza
ad5783b1c3 fix: Use PyPika's Column
also, Discard Data class. Since we're adding support for PyPika objects
to natively interact with the Frappe ORM, this PR brings us closer
toward that direction.
2021-09-16 11:38:23 +05:30
Gavin D'souza
ab7dee13cf chore: Added return type for DatabaseQuery.execute 2021-09-06 19:44:25 +05:30
Gavin D'souza
9f4f096bf1 Merge branch 'develop' into compare-columns-db_query 2021-09-06 11:38:55 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Gavin D'souza
77895bbcfc feat: Support for Column comparison in DatabaseQuery 2021-08-03 12:43:01 +05:30
Gavin D'souza
ffb2aceb43 fix: Logical bug in DatabaseQuery.extract_tables
Introduced via 888aa8ad84
2021-06-15 12:50:29 +05:30
Gavin D'souza
1b6c41cbfc fix: Don't re-define pluck bug
Introduced via 974bf463df
2021-06-11 19:44:22 +05:30
Gavin D'souza
f92c5d9898 refactor: Unnecessary/illogical check
because cint(False) gives 0
2021-06-11 19:34:34 +05:30
Gavin D'souza
888aa8ad84 refactor(minor): DatabaseQuery.extract_tables 2021-06-11 19:34:24 +05:30
Gavin D'souza
ee75fb38cc style: Restructured if blocks in db_query 2021-06-11 19:34:16 +05:30
Gavin D'souza
974bf463df refactor: Simplify string representations
* Simplify existing %s, .format representations to f-string
* Simplify logic
* Remove redundant tokens
2021-06-11 19:34:00 +05:30
Gavin D'souza
c489846547 Merge branch 'develop' into unnecessary_comprehensions 2021-06-11 19:30:23 +05:30
Brian Pond
d8113698d1
bug: db_query.py
The object 'meta' does not always have the attribute 'is_submittable.'
This extra syntax checks for existence first.
2021-06-07 16:15:59 -07:00
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Ankush Menat
4754ab71d1
perf(minor): remove unnecessary comprehensions
- remove several unnecessary comprehensions from functions that accept a generator.
- Using `[x for x in iter]` causes a list to be built first then passed to the outer function.
- `any` and `all` can take generator instead. This makes memory usage O(1) and actually makes these functions short-circuiting. E.g. if the first condition fails then `all` will immediately return false instead of evaluating all the entries.
- `sum`, `min`, `max` => memory usage become O(1)
- `list`, `set`, `.join()` => roughly halves memory usage, as list is not required to be built.
- lastly, it's two fewer characters to read/think about.
2021-05-12 20:38:18 +05:30
leela
72ca7e9753 refactor: remove six dependency 2021-05-07 07:42:04 +05:30
Deepesh Garg
8460ca851f fix: filter list view based on owner 2021-04-03 16:12:26 +05:30
Rushabh Mehta
2248c6c410 fix(minor): lockdown frappe.client.get_list 2021-03-30 11:25:40 +05:30
Rushabh Mehta
c9b367933a fix(minor): make group_by validation tighter 2021-03-29 23:16:33 +05:30
Rushabh Mehta
a2ffea53f2 fix(refactor): lockdown frappe.desk.reportview 2021-03-29 21:44:08 +05:30
prssanna
94db4b6c3d Merge branch 'develop' of https://github.com/frappe/frappe into rebrand-ui 2021-02-01 20:41:34 +05:30
Saurabh
d120ca7f9e
fix: validate user perms if user has select perm (#12289) 2021-02-01 17:43:24 +05:30
Suraj Shetty
b94d5778a8 Merge branch 'develop' of https://github.com/frappe/frappe into rebrand-ui 2021-01-19 10:36:50 +05:30
Saurabh
97b693c6b0
feat: Added permission to grant only Select access to document (#12063)
* feat: add permtype 'select' to DocPerm and CustomDocPerm

* feat: add 'select' perm in rights tupple

* feat: provisions to handle select permission

* feat: toggle href based on permissions

* feat: pass permission type explicitly while validating link in permission check

* fix: sider

* feat: added test cases to validate select perm

* feat: add method frappe.only_has_select_perm to explicitly check the select perm

* fix: if user only has select perm then do not show anchor tag for link fields

* fix: sider
2020-12-29 16:58:28 +05:30
Rushabh Mehta
40025e2a70 fix(minor): fix login style and routing for calendar, navbar 2020-12-14 22:35:08 +05:30
Faris Ansari
9ac14fb5ab feat: Permission Query script type
Add dynamic conditions in where clause of get_list query
2020-12-03 23:26:34 +05:30
Rushabh Mehta
97191f90af fix(minor): dont run a query when table is missing 2020-10-27 23:02:11 +05:30
Rushabh Mehta
69d2c10736 fix(minor): db_query (ignore_ddl) 2020-10-26 10:02:04 +05:30
Rushabh Mehta
742605542c fix(minor): added ignore_ddl in frappe.db.get_all to ignore missing tables, columns 2020-10-26 10:02:04 +05:30
Gavin D'souza
cf1b01fb5e fix: Remove partial support for distinct keyword
* Added supporting sql functions and distinct kw in TODO
2020-10-12 15:34:48 +05:30
Gavin D'souza
b00a389cfd fix: Add provision for quotes in DatabaseQuery.prepare_args 2020-10-09 19:40:45 +05:30
marination
d39216b273 fix: Select only last 3 args 2020-10-07 15:46:39 +05:30
Aditya Hase
e6c16f3184
fix(db_query): Allow plucking a field without having to add it to the fields list
e.g.

frappe.get_all("ToDo", pluck="owner")

Didn't work before, instead

frappe.get_all("ToDo", fields=["owner"], pluck="owner")

was needed
2020-10-06 18:32:43 +05:30