return does_exist
def may_edit_blogpost(request, blog):
- if request.user.is_admin or request.user.id == blog.author:
+ if request.user.has_privilege(u'admin') or request.user.id == blog.author:
return True
return False
blogs = request.db.Blog.query.filter_by(author=user.id)
config = pluginapi.get_config('mediagoblin.media_types.blog')
max_blog_count = config['max_blog_count']
- if (request.user and request.user.id == user.id) or (request.user and request.user.is_admin):
+ if request.user and (request.user.id == user.id or request.user.has_privilege(u'admin')):
if blog_slug:
blog = blogs.filter(Blog.slug==blog_slug).first()
if not blog:
return render_404(reequest)
form = blog_forms.ConfirmDeleteForm(request.form)
- if request.user.id == blog.author or request.user.is_admin:
+ if request.user.id == blog.author or request.user.has_privilege(u'admin'):
if request.method == 'POST' and form.validate():
if form.confirm.data is True:
blog.delete()
return redirect(request, "mediagoblin.media_types.blog.blog_admin_dashboard",
user=request.user.username)
else:
- if request.user.is_admin:
+ if request.user.has_privilege(u'admin'):
add_message(
request, WARNING,
_("You are about to delete another user's Blog. "
</div>
{% if request.user and
(media.uploader == request.user.id or
- request.user.is_admin) %}
+ request.user.has_privilege('admin')) %}
{% set edit_url = request.urlgen('mediagoblin.media_types.blog.blogpost.edit',
blog_slug=media.media_manager.get_blog_by_blogpost().slug,
user=request.user.username, blog_post_slug=media.slug) %}
return render_404(request)
uploader_id = media.uploader
- if not (request.user.is_admin or
+ if not (request.user.has_privilege(u'admin') or
request.user.id == uploader_id):
raise Forbidden()