mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Fixed mumble service
This commit is contained in:
@@ -26,10 +26,25 @@ from zlib import compress, decompress, error
|
|||||||
|
|
||||||
from mctl import MumbleCtlBase
|
from mctl import MumbleCtlBase
|
||||||
|
|
||||||
from utils import ObjectInfo
|
|
||||||
|
|
||||||
import Ice, IcePy, tempfile
|
import Ice, IcePy, tempfile
|
||||||
|
|
||||||
|
class ObjectInfo( object ):
|
||||||
|
""" Wraps arbitrary information to be easily accessed. """
|
||||||
|
|
||||||
|
def __init__( self, **kwargs ):
|
||||||
|
self.__dict__ = kwargs;
|
||||||
|
|
||||||
|
def __str__( self ):
|
||||||
|
return unicode( self );
|
||||||
|
|
||||||
|
def __repr__( self ):
|
||||||
|
return unicode( self );
|
||||||
|
|
||||||
|
def __unicode__( self ):
|
||||||
|
return unicode( self.__dict__ );
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
return self.__dict__[key]
|
||||||
|
|
||||||
def protectDjangoErrPage( func ):
|
def protectDjangoErrPage( func ):
|
||||||
""" Catch and reraise Ice exceptions to prevent the Django page from failing.
|
""" Catch and reraise Ice exceptions to prevent the Django page from failing.
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from mumble.models import Mumble, MumbleUser
|
|
||||||
from sso.services import BaseService
|
from sso.services import BaseService
|
||||||
from MumbleCtlIce import MumbleCtlIce
|
from MumbleCtlIce import MumbleCtlIce
|
||||||
|
|
||||||
@@ -8,8 +7,8 @@ class MumbleService(BaseService):
|
|||||||
'require_password': True,
|
'require_password': True,
|
||||||
'provide_login': False,
|
'provide_login': False,
|
||||||
'mumble_server_id': 2,
|
'mumble_server_id': 2,
|
||||||
'name_format': r'%(alliance)s - %(corporation)s - %(name)s'
|
'name_format': r'%(alliance)s - %(corporation)s - %(name)s',
|
||||||
'connection_string': 'Meta:tcp -h 127.0.0.1 -p 6502'
|
'connection_string': 'Meta:tcp -h 127.0.0.1 -p 6502',
|
||||||
'ice_file': 'Murmur.ice' }
|
'ice_file': 'Murmur.ice' }
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -46,7 +45,8 @@ class MumbleService(BaseService):
|
|||||||
""" Delete a user by uid """
|
""" Delete a user by uid """
|
||||||
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||||
if len(ids) > 0:
|
if len(ids) > 0:
|
||||||
for acc in ids:
|
for accid in ids:
|
||||||
|
acc = ids[accid]
|
||||||
self.mumblectl.unregisterPlayer(self.settings['mumble_server_id'], acc['userid'])
|
self.mumblectl.unregisterPlayer(self.settings['mumble_server_id'], acc['userid'])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
@@ -60,11 +60,22 @@ class MumbleService(BaseService):
|
|||||||
""" Enable a user by uid """
|
""" Enable a user by uid """
|
||||||
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||||
if len(ids) > 0:
|
if len(ids) > 0:
|
||||||
for acc in ids:
|
for accid in ids:
|
||||||
|
acc = ids[accid]
|
||||||
self.mumblectl.setRegistration(self.settings['mumble_server_id'], acc['userid'], acc['name'], acc['email'], password)
|
self.mumblectl.setRegistration(self.settings['mumble_server_id'], acc['userid'], acc['name'], acc['email'], password)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
if self.raw_add_user(uid, '', password):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def set_user(self, uid, name = ''):
|
||||||
|
""" Set values ona user by uid """
|
||||||
|
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||||
|
if len(ids) > 0:
|
||||||
|
for accid in ids:
|
||||||
|
acc = ids[accid]
|
||||||
|
self.mumblectl.setRegistration(self.settings['mumble_server_id'], acc['userid'], name, acc['email'], acc['pw'])
|
||||||
|
return True
|
||||||
|
|
||||||
def reset_password(self, uid, password):
|
def reset_password(self, uid, password):
|
||||||
""" Reset the user's password """
|
""" Reset the user's password """
|
||||||
|
|||||||
Reference in New Issue
Block a user