mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Adding new column in users table "ref" with unique identifier.
Summary: There is a new column in users table called ref (user reference). It holds user's unique reference number that can be used for features that require some kind of ownership logic (like comments). Test Plan: Updated tests Reviewers: georgegevoian, paulfitz Reviewed By: georgegevoian, paulfitz Differential Revision: https://phab.getgrist.com/D3641
This commit is contained in:
@@ -10,6 +10,7 @@ class TestCompletion(test_engine.EngineTestCase):
|
||||
user = {
|
||||
'Name': 'Foo',
|
||||
'UserID': 1,
|
||||
'UserRef': '1',
|
||||
'StudentInfo': ['Students', 1],
|
||||
'LinkKey': {},
|
||||
'Origin': None,
|
||||
@@ -103,6 +104,7 @@ class TestCompletion(test_engine.EngineTestCase):
|
||||
('user.SessionID', "'u1'"),
|
||||
('user.StudentInfo', 'Students[1]'),
|
||||
('user.UserID', '1'),
|
||||
('user.UserRef', "'1'"),
|
||||
]
|
||||
)
|
||||
# Should follow user attribute references and autocomplete those types.
|
||||
@@ -130,6 +132,7 @@ class TestCompletion(test_engine.EngineTestCase):
|
||||
'Email': 'baro@example.com',
|
||||
'LinkKey': {},
|
||||
'UserID': 2,
|
||||
'UserRef': '2',
|
||||
'Access': 'owners',
|
||||
'SessionID': 'u2',
|
||||
'IsLoggedIn': True
|
||||
@@ -145,6 +148,7 @@ class TestCompletion(test_engine.EngineTestCase):
|
||||
('user.Origin', 'None'),
|
||||
('user.SessionID', "'u2'"),
|
||||
('user.UserID', '2'),
|
||||
('user.UserRef', "'2'"),
|
||||
]
|
||||
)
|
||||
self.assertEqual(
|
||||
|
||||
@@ -323,6 +323,7 @@ class TestRenames(test_engine.EngineTestCase):
|
||||
user = {
|
||||
'Name': 'Foo',
|
||||
'UserID': 1,
|
||||
'UserRef': '1',
|
||||
'LinkKey': {},
|
||||
'Origin': None,
|
||||
'Email': 'foo@example.com',
|
||||
|
||||
@@ -565,6 +565,7 @@ class TestTriggerFormulas(test_engine.EngineTestCase):
|
||||
user1 = {
|
||||
'Name': 'Foo Bar',
|
||||
'UserID': 1,
|
||||
'UserRef': '1',
|
||||
'StudentInfo': ['Students', 1],
|
||||
'LinkKey': {},
|
||||
'Origin': None,
|
||||
@@ -576,6 +577,7 @@ class TestTriggerFormulas(test_engine.EngineTestCase):
|
||||
user2 = {
|
||||
'Name': 'Baz Qux',
|
||||
'UserID': 2,
|
||||
'UserRef': '2',
|
||||
'StudentInfo': ['Students', 1],
|
||||
'LinkKey': {},
|
||||
'Origin': None,
|
||||
|
||||
@@ -14,6 +14,7 @@ class TestUser(test_engine.EngineTestCase):
|
||||
'Name': 'Foo Bar',
|
||||
'Email': 'email@example.com',
|
||||
'UserID': 1,
|
||||
'UserRef': '1',
|
||||
'LinkKey': {
|
||||
'Param1': 'Param1Value',
|
||||
'Param2': 'Param2Value'
|
||||
@@ -42,6 +43,7 @@ class TestUser(test_engine.EngineTestCase):
|
||||
'Name': None,
|
||||
'Email': 'email@getgrist.com',
|
||||
'UserID': 1,
|
||||
'UserRef': '1',
|
||||
'LinkKey': {
|
||||
'Param1': 'Param1Value',
|
||||
'Param2': 'Param2Value'
|
||||
|
||||
@@ -13,6 +13,7 @@ the following fields:
|
||||
|
||||
- Access: string or None
|
||||
- UserID: integer or None
|
||||
- UserRef: string or None
|
||||
- Email: string or None
|
||||
- Name: string or None
|
||||
- Origin: string or None
|
||||
@@ -43,7 +44,7 @@ class User(object):
|
||||
"""
|
||||
def __init__(self, data, tables, is_sample=False):
|
||||
for attr in ('Access', 'UserID', 'Email', 'Name', 'Origin', 'SessionID',
|
||||
'IsLoggedIn'):
|
||||
'IsLoggedIn', 'UserRef'):
|
||||
setattr(self, attr, data[attr])
|
||||
|
||||
self.LinkKey = LinkKey(data['LinkKey'])
|
||||
|
||||
Reference in New Issue
Block a user