mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Allow employees to see sitewide traffic pages.
This commit is contained in:
@@ -648,7 +648,7 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
c.site.stylesheet_contents)
|
||||
pane = SubredditStylesheetSource(stylesheet_contents=stylesheet)
|
||||
elif location == 'traffic' and (c.site.public_traffic or
|
||||
(is_moderator or c.user_is_sponsor)):
|
||||
(is_moderator or c.user.employee)):
|
||||
pane = trafficpages.SubredditTraffic()
|
||||
elif (location == "about") and is_api():
|
||||
return self.redirect(add_sr('about.json'), code=301)
|
||||
@@ -1045,19 +1045,19 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
comment=None,
|
||||
content=content).render()
|
||||
|
||||
@validate(VSponsorAdmin())
|
||||
@validate(VEmployee())
|
||||
def GET_site_traffic(self):
|
||||
return trafficpages.SitewideTrafficPage().render()
|
||||
|
||||
@validate(VSponsorAdmin())
|
||||
@validate(VEmployee())
|
||||
def GET_lang_traffic(self, langcode):
|
||||
return trafficpages.LanguageTrafficPage(langcode).render()
|
||||
|
||||
@validate(VSponsorAdmin())
|
||||
@validate(VEmployee())
|
||||
def GET_advert_traffic(self, code):
|
||||
return trafficpages.AdvertTrafficPage(code).render()
|
||||
|
||||
@validate(VSponsorAdmin())
|
||||
@validate(VEmployee())
|
||||
def GET_subreddit_traffic_report(self):
|
||||
content = trafficpages.SubredditTrafficReport()
|
||||
|
||||
|
||||
@@ -912,6 +912,15 @@ class VSponsor(VVerifiedUser):
|
||||
pass
|
||||
abort(403, 'forbidden')
|
||||
|
||||
|
||||
class VEmployee(VVerifiedUser):
|
||||
"""Validate that user is an employee."""
|
||||
def run(self):
|
||||
if not c.user.employee:
|
||||
abort(403, 'forbidden')
|
||||
VVerifiedUser.run(self)
|
||||
|
||||
|
||||
class VTrafficViewer(VSponsor):
|
||||
def user_test(self, thing):
|
||||
return (VSponsor.user_test(self, thing) or
|
||||
|
||||
Reference in New Issue
Block a user