fixed privileges for the save_as_base

This commit is contained in:
Piotr Zalewa 2010-02-18 18:35:32 +00:00
Родитель 6841119f76
Коммит 23162274bd
1 изменённых файлов: 4 добавлений и 4 удалений

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

@ -123,7 +123,7 @@ def jetpack_version_update(r, slug, version, counter):
"""
version = get_object_or_404(JetVersion, jetpack__slug=slug, name=version, counter=counter)
# permission check
if not (r.user.id == version.author.id or r.user in version.jetpack.managers.all()):
if not version.jetpack.can_be_updated_by(r.user):
return HttpResponseNotAllowed(HttpResponse(""))
version.author = r.user
@ -146,7 +146,7 @@ def jetpack_version_save_as_base(r, slug, version, counter):
"""
version = get_object_or_404(JetVersion, jetpack__slug=slug, name=version, counter=counter)
# permission check
if not (r.user.id == version.author.id or r.user in version.jetpack.managers.all()):
if not version.jetpack.can_be_updated_by(r.user):
return HttpResponseNotAllowed(HttpResponse(""))
version.is_base = True
@ -242,7 +242,7 @@ def capability_version_update(r, slug, version, counter):
"""
version = get_object_or_404(CapVersion, capability__slug=slug, name=version, counter=counter)
# permission check
if not (r.user.id == version.author.id or r.user in version.capability.managers.all()):
if not version.capability.can_be_updated_by(r.user):
return HttpResponseNotAllowed(HttpResponse(""))
version.author = r.user
@ -263,7 +263,7 @@ def capability_version_save_as_base(r, slug, version, counter):
"""
version = get_object_or_404(CapVersion, capability__slug=slug, name=version, counter=counter)
# permission check
if not (r.user.id == version.author.id or r.user in version.capability.managers.all()):
if not version.capability.can_be_updated_by(r.user):
return HttpResponseNotAllowed(HttpResponse(""))
version.is_base = True