mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-25 06:48:01 -05:00
Add "modtraffic" oauth2 scope.
This commit is contained in:
@@ -48,6 +48,7 @@ from r2.lib import sup
|
||||
import r2.lib.db.thing as thing
|
||||
from errors import errors
|
||||
from listingcontroller import ListingController
|
||||
from oauth2 import OAuth2ResourceController, require_oauth2_scope
|
||||
from api_docs import api_doc, api_section
|
||||
from pylons import c, request, request, Response
|
||||
from r2.models.token import EmailVerificationToken
|
||||
@@ -59,10 +60,14 @@ import re, socket
|
||||
import time as time_module
|
||||
from urllib import quote_plus
|
||||
|
||||
class FrontController(RedditController):
|
||||
class FrontController(RedditController, OAuth2ResourceController):
|
||||
|
||||
allow_stylesheets = True
|
||||
|
||||
def pre(self):
|
||||
self.check_for_bearer_token()
|
||||
RedditController.pre(self)
|
||||
|
||||
@validate(article = VLink('article'),
|
||||
comment = VCommentID('comment'))
|
||||
def GET_oldinfo(self, article, type, dest, rest=None, comment=''):
|
||||
@@ -959,6 +964,7 @@ class FrontController(RedditController):
|
||||
return self.abort404()
|
||||
|
||||
|
||||
@require_oauth2_scope("modtraffic")
|
||||
@validate(VTrafficViewer('article'),
|
||||
article = VLink('article'))
|
||||
def GET_traffic(self, article):
|
||||
|
||||
@@ -107,6 +107,11 @@ class OAuth2Scope:
|
||||
"description": _(
|
||||
"Manage and assign flair in subreddits I moderate."),
|
||||
},
|
||||
"modtraffic": {
|
||||
"id": "modtraffic",
|
||||
"name": _("Subreddit Traffic"),
|
||||
"description": _("Access traffic stats in subreddits I moderate."),
|
||||
},
|
||||
"mysubreddits": {
|
||||
"id": "mysubreddits",
|
||||
"name": _("My Subreddits"),
|
||||
|
||||
Reference in New Issue
Block a user