Browse Source

implement setACL.

no beauty...
Natenom/support-murmur-13-1446181288462
withgod 16 years ago
parent
commit
93c72f306d
  1. 72
      pyweb/mumble/mctl.py

72
pyweb/mumble/mctl.py

@ -148,7 +148,6 @@ class MumbleCtlIce(MumbleCtlBase):
import Murmur import Murmur
acls = self._getIceServerObject(srvid).getACL(identifier) acls = self._getIceServerObject(srvid).getACL(identifier)
ret = [] ret = []
for x in acls: for x in acls:
if isinstance(x, list): if isinstance(x, list):
tmp = [] tmp = []
@ -169,26 +168,26 @@ class MumbleCtlIce(MumbleCtlBase):
def getAllConf(self, srvid): def getAllConf(self, srvid):
return MumbleCtlIce.setUnicodeFlag(self._getIceServerObject(srvid).getAllConf()) return MumbleCtlIce.setUnicodeFlag(self._getIceServerObject(srvid).getAllConf())
def newServer(self):
def newServer(self):
return self.meta.newServer().id() return self.meta.newServer().id()
def deleteServer( self, srvid ):
if self._getIceServerObject(srvid).isRunning():
self._getIceServerObject(srvid).stop()
def deleteServer( self, srvid ):
if self._getIceServerObject(srvid).isRunning():
self._getIceServerObject(srvid).stop()
self._getIceServerObject(srvid).delete() self._getIceServerObject(srvid).delete()
def setSuperUserPassword(self, srvid, value):
def setSuperUserPassword(self, srvid, value):
self.meta.setSuperUserPassword(srvid, value) self.meta.setSuperUserPassword(srvid, value)
def setConf(self, srvid, key, value): def setConf(self, srvid, key, value):
#print "%s server %s/%s" % (srvid, key, value)
#print "%s server %s/%s" % (srvid, key, value)
self._getIceServerObject(srvid).setConf(key, value) self._getIceServerObject(srvid).setConf(key, value)
def registerPlayer(self, srvid, name):
return self._getIceServerObject(srvid).registerPlayer(name)
def unregisterPlayer(self, srvid, mumbleid):
def registerPlayer(self, srvid, name):
return self._getIceServerObject(srvid).registerPlayer(name)
def unregisterPlayer(self, srvid, mumbleid):
self._getIceServerObject(srvid).unregisterPlayer(mumbleid) self._getIceServerObject(srvid).unregisterPlayer(mumbleid)
def setRegistration(self, srvid, mumbleid, name, email, password): def setRegistration(self, srvid, mumbleid, name, email, password):
@ -197,15 +196,50 @@ class MumbleCtlIce(MumbleCtlBase):
user.email = email user.email = email
user.pw = password user.pw = password
#print user #print user
# update*r*egistration r is lowercase...
# update*r*egistration r is lowercase...
return self._getIceServerObject(srvid).updateregistration(user) return self._getIceServerObject(srvid).updateregistration(user)
def setACL(self, srvid, acl): def setACL(self, srvid, acl):
'''
print "xxxx" print "xxxx"
print srvid print srvid
print acl print acl
print "xxxx"
#self._getIceServerObject(srvid).setACL(*acl.pack())
print "--"
print acl.pack()
print "xxxx"
'''
import Murmur
tmp = acl.pack()
id = tmp[0]
_acls = tmp[1]
acls = []
_groups = tmp[2]
groups = []
inherit = tmp[3]
for x in _acls:
acl = Murmur.ACL()
acl.applyHere = x[0]
acl.applySubs = x[1]
acl.inherited = x[2]
acl.playerid = x[3]
acl.group = x[4]
acl.allow = x[5]
acl.deny = x[6]
acls.append(acl)
for x in _groups:
group = Murmur.Group()
group.name = x[0]
group.inherited = x[1]
group.inherit = x[2]
group.inheritable = x[3]
group.add = x[4]
group.remove = x[5]
group.members = x[6]
groups.append(group)
self._getIceServerObject(srvid).setACL(id, acls, groups, inherit)
@staticmethod @staticmethod
def setUnicodeFlag(data): def setUnicodeFlag(data):
@ -360,5 +394,7 @@ if __name__ == "__main__":
print "getAllConf(x) [%s]" % (dbusCtl.getAllConf(x) == iceCtl.getAllConf(x)) print "getAllConf(x) [%s]" % (dbusCtl.getAllConf(x) == iceCtl.getAllConf(x))
print "getRegisteredPlayers(x) [%s]" % (dbusCtl.getRegisteredPlayers(x) == iceCtl.getRegisteredPlayers(x)) print "getRegisteredPlayers(x) [%s]" % (dbusCtl.getRegisteredPlayers(x) == iceCtl.getRegisteredPlayers(x))
#print iceCtl.getRegisteredPlayers(x)
#print iceCtl.getACL(x, 0) #print iceCtl.getACL(x, 0)
Loading…
Cancel
Save