mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Added character information passthrough to update_groups, also enabled per corp groups in TS3
This commit is contained in:
@@ -63,7 +63,7 @@ class BaseService():
|
|||||||
""" Login the user and provide cookies back """
|
""" Login the user and provide cookies back """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update_groups(self, uid, groups):
|
def update_groups(self, uid, groups, character=None):
|
||||||
"""" Update the UID's groups based on the provided list """
|
"""" Update the UID's groups based on the provided list """
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class JabberService(BaseService):
|
|||||||
|
|
||||||
return grouplist
|
return grouplist
|
||||||
|
|
||||||
def update_groups(self, uid, groups):
|
def update_groups(self, uid, groups, character=None):
|
||||||
username, server = uid.split("@")
|
username, server = uid.split("@")
|
||||||
|
|
||||||
current_groups = self.get_group_list(uid)
|
current_groups = self.get_group_list(uid)
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class MumbleService(BaseService):
|
|||||||
|
|
||||||
return acls
|
return acls
|
||||||
|
|
||||||
def update_groups(self, uid, groups):
|
def update_groups(self, uid, groups, character=None):
|
||||||
""" Update the UID's groups based on the provided list """
|
""" Update the UID's groups based on the provided list """
|
||||||
|
|
||||||
user = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
user = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class PhpBBService(BaseDBService):
|
|||||||
self.update_groups(username)
|
self.update_groups(username)
|
||||||
return { 'username': username, 'password': password }
|
return { 'username': username, 'password': password }
|
||||||
|
|
||||||
def update_groups(self, username):
|
def update_groups(self, username, groups, character=None):
|
||||||
self._dbcursor.execute(self.SQL_CHECK_USER, [self._clean_username(username)])
|
self._dbcursor.execute(self.SQL_CHECK_USER, [self._clean_username(username)])
|
||||||
row = self._dbcursor.fetchone()
|
row = self._dbcursor.fetchone()
|
||||||
user_id = row['user_id']
|
user_id = row['user_id']
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ class TS3Service(BaseService):
|
|||||||
|
|
||||||
return outlist
|
return outlist
|
||||||
|
|
||||||
def update_groups(self, uid, groups):
|
def update_groups(self, uid, groups, character=None):
|
||||||
""" Update the UID's groups based on the provided list """
|
""" Update the UID's groups based on the provided list """
|
||||||
|
|
||||||
cldbid = self._get_userid(uid)
|
cldbid = self._get_userid(uid)
|
||||||
@@ -165,6 +165,15 @@ class TS3Service(BaseService):
|
|||||||
if g.name in usrgrplist:
|
if g.name in usrgrplist:
|
||||||
del usrgrplist[g.name]
|
del usrgrplist[g.name]
|
||||||
|
|
||||||
|
# Add to corporation groups
|
||||||
|
if character and character.corporation:
|
||||||
|
if character.corporation.name in usrgrplist:
|
||||||
|
del usrgrplist[character.corporation.name]
|
||||||
|
else:
|
||||||
|
if not character.corporation.name in tsgrplist:
|
||||||
|
tsgrplist[g.name] = self._create_group(character.corporation.name)
|
||||||
|
self.conn.send_command('servergroupaddclient', {'sgid': tsgrplist[character.corporation.name], 'cldbid': cldbid })
|
||||||
|
|
||||||
# Remove ignored and admin groups
|
# Remove ignored and admin groups
|
||||||
for k, v in usrgrplist.items():
|
for k, v in usrgrplist.items():
|
||||||
if not int(v) == self.settings['authed_sgid'] and not int(v) in self.settings['ignore_groups']:
|
if not int(v) == self.settings['authed_sgid'] and not int(v) in self.settings['ignore_groups']:
|
||||||
|
|||||||
@@ -73,4 +73,4 @@ def update_user_access(user):
|
|||||||
def update_service_groups(user_id):
|
def update_service_groups(user_id):
|
||||||
for service in ServiceAccount.objects.filter(user=user_id, active=True).select_related('service__api'):
|
for service in ServiceAccount.objects.filter(user=user_id, active=True).select_related('service__api'):
|
||||||
api = service.service.api_class
|
api = service.service.api_class
|
||||||
api.update_groups(service.service_uid, service.user.groups.all())
|
api.update_groups(service.service_uid, service.user.groups.all(), service.character)
|
||||||
|
|||||||
Reference in New Issue
Block a user