Revision 4f824e14
Added new view roboauthall
It returns bitmask of all tool permissions for a given user
crm/crm/settings.py | ||
---|---|---|
62 | 62 |
|
63 | 63 |
# URL prefix for static files. |
64 | 64 |
# Example: "http://media.lawrence.com/static/" |
65 |
STATIC_URL = '/static/' |
|
65 |
STATIC_URL = '/crm/static/'
|
|
66 | 66 |
|
67 | 67 |
# Additional locations of static files |
68 | 68 |
STATICFILES_DIRS = ( |
crm/crm/urls.py | ||
---|---|---|
10 | 10 |
# url(r'^$', 'crm.views.home', name='home'), |
11 | 11 |
# url(r'^crm/', include('crm.foo.urls')), |
12 | 12 |
url(r'^roboauth/(?P<rfid_tag>[0-9A-Fa-f]+)/(?P<mach_num>\d+)/', 'robocrm.views.roboauth'), |
13 |
url(r'^roboauth/(?P<rfid_tag>[0-9A-Fa-f]+)/', 'robocrm.views.roboauthall'), |
|
13 | 14 |
url(r'^add_card_event/', 'robocrm.views.add_card_event'), |
14 | 15 |
|
15 | 16 |
# Uncomment the admin/doc line below to enable admin documentation: |
crm/robocrm/views.py | ||
---|---|---|
19 | 19 |
else : |
20 | 20 |
return HttpResponse("0") |
21 | 21 |
|
22 |
def roboauthall(request, rfid_tag): |
|
23 |
r = RoboUser.objects.filter(rfid=rfid_tag) |
|
24 |
if r.count() > 0: |
|
25 |
us = r[0] |
|
26 |
else: |
|
27 |
return HttpResponse("0") |
|
28 |
auth = 0 |
|
29 |
for mach in us.machines.all(): |
|
30 |
auth |= 1 << int(mach.id) |
|
31 |
return HttpResponse(str(auth)) |
|
32 |
|
|
22 | 33 |
def add_card_event(request): |
23 | 34 |
if request.method != 'POST': |
24 | 35 |
raise Http404 |
Also available in: Unified diff