(core) Add 'user' variable to trigger formulas

Summary:
The 'user' variable has a similar API to the one from access rules: it
contains properties about a user, such as their full name and email
address, as well as optional, user-defined attributes that are populated
via user attribute tables.

Test Plan: Python unit tests.

Reviewers: alexmojaki, paulfitz, dsagal

Reviewed By: alexmojaki, dsagal

Subscribers: paulfitz, dsagal, alexmojaki

Differential Revision: https://phab.getgrist.com/D2898
This commit is contained in:
George Gevoian
2021-07-14 17:45:53 -07:00
parent 6c114ef439
commit e5eeb3ec80
16 changed files with 464 additions and 99 deletions

View File

@@ -55,8 +55,8 @@ def run(sandbox):
sandbox.register(method.__name__, wrapper)
@export
def apply_user_actions(action_reprs):
action_group = eng.apply_user_actions([useractions.from_repr(u) for u in action_reprs])
def apply_user_actions(action_reprs, user=None):
action_group = eng.apply_user_actions([useractions.from_repr(u) for u in action_reprs], user)
return eng.acl_split(action_group).to_json_obj()
@export
@@ -73,8 +73,8 @@ def run(sandbox):
return eng.acl_split(action_group).to_json_obj()
@export
def autocomplete(txt, table_id, column_id):
return eng.autocomplete(txt, table_id, column_id)
def autocomplete(txt, table_id, column_id, user):
return eng.autocomplete(txt, table_id, column_id, user)
@export
def find_col_from_values(values, n, opt_table_id):