mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-08 08:06:20 +01:00
Fixed issue where syncgroups were preventing other groups from being created if a service is added after.
This commit is contained in:
@@ -6,7 +6,6 @@ from django.conf import settings
|
||||
|
||||
|
||||
class IPBoardManager:
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@@ -23,15 +22,18 @@ class IPBoardManager:
|
||||
@staticmethod
|
||||
def exec_xmlrpc(func, **kwargs):
|
||||
""" Send a XMLRPC request """
|
||||
try:
|
||||
server = xmlrpclib.Server(settings.IPBOARD_ENDPOINT, verbose=False)
|
||||
params = {}
|
||||
for i in kwargs:
|
||||
params[i] = kwargs[i]
|
||||
params['api_key'] = settings.IPBOARD_APIKEY
|
||||
params['api_module'] = settings.IPBOARD_APIMODULE
|
||||
print params
|
||||
|
||||
server = xmlrpclib.Server(settings.IPBOARD_ENDPOINT, verbose=False)
|
||||
params = {}
|
||||
for i in kwargs:
|
||||
params[i] = kwargs[i]
|
||||
params['api_key'] = settings.IPBOARD_APIKEY
|
||||
params['api_module'] = settings.IPBOARD_APIMODULE
|
||||
print params
|
||||
return getattr(server, func)(params)
|
||||
return getattr(server, func)(params)
|
||||
except:
|
||||
return {}
|
||||
|
||||
@staticmethod
|
||||
def add_user(username, email):
|
||||
@@ -39,7 +41,8 @@ class IPBoardManager:
|
||||
sanatized = str(IPBoardManager.__santatize_username(username))
|
||||
plain_password = IPBoardManager.__generate_random_pass()
|
||||
password = md5(plain_password).hexdigest()
|
||||
ret = IPBoardManager.exec_xmlrpc('createUser', username=sanatized, email=str(email), display_name=sanatized, md5_passwordHash=password)
|
||||
ret = IPBoardManager.exec_xmlrpc('createUser', username=sanatized, email=str(email), display_name=sanatized,
|
||||
md5_passwordHash=password)
|
||||
return sanatized, plain_password
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -218,7 +218,13 @@ class MumbleManager:
|
||||
for g in addgroups:
|
||||
if not g in mumble_groups:
|
||||
mumble_groups[g] = MumbleManager._add_group(g)
|
||||
MumbleManager._add_user_to_group(userid, mumble_groups[g])
|
||||
try:
|
||||
MumbleManager._add_user_to_group(userid, mumble_groups[g])
|
||||
except:
|
||||
print "Error occurred while adding a mumble to a group"
|
||||
|
||||
for g in remgroups:
|
||||
MumbleManager._del_user_from_group(userid, mumble_groups[g])
|
||||
try:
|
||||
MumbleManager._del_user_from_group(userid, mumble_groups[g])
|
||||
except:
|
||||
print "Error occurred while removing a mumble user from group"
|
||||
|
||||
@@ -95,13 +95,19 @@ class Phpbb3Manager:
|
||||
|
||||
@staticmethod
|
||||
def __add_user_to_group(userid, groupid):
|
||||
cursor = connections['phpbb3'].cursor()
|
||||
cursor.execute(Phpbb3Manager.SQL_ADD_USER_GROUP, [groupid, userid, 0])
|
||||
try:
|
||||
cursor = connections['phpbb3'].cursor()
|
||||
cursor.execute(Phpbb3Manager.SQL_ADD_USER_GROUP, [groupid, userid, 0])
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def __remove_user_from_group(userid, groupid):
|
||||
cursor = connections['phpbb3'].cursor()
|
||||
cursor.execute(Phpbb3Manager.SQL_REMOVE_USER_GROUP, [userid, groupid])
|
||||
try:
|
||||
cursor.execute(Phpbb3Manager.SQL_REMOVE_USER_GROUP, [userid, groupid])
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def add_user(username, email, groups):
|
||||
@@ -118,8 +124,8 @@ class Phpbb3Manager:
|
||||
try:
|
||||
|
||||
cursor.execute(Phpbb3Manager.SQL_ADD_USER, [username_clean, username_clean, pwhash,
|
||||
email, 2, Phpbb3Manager.__get_current_utc_date(),
|
||||
"", ""])
|
||||
email, 2, Phpbb3Manager.__get_current_utc_date(),
|
||||
"", ""])
|
||||
Phpbb3Manager.update_groups(username_clean, groups)
|
||||
except:
|
||||
pass
|
||||
@@ -176,8 +182,10 @@ class Phpbb3Manager:
|
||||
|
||||
if userid:
|
||||
if groupid:
|
||||
cursor.execute(Phpbb3Manager.SQL_REMOVE_USER_GROUP, [userid, groupid])
|
||||
|
||||
try:
|
||||
cursor.execute(Phpbb3Manager.SQL_REMOVE_USER_GROUP, [userid, groupid])
|
||||
except:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def check_user(username):
|
||||
|
||||
@@ -18,7 +18,7 @@ class Teamspeak3Manager:
|
||||
def __santatize_username(username):
|
||||
sanatized = username.replace(" ", "_")
|
||||
sanatized = sanatized.replace("'", "")
|
||||
return sanatized.lower()
|
||||
return sanatized
|
||||
|
||||
@staticmethod
|
||||
def __generate_username(username, corp_ticker):
|
||||
@@ -207,8 +207,10 @@ class Teamspeak3Manager:
|
||||
|
||||
@staticmethod
|
||||
def update_groups(uid, l_groups):
|
||||
print uid
|
||||
print l_groups
|
||||
userid = Teamspeak3Manager._get_userid(uid)
|
||||
if userid:
|
||||
if userid is not None:
|
||||
server_groups = Teamspeak3Manager._group_list()
|
||||
user_groups = set(Teamspeak3Manager._user_group_list(userid))
|
||||
groups = []
|
||||
|
||||
Reference in New Issue
Block a user