django-cas-server/cas_server/admin.py

67 lines
2.4 KiB
Python
Raw Normal View History

2015-05-27 20:10:06 +00:00
# This program 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 version 3 for
# more details.
#
# You should have received a copy of the GNU General Public License version 3
# along with this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# (c) 2015 Valentin Samir
2015-05-27 19:56:39 +00:00
"""module for the admin interface of the app"""
2015-05-16 21:43:46 +00:00
from django.contrib import admin
2015-05-27 19:56:39 +00:00
from .models import ServiceTicket, ProxyTicket, ProxyGrantingTicket, User, ServicePattern
from .models import Username, ReplaceAttributName, ReplaceAttributValue, FilterAttributValue
from .forms import TicketForm
2015-05-16 21:43:46 +00:00
class ServiceTicketInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`ServiceTicket` in admin interface"""
2015-05-16 21:43:46 +00:00
model = ServiceTicket
extra = 0
form = TicketForm
class ProxyTicketInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`ProxyTicket` in admin interface"""
2015-05-16 21:43:46 +00:00
model = ProxyTicket
extra = 0
form = TicketForm
class ProxyGrantingInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`ProxyGrantingTicket` in admin interface"""
2015-05-16 21:43:46 +00:00
model = ProxyGrantingTicket
extra = 0
form = TicketForm
class UserAdmin(admin.ModelAdmin):
2015-05-27 19:56:39 +00:00
"""`User` in admin interface"""
2015-05-16 21:43:46 +00:00
inlines = (ServiceTicketInline, ProxyTicketInline, ProxyGrantingInline)
2015-05-18 18:30:00 +00:00
class UsernamesInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`Username` in admin interface"""
model = Username
2015-05-18 18:30:00 +00:00
extra = 0
class ReplaceAttributNameInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`ReplaceAttributName` in admin interface"""
2015-05-18 18:30:00 +00:00
model = ReplaceAttributName
extra = 0
class ReplaceAttributValueInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`ReplaceAttributValue` in admin interface"""
2015-05-18 18:30:00 +00:00
model = ReplaceAttributValue
extra = 0
class FilterAttributValueInline(admin.TabularInline):
2015-05-27 19:56:39 +00:00
"""`FilterAttributValue` in admin interface"""
2015-05-18 18:30:00 +00:00
model = FilterAttributValue
extra = 0
2015-05-16 21:43:46 +00:00
class ServicePatternAdmin(admin.ModelAdmin):
2015-05-27 19:56:39 +00:00
"""`ServicePattern` in admin interface"""
inlines = (
UsernamesInline,
ReplaceAttributNameInline,
ReplaceAttributValueInline,
FilterAttributValueInline
)
2015-05-28 13:30:51 +00:00
list_display = ('pos', 'name', 'pattern', 'proxy', 'single_log_out', 'proxy_callback')
2015-05-16 21:43:46 +00:00
admin.site.register(User, UserAdmin)
admin.site.register(ServicePattern, ServicePatternAdmin)