diff --git a/app/api/handlers/v1.py b/app/api/handlers/v1.py index f401719..d70bb81 100644 --- a/app/api/handlers/v1.py +++ b/app/api/handlers/v1.py @@ -264,17 +264,32 @@ class AnnounceHandler(BaseHandler): def read(self, request): sid = request.GET.get('sid', None) - to = request.GET.getlist('to') + users = request.GET.getlist('users') + groups = request.GET.getlist('groups') + servers = request.GET.getlist('servers') message = request.GET.get('message', None) subject = request.GET.get('subject', None) - if sid and to and message: + if sid and message: srv = get_object_or_404(Service, pk=sid) if not srv.api == 'sso.services.jabber': return {'result': 'invalid'} api = srv.api_class - return {'result': api.announce(api.settings['jabber_server'], message, subject, groups=to)} + return {'result': api.announce(api.settings['jabber_server'], message, subject, users=users, groups=groups, servers=servers) } return {'result': 'invalid'} + + +class EDKApiHandler(BaseHandler): + allowed_methods = ('GET',) + + def read(self, request): + + alliance = request.GET.get('alliance', None) + if not alliance: + return {'auth': 'missing', 'missing': 'alliance'} + + objs = EVEAccount.objects.filter(characters__corporation__alliance=alliance, api_keytype=API_KEYTYPE_CORPORATION, api_status=API_STATUS_OK).extra(where=['(api_accessmask & 256) > 0']) + return objs.values('api_user_id', 'api_key', 'characters__id', 'characters__name', 'characters__corporation__name') diff --git a/app/api/urls.py b/app/api/urls.py index 3c41903..9e7bf24 100755 --- a/app/api/urls.py +++ b/app/api/urls.py @@ -18,6 +18,7 @@ optimer_resource = Resource(handler=OpTimerHandler, **apikeyauth) blacklist_resource = Resource(handler=BlacklistHandler, **apikeyauth) characters_resource = Resource(handler=CharacterHandler, **apikeyauth) announce_resource = Resource(handler=AnnounceHandler, **apikeyauth) +edkapi_resource = Resource(handler=EDKApiHandler, **apikeyauth) urlpatterns = patterns('', url(r'^1.0/user/$', user_resource), @@ -28,6 +29,7 @@ urlpatterns = patterns('', url(r'^1.0/optimer/$', optimer_resource), url(r'^1.0/blacklist/$', blacklist_resource), url(r'^1.0/announce/$', announce_resource), + url(r'^1.0/edkapi/$', edkapi_resource), ) # v2 APIs diff --git a/app/hr/templates/hr/blacklist_add.html b/app/hr/templates/hr/blacklist_add.html new file mode 100644 index 0000000..a96ae2c --- /dev/null +++ b/app/hr/templates/hr/blacklist_add.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% block title %}Add Blacklist Entry{% endblock %} + +{% block content %} +

Add Blacklist Entry

+ +
+ +{{ form.as_table }} +
+{% csrf_token %} + + +
+{% endblock %} + + diff --git a/app/hr/templates/hr/blacklist_list.html b/app/hr/templates/hr/blacklist_list.html new file mode 100644 index 0000000..cd309a3 --- /dev/null +++ b/app/hr/templates/hr/blacklist_list.html @@ -0,0 +1,43 @@ +{% extends "base.html" %} +{% load naturaltimediff %} +{% block title %}Blacklist{% endblock %} + +{% block content %} +

Blacklist

+ +{% if object_list %} +
+ + +
+ + + + + + {% for obj in object_list %} + + {% endfor %} + +
IDTypeValueLevelReasonExpiry
{{ obj.id }}{{ obj.get_type_display }}{{ obj.value }}{{ obj.get_level_display }}{{ obj.reason }}{{ obj.expiry_date }}
+ +{% if is_paginated %} + +{% endif %} +{% else %} +

No blacklist entries {% if query %}containing "{{ query }}" {% endif %}were found.

+{% endif %} + +{% if perms.hr.add_blacklist %} +

Add a blacklist entry

+{% endif %} +{% endblock %} + diff --git a/app/hr/templates/hr/index.html b/app/hr/templates/hr/index.html index 4a11b4b..385cfaf 100644 --- a/app/hr/templates/hr/index.html +++ b/app/hr/templates/hr/index.html @@ -24,4 +24,13 @@

{% endif %} +{% if perms.add_blacklist %} +

Blacklist Management

+

+