equal
deleted
inserted
replaced
33 |
33 |
34 account = users.get_current_user() |
34 account = users.get_current_user() |
35 return normalizeAccount(account) if (account and normalize) else account |
35 return normalizeAccount(account) if (account and normalize) else account |
36 |
36 |
37 |
37 |
|
38 def getCurrentUserId(): |
|
39 """Returns a unique id of the current user. |
|
40 """ |
|
41 |
|
42 return users.get_current_user().user_id() |
|
43 |
|
44 |
38 def normalizeAccount(account): |
45 def normalizeAccount(account): |
39 """Returns a normalized version of the specified account. |
46 """Returns a normalized version of the specified account. |
40 """ |
47 """ |
41 |
48 |
42 normalized = str(account).lower() |
49 normalized = str(account).lower() |
43 |
50 |
44 if account.email() == normalized: |
51 if account.email() == normalized: |
45 return account |
52 return account |
46 |
53 |
47 return users.User(email=normalized) |
54 return users.User(email=normalized) |
|
55 |
48 |
56 |
49 def denormalizeAccount(account): |
57 def denormalizeAccount(account): |
50 """Returns a denormalized version of the specified account. |
58 """Returns a denormalized version of the specified account. |
51 """ |
59 """ |
52 |
60 |
55 |
63 |
56 domain = account.auth_domain() |
64 domain = account.auth_domain() |
57 denormalized = ''.join([account.email(), '@', domain]) |
65 denormalized = ''.join([account.email(), '@', domain]) |
58 |
66 |
59 return users.User(email=denormalized) |
67 return users.User(email=denormalized) |
|
68 |
60 |
69 |
61 def isDeveloper(account=None): |
70 def isDeveloper(account=None): |
62 """Returns True if a Google Account is a Developer with special privileges. |
71 """Returns True if a Google Account is a Developer with special privileges. |
63 |
72 |
64 Since it only works on the current logged-in user, if account matches the |
73 Since it only works on the current logged-in user, if account matches the |