equal
deleted
inserted
replaced
259 'role': 'a Program Administrator '} |
259 'role': 'a Program Administrator '} |
260 |
260 |
261 raise out_of_band.LoginRequest(message_fmt=login_message_fmt) |
261 raise out_of_band.LoginRequest(message_fmt=login_message_fmt) |
262 |
262 |
263 |
263 |
|
264 def checkIsClubAdminForClub(request): |
|
265 """Returns an alternate HTTP response if Google Account has no Club Admin |
|
266 entity for the specified club. |
|
267 |
|
268 Args: |
|
269 request: a Django HTTP request |
|
270 |
|
271 Raises: |
|
272 AccessViolationResponse: if the required authorization is not met |
|
273 |
|
274 Returns: |
|
275 None if Club Admin exists for the specified club, or a subclass of |
|
276 django.http.HttpResponse which contains the alternate response |
|
277 should be returned by the calling view. |
|
278 """ |
|
279 |
|
280 try: |
|
281 # if the current user is invited to create a host profile we allow access |
|
282 checkIsDeveloper(request) |
|
283 return |
|
284 except out_of_band.Error: |
|
285 pass |
|
286 |
|
287 checkIsUser(request) |
|
288 |
|
289 # TODO(srabbelier) implement this |
|
290 |
|
291 login_message_fmt = DEF_DEV_LOGOUT_LOGIN_MSG_FMT % { |
|
292 'role': 'a Club Admin for this Club'} |
|
293 |
|
294 raise out_of_band.LoginRequest(message_fmt=login_message_fmt) |
|
295 |
|
296 |
264 def checkIsInvited(request): |
297 def checkIsInvited(request): |
265 """Returns an alternate HTTP response if Google Account has no Host entity |
298 """Returns an alternate HTTP response if Google Account has no Host entity |
266 for the specified program. |
299 for the specified program. |
267 |
300 |
268 Args: |
301 Args: |
319 if request: |
352 if request: |
320 return |
353 return |
321 |
354 |
322 raise out_of_band.LoginRequest(message_fmt=login_message_fmt) |
355 raise out_of_band.LoginRequest(message_fmt=login_message_fmt) |
323 |
356 |
324 def checkIsApplied(request): |
357 |
|
358 def checkIsClubAppAccepted(request): |
325 """Returns an alternate HTTP response if Google Account has no Club App |
359 """Returns an alternate HTTP response if Google Account has no Club App |
326 entity for the specified Club. |
360 entity for the specified Club. |
327 |
361 |
328 Args: |
362 Args: |
329 request: a Django HTTP request |
363 request: a Django HTTP request |
335 None if Club App exists for the specified program, or a subclass |
369 None if Club App exists for the specified program, or a subclass |
336 of django.http.HttpResponse which contains the alternate response |
370 of django.http.HttpResponse which contains the alternate response |
337 should be returned by the calling view. |
371 should be returned by the calling view. |
338 """ |
372 """ |
339 |
373 |
340 #TODO(srabbelier): implement this |
374 try: |
341 pass |
375 # if the current user is a developer we allow access |
|
376 checkIsDeveloper(request) |
|
377 return |
|
378 except out_of_band.Error: |
|
379 pass |
|
380 |
|
381 checkIsUser(request) |
|
382 |
|
383 user = user_logic.logic.getForCurrentAccount() |
|
384 |
|
385 properties = { |
|
386 'applicant': user, |
|
387 'reviewed': True, |
|
388 'accepted': True, |
|
389 'application_completed': False, |
|
390 } |
|
391 |
|
392 group_app = group_app_logic.logic.getForFields(properties, unique=True) |
|
393 |
|
394 if group_app: |
|
395 return |
|
396 |
|
397 # TODO(srabbelier) Make this give a proper error message |
|
398 deny(request) |
|
399 |
342 |
400 |
343 def checkIsMyNotification(request): |
401 def checkIsMyNotification(request): |
344 """Returns an alternate HTTP response if this request is for a Notification belonging |
402 """Returns an alternate HTTP response if this request is for a Notification belonging |
345 to the current user. |
403 to the current user. |
346 |
404 |