seitime-frappe/frappe
Elton Lobo 6d1008933f
feat: add user invitation doctype & related public methods (#33308)
* feat: add user invitation doctype & related public methods

* style(user-invitation): execute formatters & add semgrep comments

* refactor(user-invitation): use `is` to compare `None` values

* fix(user-invitation): skip fetching `after_accept` for default app

* fix(user-invitation): translate email templates

* fix(user-invitaton): return pending invites from invite by email api

* refactor(user-invitation): improve code quality

* fix(user-invitation): translate all error messages

* refactor(user-invitation): improve security & readability

Improvements:
- move invite expiration check to `daily_maintenance`
- explicitly import all of the used packages
- specify methods for all security-critical endpoints
- improve error messages and give them suitable titles
- remove unnecessary utility functions
- make invitation key management secure
- translate all of the subjects of the sent emails
- use the `app_title` hook to create email titles
- commit the work done after each iteration of the background invitation
  expiry checker
- restructure code to improve readability
- use `user.reset_password` to generate the target link
- use clear long names to name identifiers
- add document states with relevant colors (User Invitation doctype)
- differ `sendmail` emails whenever possible
- send an email to the invitation creator instead of the invitee after
  the invite has expired
- remove `User Invitation Manager` role

* fix(user-invitation): use valid emails to test doctype & related code

* feat(user-invitation): support adding multiple roles

* refactor(user-invitation): mark relevant fields `set only once`

* feat(user-invitation): add `Cancelled` status

* test(user-invitation): correct broken tests

* test(user-invitation): form valid f-strings & run code formatter

* feat(user-invitation): make doctype usable from desk

* fix(user-invitation): remove delete permission from invitation doctype

* feat(user-invitation): pass user inserted info to `after_accept` hook

* refactor(user-invitation): improve custom action methods & errors

Improvements:
- trigger actions only when the invitation is in the `Pending` state
- use lowercase letters to start error messages
- handle cases where `user_invitation_hook` is not defined

* refactor(user-invitation): remove site name from email templates

* docs(user-invitation): add internal documentation

* feat(user-invitation): add 'get pending' & cancel invites apis

* fix(user-invitation): make invitation app specific

* refactor(user-invitation): avoid mixing function programming

* fix(user-invitation): make apis usable for app specific valid users

* fix(user-invitation): allow app specific invites

* feat(user-invitation): make list view & permission checks app specific

* refactor(user-invitation): convert class methods to static when possible

* feat(user-invitation): add `app_only_for` method to the doc

* fix(user-invitation): f-string syntax error in `get_permission_query_conditions`

* docs(user-invitation): add examples & improve the internal doc

* refactor: rename method name

static_ is unnecessary
only_for doesn't make sense in this context when arguments are not roles

* fix: Support POST request too

We dont follow REST semantics 100%, anything that modifies something
should ideally be doable with POST too.

* chore: cap

* fix: Avoid ignore_permissions as user arg

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2025-07-28 16:25:53 +05:30
..
api feat(api/v2): set name if passed when creating document 2025-07-03 17:52:25 +05:30
automation fix: tools workspace 2025-06-27 11:41:33 +05:30
change_log
commands Merge pull request #33003 from ruthra-kumar/lightmode_on_parallel_test_runner 2025-06-23 16:05:57 +05:30
contacts chore: Drop empty UnitTestCases (#32867) 2025-06-10 05:28:53 +00:00
core feat: add user invitation doctype & related public methods (#33308) 2025-07-28 16:25:53 +05:30
custom chore: Drop empty UnitTestCases (#32867) 2025-06-10 05:28:53 +00:00
data
database feat: Database SSL one way support (#33044) 2025-07-16 06:36:19 +00:00
desk refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
email refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
geo fix: add Serbian (Latin) language (#32931) 2025-06-13 18:38:04 +02:00
gettext feat: Add extraction for quick_list labels in workspace (#33304) 2025-07-14 19:43:56 +02:00
integrations refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
locale fix: Persian translations 2025-07-27 04:06:20 +05:30
model fix: make labels in error message translatable (#33166) 2025-07-23 18:11:51 +05:30
modules fix: Commit before starting a patch (#33133) 2025-06-27 11:21:28 +05:30
patches refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
printing fix: minor fix and adds validation 2025-07-02 12:12:04 +05:30
public refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
query_builder perf: minor improvements to execute_query 2025-05-30 11:24:52 +05:30
search refactor: change filter from tuple to dict 2024-11-26 11:38:15 +05:30
templates feat: add user invitation doctype & related public methods (#33308) 2025-07-28 16:25:53 +05:30
testing refactor: remove duplicate call to start test 2025-07-09 15:05:08 +05:30
tests refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
types Revert: DocRef (#32866) 2025-06-10 05:20:56 +00:00
utils Merge pull request #33437 from vehbiu/develop 2025-07-28 15:43:37 +05:30
website refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
workflow feat: global frappe.in_test flag (#32960) 2025-06-17 19:19:31 +05:30
www refactor: seperate blogs into a seperate app (#32737) 2025-07-28 14:35:02 +05:30
__init__.py Merge pull request #33103 from GoravG/feat/desk_link_in_new_tab 2025-07-15 13:41:33 +05:30
_optimizations.py Revert "fix: Pin web workers by default (#31739)" (#32852) 2025-06-09 09:52:23 +00:00
app.py fix: add hooks to handle cors 2025-07-04 13:18:43 +05:30
apps.py refactor: track completed app setup wizards and re-run the setup wizard upon new app installation. (#32640) 2025-06-03 12:36:22 +05:30
auth.py fix: prevent logout due to empty "Password" field (#29158) 2025-07-28 10:04:10 +05:30
boot.py fix: bootinfo issue (#33065) 2025-06-25 11:16:29 +05:30
build.py chore: use frappe._dev_server instead of local.dev_server 2025-06-17 12:03:08 +05:30
cache_manager.py refactor: avoid code duplication 2025-06-11 09:55:36 +05:30
client.py perf: Use lazy doc in a lot more places 2025-06-11 09:55:45 +05:30
config.py feat: init sqlite 2025-04-15 13:59:16 +05:30
coverage.py ci: make gh actions functions (#28299) 2024-10-27 02:09:02 +00:00
defaults.py perf: client-cache for defaults 2025-01-07 12:51:10 +05:30
deferred_insert.py fix: Commit frequently in deferred_insert 2025-06-13 11:34:18 +05:30
deprecation_dumpster.py perf: faster gzip compression (#33014) 2025-06-19 12:52:58 +00:00
exceptions.py fix: Implement backpressure for background jobs 2025-03-05 10:59:00 +05:30
frappeclient.py fix: add order_by params to Frappeclient get_list (#33324) 2025-07-21 19:23:32 +05:30
handler.py perf: Use lazy doc in a lot more places 2025-06-11 09:55:45 +05:30
hooks.py feat: add user invitation doctype & related public methods (#33308) 2025-07-28 16:25:53 +05:30
installer.py Merge pull request #33262 from akhilnarang/fix-reinstall-lock 2025-07-10 11:10:23 +05:30
locale.py feat: cache documents in client cache 2025-01-14 14:33:10 +05:30
middlewares.py
migrate.py fix: remove explicit call to add migration_hash column 2025-06-26 14:30:40 +05:30
modules.txt fix: remove energy points / social module 2025-04-17 00:26:57 +05:30
monitor.py fix: avoid flushing to monitor logs concurrently (#32552) 2025-05-16 12:20:40 +00:00
oauth.py perf: Skip link checking on internal deletes 2025-01-06 11:48:19 +05:30
onboarding.py fix: added get_onboarding_status api 2025-03-18 18:06:30 +05:30
parallel_test_runner.py refactor: introduce lightmode in parallel test runner 2025-06-19 11:40:09 +05:30
patches.txt fix: setup wizard issue 2025-07-01 18:05:36 +05:30
permissions.py perf: get ancestors only if needed 2025-06-24 11:58:55 +05:30
push_notification.py fix(push_notification): use cstr to convert a None body to empty string (#32056) 2025-04-10 12:47:30 +05:30
rate_limiter.py fix: Round of rate limit to seconds (#31674) 2025-03-12 10:52:42 +00:00
realtime.py fix: frappe.local has not _realtime_log (#33236) 2025-07-07 11:06:04 +05:30
recorder.py feat: remove strip_dirs in Recorder python cProcfile (#33300) 2025-07-15 17:51:44 +05:30
sessions.py fix: Remember session creation (#33082) 2025-06-25 05:45:57 +00:00
share.py perf: Use lazy doc in a lot more places 2025-06-11 09:55:45 +05:30
test_runner.py refactor: organize test contextmanagers (#28041) 2024-10-09 02:09:19 +02:00
translate.py fix: remove utils file and typo 2025-06-17 18:39:21 +05:30
twofactor.py chore(twofactor): specify key to display during decryption failures 2024-09-16 13:00:38 +05:30