mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-30 01:08:32 -05:00
Add moderator permission for managing subreddit config.
This commit is contained in:
@@ -1421,7 +1421,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
# In order to avoid breaking functionality, this was done instead.
|
||||
prevstyle = request.post.get('prevstyle')
|
||||
if not report:
|
||||
return self.abort(403,'forbidden')
|
||||
return abort(403, 'forbidden')
|
||||
|
||||
if report.errors:
|
||||
error_items = [ CssError(x).render(style='html')
|
||||
@@ -1494,7 +1494,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
cssfilter.rendered_comment(comments))
|
||||
|
||||
@require_oauth2_scope("modconfig")
|
||||
@validatedForm(VSrModerator(),
|
||||
@validatedForm(VSrModerator(perms='config'),
|
||||
VModhash(),
|
||||
name = VCssName('img_name'))
|
||||
@api_doc(api_section.subreddits)
|
||||
@@ -1513,7 +1513,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
details='del_image', description=name)
|
||||
|
||||
@require_oauth2_scope("modconfig")
|
||||
@validatedForm(VSrModerator(),
|
||||
@validatedForm(VSrModerator(perms='config'),
|
||||
VModhash(),
|
||||
sponsor = VInt("sponsor", min = 0, max = 1))
|
||||
@api_doc(api_section.subreddits)
|
||||
@@ -1555,7 +1555,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
return "nothing to see here."
|
||||
|
||||
@require_oauth2_scope("modconfig")
|
||||
@validate(VSrModerator(),
|
||||
@validate(VSrModerator(perms='config'),
|
||||
VModhash(),
|
||||
file = VLength('file', max_length=1024*500),
|
||||
name = VCssName("name"),
|
||||
@@ -1790,7 +1790,7 @@ class ApiController(RedditController, OAuth2ResourceController):
|
||||
changed(sr)
|
||||
|
||||
#editting an existing reddit
|
||||
elif sr.is_moderator(c.user) or c.user_is_admin:
|
||||
elif sr.is_moderator_with_perms(c.user, 'config') or c.user_is_admin:
|
||||
|
||||
if c.user_is_admin:
|
||||
sr.sponsorship_text = sponsor_text or ""
|
||||
|
||||
@@ -600,7 +600,7 @@ class FrontController(RedditController, OAuth2ResourceController):
|
||||
for perm in perms))
|
||||
|
||||
extension_handling = False
|
||||
if is_moderator and location == 'edit':
|
||||
if is_moderator_with_perms('config') and location == 'edit':
|
||||
pane = PaneStack()
|
||||
if created == 'true':
|
||||
pane.append(InfoBar(message = strings.sr_created))
|
||||
|
||||
@@ -246,7 +246,8 @@ class Reddit(Templated):
|
||||
buttons = []
|
||||
is_single_subreddit = not isinstance(c.site, (ModSR, MultiReddit))
|
||||
|
||||
if is_single_subreddit:
|
||||
if (is_single_subreddit
|
||||
and c.site.is_moderator_with_perms(c.user, 'config')):
|
||||
buttons.append(NavButton(menu.community_settings,
|
||||
css_class="reddit-edit",
|
||||
dest="edit"))
|
||||
|
||||
@@ -442,7 +442,8 @@ class Subreddit(Thing, Printable):
|
||||
|
||||
def can_change_stylesheet(self, user):
|
||||
if c.user_is_loggedin:
|
||||
return c.user_is_admin or self.is_moderator(user)
|
||||
return (
|
||||
c.user_is_admin or self.is_moderator_with_perms(user, 'config'))
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user