MCPcopy Index your code
hub / github.com/diffgram/diffgram / User

Class User

shared/database/user.py:9–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7from shared.data_tools_core import data_tools
8
9class User(Base):
10 __tablename__ = 'userbase'
11
12
13 id = Column(Integer, primary_key = True)
14
15 member_id = Column(Integer, ForeignKey('member.id'))
16 member = relationship('Member', foreign_keys = "Member.user_id", uselist = False)
17
18 qos_last_cached_value = Column(Float) # Quality of service, most recent
19
20 first_name = Column(String(100))
21 last_name = Column(String(100))
22
23 occupation_list = Column((ARRAY(String)))
24 linkedin_profile_url = Column(String())
25
26 how_hear_about_us = Column(String())
27
28 company_name = Column(String())
29
30 security_disable_global = Column(Boolean) # If True, Disable user login completely
31 security_email_verified = Column(Boolean) # If True, email is
32
33 api_actions = Column(Boolean, default = False)
34
35 api_enabled_builder_brain = Column(Boolean)
36 api_enabled_builder = Column(Boolean) # Computer vision suite
37 api_enabled_trainer = Column(Boolean) # Annotation
38
39 # A user can have both in theory,
40 # so we say last in case they change modes
41 last_builder_or_trainer_mode = Column(String) # ["builder", "trainer"]
42
43 phone_number = Column(String)
44 city = Column(String) # Until we get proper address collection setup
45
46 # Should a user have a generic hash we can reference them by
47 # And should this be the username until the user picks one?
48 username = Column(String())
49
50 email = Column(String(100), nullable = False) # email is key
51 password_hash = Column(String())
52
53 # TODO rename to "attempt_count" in light of magic email thing?
54 password_attempt_count = Column(Integer, default = 0)
55
56 auto_commit = Column(Boolean, default = True)
57
58 otp_secret = Column(String())
59 otp_enabled = Column(Boolean)
60 otp_backup = Column(MutableDict.as_mutable(JSONEncodedDict),
61 default = {}) # code : redeemed_or_not
62 otp_current_session = Column(String())
63 otp_current_session_expiry = Column(Integer)
64
65 # TODO add otp_remember_browser (/ip?) and otp_recovery?
66

Callers 3

register_userFunction · 0.90
create_userFunction · 0.90
user_new_coreFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected