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 utils import ObjectInfo
|
||||
|
||||
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 ):
|
||||
""" 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 MumbleCtlIce import MumbleCtlIce
|
||||
|
||||
@@ -8,8 +7,8 @@ class MumbleService(BaseService):
|
||||
'require_password': True,
|
||||
'provide_login': False,
|
||||
'mumble_server_id': 2,
|
||||
'name_format': r'%(alliance)s - %(corporation)s - %(name)s'
|
||||
'connection_string': 'Meta:tcp -h 127.0.0.1 -p 6502'
|
||||
'name_format': r'%(alliance)s - %(corporation)s - %(name)s',
|
||||
'connection_string': 'Meta:tcp -h 127.0.0.1 -p 6502',
|
||||
'ice_file': 'Murmur.ice' }
|
||||
|
||||
@property
|
||||
@@ -46,7 +45,8 @@ class MumbleService(BaseService):
|
||||
""" Delete a user by uid """
|
||||
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||
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'])
|
||||
|
||||
return True
|
||||
@@ -60,11 +60,22 @@ class MumbleService(BaseService):
|
||||
""" Enable a user by uid """
|
||||
ids = self.mumblectl.getRegisteredPlayers(self.settings['mumble_server_id'], uid)
|
||||
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)
|
||||
return True
|
||||
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):
|
||||
""" Reset the user's password """
|
||||
|
||||
Reference in New Issue
Block a user