Added gargoyle switch to enable key deletion

This commit is contained in:
2011-09-02 07:49:36 +01:00
parent 385030ce5d
commit 77c5efe5ee
4 changed files with 16 additions and 9 deletions

View File

@@ -133,6 +133,11 @@ GARGOYLE_SWITCH_DEFAULTS = {
'label': 'EVE Test API Endpoints',
'description': 'Use the Test API endpoints instead of Live.',
},
'eve-keydelete': {
'is_active': False,
'label': 'Allow EVE API Key Delete',
'description': 'Allows API keys to be deleted by th end user.',
},
'api-disableprocessing': {
'is_active': False,
'label': 'Disable API Backend Processing',

View File

@@ -6,7 +6,7 @@ from eve_api import views
urlpatterns = patterns('',
url(r'^eveapi/add/', views.eveapi_add, name="eveapi-add"),
url(r'^eveapi/update/(?P<userid>\d+)/$', views.eveapi_update, name="eveapi-update"),
#url(r'^eveapi/delete/(?P<userid>\d+)/$', views.eveapi_del, name="eveapi-delete"),
url(r'^eveapi/delete/(?P<userid>\d+)/$', views.eveapi_del, name="eveapi-delete"),
url(r'^eveapi/refresh/(?P<userid>\d+)/$', views.eveapi_refresh, name="eveapi-refresh"),
url(r'^eveapi/log/(?P<userid>\d+)/$', views.eveapi_log, name="eveapi-log"),

View File

@@ -95,6 +95,7 @@ def eveapi_update(request, userid, post_save_redirect='/', template='eve_api/upd
def eveapi_del(request, userid, post_save_redirect='/'):
""" Delete a EVE API key from a account """
if gargoyle.is_active('eve-keydelete'):
try:
acc = EVEAccount.objects.get(pk=userid)
except EVEAccount.DoesNotExist:

View File

@@ -114,7 +114,8 @@ setup.</p>
<td id="api-time-{{ acc.api_user_id }}">{{ acc.api_last_updated|naturaltimediff }}</td>
<td>{% ifswitch api-disableprocessing %}{% else %}<a href="{% url eve_api.views.eveapi_refresh acc.api_user_id %}" onclick="javascript:refresh_apikey({{ acc.api_user_id }}); return false;">Refresh</a>,&nbsp;
<a href="{% url eve_api.views.eveapi_update acc.api_user_id %}">Update Key</a>,&nbsp;{% endifswitch %}
<a href="{% url eve_api.views.eveapi_log acc.api_user_id %}">Logs</a>
<a href="{% url eve_api.views.eveapi_log acc.api_user_id %}">Logs</a>{% ifswitch eve-keydelete %},&nbsp;
<a href="{% url eve_api.views.eveapi_del acc.api_user_id %}">Delete</a>{% endifswitch %}
</tr>
{% endfor %}
</table>