Esempio n. 1
0
def AuthTokenToProto(record, full=False):
  ret = AttrDict()
  ret.id = record.seqn
  ret.auth_device = record.auth_device
  ret.token_value = record.token_value
  if record.user:
    ret.username = str(record.user.username)
  else:
    ret.username = None
  ret.nice_name = record.nice_name
  if full:
    ret.enabled = record.enabled
    ret.created_time = record.created
    if record.expires:
      ret.expire_time = record.expires
    if record.pin:
      ret.pin = record.pin
  return ret
Esempio n. 2
0
def UserToProto(user, full=False):
  ret = AttrDict()
  ret.username = user.username
  ret.mugshot_url = user.get_profile().MugshotUrl()
  ret.is_active = user.is_active
  if full:
    ret.first_name = user.first_name
    ret.last_name = user.last_name
    ret.email = user.email
    ret.password = user.password
    ret.is_staff = user.is_staff
    ret.is_active = user.is_active
    ret.is_superuser = user.is_superuser
    ret.last_login = user.last_login
    ret.date_joined = user.date_joined
  return ret
Esempio n. 3
0
def UserProfileToProto(record, full=False):
  ret = AttrDict()
  ret.username = record.user.username
  ret.gender = record.gender
  ret.weight = record.weight
  return ret