Started Plugin infrastructure
This commit is contained in:
parent
dc585b47be
commit
8d39ac2a3f
|
@ -40,6 +40,8 @@ class BuyableItemHandler(BaseHandler):
|
|||
return error
|
||||
|
||||
def create(self, request, itemId=None):
|
||||
if not request.content_type:
|
||||
request.data = request.POST
|
||||
if not itemId:
|
||||
return rc.BAD_REQUEST
|
||||
item = None
|
||||
|
@ -48,10 +50,9 @@ class BuyableItemHandler(BaseHandler):
|
|||
except Buyable.DoesNotExist:
|
||||
return rc.NOT_FOUND
|
||||
|
||||
# parse post data
|
||||
data = request.POST
|
||||
deposit = getInt(data, 'deposit', 0)
|
||||
amount = getInt(data, 'amount', 1)
|
||||
# parse post data
|
||||
deposit = getInt(request.data, 'deposit', 0)
|
||||
amount = getInt(request.data, 'amount', 1)
|
||||
if amount < 1:
|
||||
return rc.BAD_REQUEST
|
||||
if item.hasDeposit() and deposit > 0:
|
||||
|
|
|
@ -10,8 +10,6 @@ class CsrfExemptResource( Resource ):
|
|||
super( CsrfExemptResource, self ).__init__( handler, authentication )
|
||||
self.csrf_exempt = getattr( self.handler, 'csrf_exempt', True )
|
||||
|
||||
|
||||
|
||||
auth = HttpBasicAuthentication(realm="Freitagsrundenkassensystemapi")
|
||||
ad = {'authentication': auth}
|
||||
|
||||
|
@ -28,17 +26,17 @@ configRes = CsrfExemptResource(handler=ConfigHandler, **ad)
|
|||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'buyable/item/$', buyableItemRes),
|
||||
url(r'buyable/item/(?P<itemId>\d+)/$', buyableItemRes),
|
||||
url(r'buyable/types/$', buyableTypeRes),
|
||||
url(r'buyable/item/?$', buyableItemRes),
|
||||
url(r'buyable/item/(?P<itemId>\d+)/?$', buyableItemRes),
|
||||
url(r'buyable/types/?$', buyableTypeRes),
|
||||
|
||||
url(r'account/transactions/transact/$', transactionTransactRes),
|
||||
url(r'account/transfers/transfer/$', transactionTransactRes),
|
||||
url(r'account/transactions/types/$', transactionTypeRes),
|
||||
url(r'account/transfers/types/$', transactionTypeRes),
|
||||
url(r'account/balance/$', accountBalanceRes),
|
||||
url(r'account/transactions/transact/?$', transactionTransactRes),
|
||||
url(r'account/transfers/transfer/?$', transactionTransactRes),
|
||||
url(r'account/transactions/types/?$', transactionTypeRes),
|
||||
url(r'account/transfers/types/?$', transactionTypeRes),
|
||||
url(r'account/balance/?$', accountBalanceRes),
|
||||
|
||||
url(r'auth/blob/$', authBlobRes),
|
||||
url(r'config/$', configRes),
|
||||
url(r'auth/blob/?$', authBlobRes),
|
||||
url(r'config/?$', configRes),
|
||||
)
|
||||
|
||||
|
|
|
@ -18,3 +18,12 @@ def createUserProfile(sender, instance, created, **kwargs):
|
|||
|
||||
post_save.connect(createUserProfile, sender=User)
|
||||
|
||||
class PluginPermission(models.Model):
|
||||
user = models.ForeignKey(User)
|
||||
plugin = models.ForeignKey('Plugin')
|
||||
authBlob = models.TextField()
|
||||
|
||||
class Plugin(models.Model):
|
||||
pluginUser = models.ForeignKey(User)
|
||||
uniqueAuthblob = models.BooleanField()
|
||||
|
||||
|
|
Loading…
Reference in New Issue