mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-09 20:40:17 +02:00
Added basic openfire support
This commit is contained in:
parent
cd8befe506
commit
bf5a5b4bef
@ -3,6 +3,7 @@ allianceauth
|
|||||||
|
|
||||||
Note: THIS WAS RUSHED! IT DOES NOT FOLLOW GOOD CODING STANDARDS
|
Note: THIS WAS RUSHED! IT DOES NOT FOLLOW GOOD CODING STANDARDS
|
||||||
Note2: Most importantly though it works....
|
Note2: Most importantly though it works....
|
||||||
|
Note3: Jabber uses inband registration. In prosody whitelist the auth server
|
||||||
|
|
||||||
Requirments:
|
Requirments:
|
||||||
django 1.7
|
django 1.7
|
||||||
@ -10,12 +11,13 @@ Requirments:
|
|||||||
python-mysqld
|
python-mysqld
|
||||||
django-evolution
|
django-evolution
|
||||||
python-passlib
|
python-passlib
|
||||||
|
python-openfire
|
||||||
bcrypt
|
bcrypt
|
||||||
|
|
||||||
Services Interaction:
|
Services Interaction:
|
||||||
Mysql Forums
|
Phpbb3 (Forums)
|
||||||
Mumble
|
Mumble (Voice)
|
||||||
Prosody (jabber)
|
Openfire (Jabber)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,5 +141,9 @@ STATICFILES_DIRS = (
|
|||||||
STATIC_URL = '/static/'
|
STATIC_URL = '/static/'
|
||||||
|
|
||||||
# ALLIANCE INFO
|
# ALLIANCE INFO
|
||||||
ALLIANCE_ID = 99001336
|
ALLIANCE_ID = 0
|
||||||
ALLIANCE_NAME = 'The 99 Percent'
|
ALLIANCE_NAME = 'Some alliance here'
|
||||||
|
|
||||||
|
# Jabber Prosody Info
|
||||||
|
OPENFIRE_ADDRESS = "http://domain.com:9090/"
|
||||||
|
OPENFIRE_SECRET_KEY = "somekey"
|
||||||
|
@ -13,6 +13,7 @@ urlpatterns = patterns('',
|
|||||||
url(r'^maincharacterchange/(\d+)/$', 'portal.views.main_character_change', name='main_character_change'),
|
url(r'^maincharacterchange/(\d+)/$', 'portal.views.main_character_change', name='main_character_change'),
|
||||||
url(r'^applications/', 'portal.views.applications_view', name = 'applications'),
|
url(r'^applications/', 'portal.views.applications_view', name = 'applications'),
|
||||||
url(r'^activateforum/$', 'portal.views.activate_forum', name = 'activateforum'),
|
url(r'^activateforum/$', 'portal.views.activate_forum', name = 'activateforum'),
|
||||||
|
url(r'^activatejabber/$', 'portal.views.activate_jabber', name = 'activatejabber'),
|
||||||
url(r'^loginuser/','authentication.views.login_user', name='loginuser'),
|
url(r'^loginuser/','authentication.views.login_user', name='loginuser'),
|
||||||
url(r'^logoutuser/','authentication.views.logout_user', name='logoutuser'),
|
url(r'^logoutuser/','authentication.views.logout_user', name='logoutuser'),
|
||||||
url(r'^register/', 'registration.views.register', name='register'),
|
url(r'^register/', 'registration.views.register', name='register'),
|
||||||
|
@ -7,6 +7,7 @@ from forms import UpdateKeyForm
|
|||||||
from evespecific.managers import EveCharacterManager
|
from evespecific.managers import EveCharacterManager
|
||||||
from authentication.models import AllianceUserManager
|
from authentication.models import AllianceUserManager
|
||||||
from util.phpbb3_manager import Phpbb3Manager
|
from util.phpbb3_manager import Phpbb3Manager
|
||||||
|
from util.jabber_manager import JabberManager
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
@login_required
|
@login_required
|
||||||
@ -62,3 +63,17 @@ def activate_forum(request):
|
|||||||
|
|
||||||
return HttpResponseRedirect("/")
|
return HttpResponseRedirect("/")
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def activate_jabber(request):
|
||||||
|
userManager = AllianceUserManager()
|
||||||
|
jabberManager = JabberManager()
|
||||||
|
if userManager.check_if_user_exist(request.user.id):
|
||||||
|
characterManager = EveCharacterManager()
|
||||||
|
character = characterManager.get_character_by_id(request.user.main_char_id)
|
||||||
|
|
||||||
|
jabberManager.add_user(character.character_name,"test")
|
||||||
|
|
||||||
|
return HttpResponseRedirect("/applications/")
|
||||||
|
|
||||||
|
return HttpResponseRedirect("/")
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<h3> Really dumb right now</h3>
|
<h3> Really dumb right now</h3>
|
||||||
<p> Click button to add user to services</p>
|
<p> Click button to add user to services</p>
|
||||||
<a href="/activateforum/"><button type="button" class="btn btn-default">Activate Forum</button></a>
|
<a href="/activateforum/"><button type="button" class="btn btn-default">Activate Forum</button></a>
|
||||||
|
<a href="/activatejabber/"><button type="button" class="btn btn-default">Activate Jabber</button></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
17
test.py
17
test.py
@ -1,17 +0,0 @@
|
|||||||
import evelink.api # Raw API access
|
|
||||||
import evelink.char # Wrapped API access for the /char/ API path
|
|
||||||
import evelink.eve # Wrapped API access for the /eve/ API path
|
|
||||||
|
|
||||||
api_id = '3730269'
|
|
||||||
api_key = 'BkoREwPBo4QQOGGZXcuOfXMMfSDuTttmoqtQSjiaCoYECqrPozBp4bKjYZ2XmOHL'
|
|
||||||
# Create user
|
|
||||||
api = evelink.api.API(api_key=(api_id, api_key))
|
|
||||||
account = evelink.account.Account(api=api)
|
|
||||||
chars = account.characters()
|
|
||||||
for char in chars.result:
|
|
||||||
print char['alliance']['id']
|
|
||||||
print char['alliance']['name']
|
|
||||||
print char['corp']['id']
|
|
||||||
print char['corp']['name']
|
|
||||||
print char['id']
|
|
||||||
print char['name']
|
|
34
util/jabber_manager.py
Normal file
34
util/jabber_manager.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from django.conf import settings
|
||||||
|
from django.db import connections, transaction
|
||||||
|
from openfire import UserService
|
||||||
|
|
||||||
|
class JabberManager():
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def add_user(self, username, password):
|
||||||
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
|
print str(username)
|
||||||
|
print str(password)
|
||||||
|
api.add_user(self.__santatize_username(username), str(password))
|
||||||
|
|
||||||
|
def delete_user(self, username):
|
||||||
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
|
api.delete_user(username, password)
|
||||||
|
|
||||||
|
def lock_user(self, username):
|
||||||
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
|
api.lock_user(username, password)
|
||||||
|
|
||||||
|
def unlock_user(self, username):
|
||||||
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
|
api.unlock_user(username, password)
|
||||||
|
|
||||||
|
def update_user_pass(self, username, password):
|
||||||
|
api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
|
||||||
|
api.update_user(username, password)
|
||||||
|
|
||||||
|
def __santatize_username(self, username):
|
||||||
|
sanatized = username.replace(" ","_")
|
||||||
|
return sanatized.lower()
|
Loading…
x
Reference in New Issue
Block a user