137 |
137 |
138 |
138 |
139 def isIdDeveloper(id=None): |
139 def isIdDeveloper(id=None): |
140 """Returns True if Google Account is a Developer with special privileges. |
140 """Returns True if Google Account is a Developer with special privileges. |
141 |
141 |
|
142 using the App Engine Users API. |
|
143 |
142 Args: |
144 Args: |
143 id: a Google Account (users.User) object; if id is not supplied, |
145 id: a Google Account (users.User) object; if id is not supplied, |
144 the current logged-in user is checked using the App Engine Users API. |
146 the current logged-in user is checked |
145 THIS ARGUMENT IS CURRENTLY IGNORED AND ONLY THE CURRENTLY LOGGED-IN |
147 """ |
146 USER IS CHECKED! |
148 id = getIdIfMissing(id) |
147 |
149 |
148 See the TODO in the code below... |
|
149 """ |
|
150 if not id: |
150 if not id: |
151 return users.is_current_user_admin() |
151 # no Google Account was supplied or is logged in, so an unspecified |
152 |
152 # User is definitely *not* a Developer |
153 # TODO(tlarsen): this Google App Engine function only checks the currently |
153 return False |
154 # logged in user. There needs to be another way to do this, such as a |
154 |
155 # field in the User Model... |
155 if id == users.get_current_user(): |
156 return users.is_current_user_admin() |
156 if users.is_current_user_admin(): |
|
157 # supplied id is current logged-in user, and that user is in the |
|
158 # Administration->Developers list in the App Engine console |
|
159 return True |
|
160 |
|
161 user = getUserFromId(id) |
|
162 |
|
163 if not user: |
|
164 # no User entity for this Google Account, and id is not the currently |
|
165 # logged-in user, so there is no conclusive way to check the |
|
166 # Administration->Developers list in the App Engine console |
|
167 return False |
|
168 |
|
169 return user.is_developer |
157 |
170 |
158 |
171 |
159 LINKNAME_PATTERN = r'''(?x) |
172 LINKNAME_PATTERN = r'''(?x) |
160 ^ |
173 ^ |
161 [0-9a-z] # start with ASCII digit or lowercase |
174 [0-9a-z] # start with ASCII digit or lowercase |