Browse Source

implement displaying users' IP addresses to Admins and SuperUsers.

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
9fb1ba96db
  1. 12
      pyweb/mumble/mmobjects.py
  2. 3
      pyweb/mumble/templates/mumble/mumble.html

12
pyweb/mumble/mmobjects.py

@ -15,6 +15,7 @@
"""
import datetime
import re
from time import time
from django.utils.http import urlquote
@ -197,6 +198,17 @@ class mmPlayer( object ):
is_channel = False;
is_player = True;
def getIpAsString( self ):
""" Get the client's IPv6 address, in a pretty format. """
ip = self.player_obj.address;
# colon-separated string:
ipstr = ':'.join([ ("%02x%02x" % (int(ip[idx]), int(ip[idx+1])))
for idx in range(0, len(ip), 2) ]);
# 0000:0000:0000 -> ::
return re.sub( "((^|:)(0000:)+)", '::', ipstr );
ipaddress = property( getIpAsString );
# kept for compatibility to mmChannel (useful for traversal funcs)
playerCount = property( lambda self: -1, doc="Exists only for compatibility to mmChannel." );

3
pyweb/mumble/templates/mumble/mumble.html

@ -114,6 +114,9 @@
<li>{% trans "Deafened" %}: {{ item.deaf|yesno }}</li>
<li>{% trans "Muted by self" %}: {{ item.selfMute|yesno }}</li>
<li>{% trans "Deafened by self" %}: {{ item.selfDeaf|yesno }}</li>
{% if CurrentUserIsAdmin or user.is_staff %}
<li>{% trans "IP Address" %}: {{ item.ipaddress }}</li>
{% endif %}
</ul>
{% if item.mumbleuser and item.mumbleuser.owner %}
<h2>{% trans "User" %} {{ item.mumbleuser.owner.username|capfirst }}</h2>

Loading…
Cancel
Save