add in a permission so clouserw can give it to me (bug 912277)

This commit is contained in:
Andy McKay 2013-11-14 14:25:58 -08:00
Родитель 074e38cc13
Коммит d097b5d64c
3 изменённых файлов: 11 добавлений и 7 удалений

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

@ -0,0 +1,3 @@
INSERT INTO groups (id, name, rules, notes, created, modified) VALUES
(NULL, 'Price currency manipulation', 'Prices:Modify',
'Clients that can modify prices', NOW(), NOW());

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

@ -471,7 +471,7 @@ class PriceTierSerializer(ModelSerializer):
class PriceTierViewSet(generics.CreateAPIView,
generics.RetrieveUpdateDestroyAPIView,
ModelViewSet):
permission_classes = [GroupPermission('Admin', '%')]
permission_classes = [GroupPermission('Prices', 'Edit')]
authentication_classes = [RestOAuthAuthentication]
serializer_class = PriceTierSerializer
model = Price
@ -493,7 +493,7 @@ class PriceCurrencySerializer(ModelSerializer):
class PriceCurrencyViewSet(ModelViewSet):
permission_classes = [GroupPermission('Admin', '%')]
permission_classes = [GroupPermission('Prices', 'Edit')]
authentication_classes = [RestOAuthAuthentication]
serializer_class = PriceCurrencySerializer
model = PriceCurrency

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

@ -820,12 +820,13 @@ class TestPriceTier(RestOAuth):
fixtures = ['data/user_2519', 'data/admin', 'market/prices']
def setUp(self):
self.permission = 'Prices:Edit'
RestOAuth.setUp(self)
self.list_url = reverse('price-tier-list')
self.detail_url = reverse('price-tier-detail', kwargs={'pk': 1})
def test_list(self):
self.grant_permission(self.profile, 'Admin:Adminner')
self.grant_permission(self.profile, self.permission)
res = self.client.get(self.list_url)
j = json.loads(res.content)
eq_(len(j['objects']), 2)
@ -838,7 +839,7 @@ class TestPriceTier(RestOAuth):
})
def test_detail(self):
self.grant_permission(self.profile, 'Admin:Adminner')
self.grant_permission(self.profile, self.permission)
res = self.client.get(self.detail_url)
j = json.loads(res.content)
eq_(j, {
@ -854,7 +855,7 @@ class TestPriceTier(RestOAuth):
eq_(res.status_code, 403)
def test_post_admin(self):
self.grant_permission(self.profile, 'Admin:Adminner')
self.grant_permission(self.profile, self.permission)
res = self.client.post(
self.list_url,
json.dumps({'name': '3',
@ -873,7 +874,7 @@ class TestPriceTier(RestOAuth):
eq_(res.status_code, 403)
def test_put(self):
self.grant_permission(self.profile, 'Admin:Adminner')
self.grant_permission(self.profile, self.permission)
res = self.client.put(
self.detail_url,
json.dumps({'name': '1',
@ -892,7 +893,7 @@ class TestPriceTier(RestOAuth):
eq_(res.status_code, 403)
def test_delete(self):
self.grant_permission(self.profile, 'Admin:Adminner')
self.grant_permission(self.profile, self.permission)
res = self.client.delete(self.detail_url)
eq_(res.status_code, 204)
assert not Price.objects.filter(pk=1).exists()