Fold checkAgreesToSiteToS into checkIsUser
No use in having a check that's not used except in another checker
anyway, so might as well fold it in.
Patch by: Sverre Rabbelier
--- a/app/soc/views/helper/access.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/helper/access.py Tue Jan 27 13:36:45 2009 +0000
@@ -232,33 +232,15 @@
AccessViolationResponse:
* if no User exists for the logged-in Google Account, or
* if no Google Account is logged in at all
+ * if User has not agreed to the site-wide ToS, if one exists
"""
self.checkIsLoggedIn(django_args)
user = user_logic.getForCurrentAccount()
- if user:
- return
-
- raise out_of_band.LoginRequest(message_fmt=DEF_NO_USER_LOGIN_MSG_FMT)
-
- def checkAgreesToSiteToS(self, django_args):
- """Raises an alternate HTTP response if User has not agreed to site-wide ToS.
-
- Args:
- django_args: a dictionary with django's arguments
-
- Raises:
- AccessViolationResponse:
- * if User has not agreed to the site-wide ToS, or
- * if no User exists for the logged-in Google Account, or
- * if no Google Account is logged in at all
- """
-
- self.checkIsUser(django_args)
-
- user = user_logic.getForCurrentAccount()
+ if not user:
+ raise out_of_band.LoginRequest(message_fmt=DEF_NO_USER_LOGIN_MSG_FMT)
if user_logic.agreesToSiteToS(user):
return
@@ -283,7 +265,7 @@
* if no Google Account is logged in at all
"""
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
if accounts.isDeveloper(account=self.id):
return
@@ -317,7 +299,7 @@
or if it's state is not group_accepted.
"""
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user_entity = user_logic.getForCurrentAccount()
@@ -358,7 +340,7 @@
or if it's state is not group_accepted.
"""
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user_entity = user_logic.getForCurrentAccount()
@@ -403,7 +385,7 @@
except out_of_band.Error:
pass
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user = user_logic.getForCurrentAccount()
@@ -418,7 +400,7 @@
host = host_logic.getForFields(fields, unique=True)
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user = user_logic.getForCurrentAccount()
@@ -450,7 +432,7 @@
* if the user is not even logged in
"""
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user = user_logic.getForCurrentAccount()
@@ -496,7 +478,7 @@
except out_of_band.Error:
pass
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user = user_logic.getForCurrentAccount()
@@ -542,7 +524,7 @@
except out_of_band.Error:
pass
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
user = user_logic.getForCurrentAccount()
@@ -580,7 +562,7 @@
except out_of_band.Error:
pass
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
properties = dicts.filter(django_args, ['link_id', 'scope_path'])
@@ -617,7 +599,7 @@
except out_of_band.Error:
pass
- self.checkAgreesToSiteToS(django_args)
+ self.checkIsUser(django_args)
properties = dicts.filter(django_args, ['link_id'])
--- a/app/soc/views/helper/params.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/helper/params.py Tue Jan 27 13:36:45 2009 +0000
@@ -73,7 +73,7 @@
rights = access.Checker(params)
rights['unspecified'] = []
rights['any_access'] = ['checkIsLoggedIn']
- rights['show'] = ['checkAgreesToSiteToS']
+ rights['show'] = ['checkIsUser']
rights['create'] = ['checkIsDeveloper']
rights['edit'] = ['checkIsDeveloper']
rights['delete'] = ['checkIsDeveloper']
--- a/app/soc/views/models/club.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/club.py Tue Jan 27 13:36:45 2009 +0000
@@ -64,7 +64,7 @@
rights['delete'] = ['checkIsDeveloper']
rights['home'] = ['allow']
rights['list'] = ['checkIsDeveloper']
- rights['apply_member'] = ['checkAgreesToSiteToS']
+ rights['apply_member'] = ['checkIsUser']
rights['list_requests'] = ['checkIsClubAdminForClub']
rights['list_roles'] = ['checkIsClubAdminForClub']
rights['applicant'] = [('checkIsApplicationAccepted', club_app_logic)]
--- a/app/soc/views/models/club_app.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/club_app.py Tue Jan 27 13:36:45 2009 +0000
@@ -56,10 +56,10 @@
"""
rights = access.Checker(params)
- rights['create'] = ['checkAgreesToSiteToS']
+ rights['create'] = ['checkIsUser']
rights['delete'] = [('checkIsMyApplication', club_app_logic)]
rights['edit'] = [('checkIsMyApplication', club_app_logic)]
- rights['list'] = ['checkAgreesToSiteToS']
+ rights['list'] = ['checkIsUser']
rights['public'] = [('checkIsMyApplication', club_app_logic)]
rights['review'] = ['checkIsHost']
--- a/app/soc/views/models/club_member.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/club_member.py Tue Jan 27 13:36:45 2009 +0000
@@ -54,7 +54,7 @@
rights['delete'] = ['checkIsDeveloper']
rights['invite'] = ['checkIsClubAdminForClub']
rights['accept_invite'] = [('checkCanCreateFromRequest','club_member')]
- rights['request'] = ['checkAgreesToSiteToS',
+ rights['request'] = ['checkIsUser',
('checkCanMakeRequestToGroup', club_logic)]
rights['process_request'] = ['checkIsClubAdminForClub',
('checkCanProcessRequest','club_member')]
--- a/app/soc/views/models/notification.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/notification.py Tue Jan 27 13:36:45 2009 +0000
@@ -87,7 +87,7 @@
rights['edit'] = ['deny']
rights['show'] = ['checkIsMyNotification']
rights['delete'] = ['checkIsMyNotification']
- rights['list'] = ['checkAgreesToSiteToS']
+ rights['list'] = ['checkIsUser']
# create is developer only for the time being to test functionality
rights['create'] = ['checkIsDeveloper']
--- a/app/soc/views/models/request.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/request.py Tue Jan 27 13:36:45 2009 +0000
@@ -66,7 +66,7 @@
"""
rights = access.Checker(params)
- rights['listSelf'] = ['checkAgreesToSiteToS']
+ rights['listSelf'] = ['checkIsUser']
rights['create'] = ['deny']
rights['edit'] = ['checkIsDeveloper']
rights['process_invite'] = ['checkIsMyGroupAcceptedRequest']
--- a/app/soc/views/models/user_self.py Tue Jan 27 12:47:28 2009 +0000
+++ b/app/soc/views/models/user_self.py Tue Jan 27 13:36:45 2009 +0000
@@ -116,9 +116,9 @@
rights['unspecified'] = ['deny']
rights['any_access'] = ['allow']
rights['edit'] = ['checkIsLoggedIn']
- rights['roles'] = ['checkAgreesToSiteToS']
+ rights['roles'] = ['checkIsUser']
rights['signIn'] = ['checkNotLoggedIn']
- rights['notification'] = ['checkAgreesToSiteToS']
+ rights['notification'] = ['checkIsUser']
new_params = {}
new_params['rights'] = rights