This commit is contained in:
Jeff Balogh 2011-01-04 16:40:06 -08:00
Родитель 67d5212be7
Коммит fc81dee30e
1 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -69,6 +69,15 @@ def check_addon_ownership(request, addon, require_owner=False):
def has_perm(request, addon, viewer=False, dev=False, ignore_disabled=False):
"""
Check request.amo_user's permissions for the addon.
If user is an admin they can do anything.
If the add-on is disabled only admins have permission.
If they're an add-on owner they can do anything.
dev=True checks that the user has an owner or developer role.
viewer=True checks that the user has an owner, developer, or viewer role.
"""
if not request.user.is_authenticated():
return False
# Admins can do anything.