Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass reference_doctype to search query methods #20842

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

ankush
Copy link
Member

@ankush ankush commented Apr 25, 2023

Isssue: If you create user permissions with "applicable_for" it's supposed to apply those UP to queries when link field is getting queries, however, the reference doctype isn't passed at all to custom queries so there's no way for them to know where it's being linked.

refer:

  • # for contextual user permission check
    # to determine which user permission is applicable on link field of specific doctype
    self.reference_doctype = reference_doctype or self.doctype
  • # append docs based on user permission applicable on reference doctype
    # this is useful when getting list of docs from a link field
    # in this case parent doctype of the link
    # will be the reference doctype
    elif df.get("fieldname") == "name" and self.reference_doctype:
    if permission.get("applicable_for") == self.reference_doctype:
    docs.append(permission.get("doc"))

Fix: pass reference_doctype to queries. frappe.call ensures that it's only passed to functions which can accept it, so nothing to worry about ~ backward compatible change.

dependent PR: frappe/erpnext#35038

ref: ISS-23-24-00271

frappe.call ensures that it's only passed to functions which can accept
it, so nothing to worry about ~ backward compatible change.
@ankush ankush requested review from a team and phot0n and removed request for a team April 25, 2023 12:39
@codecov
Copy link

codecov bot commented Apr 25, 2023

Codecov Report

Merging #20842 (a41c5bd) into develop (e6279e0) will decrease coverage by 0.01%.
The diff coverage is n/a.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #20842      +/-   ##
===========================================
- Coverage    63.95%   63.95%   -0.01%     
===========================================
  Files          759      759              
  Lines        68789    68789              
  Branches      6219     6219              
===========================================
- Hits         43997    43993       -4     
- Misses       21275    21279       +4     
  Partials      3517     3517              
Flag Coverage Δ
server 68.90% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ankush ankush merged commit 109a549 into frappe:develop Apr 25, 2023
19 checks passed
@ankush ankush deleted the pass_reference_document branch April 25, 2023 13:01
@ankush ankush added the backport version-14-hotfix backport to version 14 label Apr 25, 2023
mergify bot pushed a commit that referenced this pull request Apr 25, 2023
frappe.call ensures that it's only passed to functions which can accept
it, so nothing to worry about ~ backward compatible change.

(cherry picked from commit 109a549)
ankush added a commit that referenced this pull request Apr 25, 2023
frappe.call ensures that it's only passed to functions which can accept
it, so nothing to worry about ~ backward compatible change.

(cherry picked from commit 109a549)

Co-authored-by: Ankush Menat <ankush@frappe.io>
frappe-pr-bot pushed a commit that referenced this pull request May 2, 2023
# [14.35.0](v14.34.0...v14.35.0) (2023-05-02)

### Bug Fixes

* check for @ in email string in get_emails ([#20759](#20759)) ([961097f](961097f))
* multiple assignments to the same person (backport [#20822](#20822)) ([#20868](#20868)) ([07d29c3](07d29c3))
* only call RQ synchronously as fallback during migration ([dc01b48](dc01b48))
* pass parent document type for number card ([#20857](#20857)) ([#20858](#20858)) ([e1f4e5f](e1f4e5f))
* pass reference_doctype to search query methods ([#20842](#20842)) ([#20843](#20843)) ([f8ec758](f8ec758))
* removed footer ([88e23ea](88e23ea))
* removed logo implementation ([1ce79e3](1ce79e3))
* renamed login without password to passwordless login ([43b67ee](43b67ee))
* suggested changes and added passwordless_login_expiry option ([a19b1ce](a19b1ce))
* type checking ([ee49d4c](ee49d4c))
* typeerror while marking communication as read ([#20830](#20830)) ([1798c1c](1798c1c))
* **workflow:** add whitelisted functions permissions checks (backport [#20575](#20575)) ([#20847](#20847)) ([082fed5](082fed5))

### Features

* Login without password (through link sent on email) ([d87345a](d87345a))
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport version-14-hotfix backport to version 14
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant