Commit graph

11 commits

Author SHA1 Message Date
Raffael Meyer
9208b58b6f
refactor: use doc.check_permission (#28317)
* refactor: use `doc.check_permission`

* refactor(delete_doc): check_permission_and_not_submitted
2024-11-22 10:41:24 +01:00
Ankush Menat
10ace97ebb fix: backward compatiblity for method calls in v1
Preserves complete path just like before. This broke oauth as oauth code
was expecting 4th part in path even though it's never been supported in
API methods
2023-10-16 18:12:53 +05:30
Ankush Menat
825692128f chore: separate out v1 and v2
Any common utils end up becoming a problem, duplicating code here is
better than coupling potentially breaking behaviour
2023-10-16 18:12:53 +05:30
Ankush Menat
275f16060a fix: route ambiguitities and / in name
v1 and v2:
- Use path convertor to consume entire document which MIGHT contain `/`
- Drop string convertor, as it's the default
- Dont merge slashes - avoid consuming something that's part of name

v2:
- `SI/BLAH/BLAH/submit` is not simple to parse without ambiguitity
- `SI/BLAH/BLAH/method/submit` removes ambiguitity for 99.99% cases.
2023-10-16 18:12:53 +05:30
Ankush Menat
627b777a9c refactor!: manual creation of response
This contains minor breaking change where `delete` API call now returns `OK` in `data` key instead of `message`.
2023-10-16 18:12:53 +05:30
Ankush Menat
b57ca948ab refactor: common API methods to utils 2023-10-16 18:12:53 +05:30
Ankush Menat
8ce6426c75 refactor: Drop frappe.local for proxies 2023-10-16 18:12:53 +05:30
Ankush Menat
f9e120c104 refactor: remove unnessary manual commits 2023-10-16 18:12:53 +05:30
Ankush Menat
b064d12440 feat: Shorthand for whitelisted function call in controllers
```diff
- GET /api/method/frappe.core.doctype.user.user.get_timezones
+ GET /api/method/User/get_timezones
```
2023-10-16 18:12:53 +05:30
Ankush Menat
1b51914a83 refactor: create two API versions 2023-10-16 18:12:53 +05:30
Ankush Menat
5af6624cce refactor: Use werkzeug router for API routing 2023-10-16 18:12:53 +05:30