This file is indexed.

/usr/share/pyshared/mumble/admin.py is in python-django-mumble 2.13-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# -*- coding: utf-8 -*-
# kate: space-indent on; indent-width 4; replace-tabs on;

"""
 *  Copyright © 2009-2010, Michael "Svedrin" Ziegler <diese-addy@funzt-halt.net>
 *
 *  Mumble-Django is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This package is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
"""

from django.conf import settings
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _

from mumble.forms  import MumbleServerForm, MumbleAdminForm, MumbleUserAdminForm
from mumble.models import MumbleServer, Mumble, MumbleUser

class MumbleServerAdmin(admin.ModelAdmin):
    list_display   = [ 'dbus', 'get_murmur_online', 'get_murmur_version' ]
    search_fields  = [ 'dbus' ]
    ordering       = [ 'dbus' ]

    form = MumbleServerForm

    def get_murmur_online( self, obj ):
        return obj.online

    get_murmur_online.short_description = _('Master is running')
    get_murmur_online.boolean = True

    def get_murmur_version( self, obj ):
        if obj.online:
            return obj.prettyversion
        return "?"

    get_murmur_version.short_description = _("Server version")



class MumbleAdmin(admin.ModelAdmin):
    """ Specification for the "Server administration" admin section. """

    list_display   = [ 'name', 'srvid', 'get_addr', 'get_port', 'get_murmur_online', 'get_booted',
               'get_is_public', 'get_users_online' ]
    list_filter    = [ 'addr', 'server' ]
    search_fields  = [ 'name', 'addr', 'port' ]
    ordering       = [ 'name' ]
    actions        = [ 'start', 'stop', 'restart', 'enable_autoboot', 'disable_autoboot' ]
    form           = MumbleAdminForm

    def get_murmur_online( self, obj ):
        return obj.server.online

    get_murmur_online.short_description = _('Master is running')
    get_murmur_online.boolean = True

    def get_addr( self, obj ):
        if not obj.addr:
            return "*"
        return obj.addr

    get_addr.short_description = _('Server Address')

    def get_port( self, obj ):
        if not obj.port:
            return '< %d >' % (obj.server.defaultPort + obj.srvid - 1)
        return obj.port

    get_port.short_description = _('Server Port')

    def get_booted( self, obj ):
        return obj.booted

    get_booted.short_description = _('Instance is running')
    get_booted.boolean = True

    def get_users_regged( self, obj ):
        """ Populates the "Registered users" column. """
        if obj.booted:
            return obj.users_regged
        else:
            return '-'

    get_users_regged.short_description = _( 'Registered users' )


    def get_users_online( self, obj ):
        """ Populates the "Online users" column. """
        if obj.booted:
            return obj.users_online
        else:
            return '-'

    get_users_online.short_description = _( 'Online users' )


    def get_channel_count( self, obj ):
        """ Populates the "Channel Count" column. """
        if obj.booted:
            return obj.channel_cnt
        else:
            return '-'

    get_channel_count.short_description = _( 'Channel count' )


    def get_is_public( self, obj ):
        """ Populates the "Public" column. """
        if obj.booted:
            if obj.is_public:
                return _( 'Yes' )
            else:
                return _( 'No' )
        else:
            return '-'

    get_is_public.short_description = _( 'Public' )

    def start(self, request, queryset):
        for mm in queryset:
            mm.setBooted(True)

    start.short_description = _( "Start server instance" )

    def stop(self, request, queryset):
        for mm in queryset:
            mm.setBooted(False)

    stop.short_description = _( "Stop server instance" )

    def restart(self, request, queryset):
        for mm in queryset:
            mm.setBooted(False)
            mm.setBooted(True)

    restart.short_description = _( "Restart server instance" )

    def enable_autoboot(self, request, queryset):
        for mm in queryset:
            mm.autoboot = True

    enable_autoboot.short_description = _( "Enable autoboot" )

    def disable_autoboot(self, request, queryset):
        for mm in queryset:
            mm.autoboot = False

    disable_autoboot.short_description = _( "Disable autoboot" )




class MumbleUserAdmin(admin.ModelAdmin):
    """ Specification for the "Registered users" admin section. """

    list_display   = [ 'name', 'server', 'owner', 'mumbleid', 'get_acl_admin' ]
    list_filter    = [ 'server' ]
    search_fields  = [ 'owner__username', 'name' ]
    actions        = [ 'set_texture_from_gravatar' ]
    ordering       = [ 'owner__username' ]

    form = MumbleUserAdminForm

    def get_acl_admin( self, obj ):
        if obj.server.booted:
            return obj.aclAdmin
        return None

    get_acl_admin.short_description = _('Admin on root channel')
    get_acl_admin.boolean = True

    def set_texture_from_gravatar( self, request, queryset ):
        for mu in queryset:
            mu.setTextureFromGravatar()

    set_texture_from_gravatar.short_description = _( "Set Gravatar as Texture" )


admin.site.register( MumbleServer, MumbleServerAdmin )
admin.site.register( Mumble,       MumbleAdmin )
admin.site.register( MumbleUser,   MumbleUserAdmin )