1 |
|
# authentic2 - versatile identity manager
|
2 |
|
# Copyright (C) 2010-2020 Entr'ouvert
|
3 |
|
#
|
4 |
|
# This program is free software: you can redistribute it and/or modify it
|
5 |
|
# under the terms of the GNU Affero General Public License as published
|
6 |
|
# by the Free Software Foundation, either version 3 of the License, or
|
7 |
|
# (at your option) any later version.
|
8 |
|
#
|
9 |
|
# This program is distributed in the hope that it will be useful,
|
10 |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11 |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12 |
|
# GNU Affero General Public License for more details.
|
13 |
|
#
|
14 |
|
# You should have received a copy of the GNU Affero General Public License
|
15 |
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16 |
|
|
17 |
|
|
18 |
|
from django.contrib import admin
|
19 |
|
|
20 |
|
from . import models
|
21 |
|
from .forms import OIDCClaimMappingForm
|
22 |
|
|
23 |
|
|
24 |
|
class OIDCClaimMappingInline(admin.TabularInline):
|
25 |
|
model = models.OIDCClaimMapping
|
26 |
|
form = OIDCClaimMappingForm
|
27 |
|
extra = 0
|
28 |
|
|
29 |
|
|
30 |
|
class OIDCProviderAdmin(admin.ModelAdmin):
|
31 |
|
list_display = ['name', 'slug', 'client_id', 'ou', 'created', 'modified']
|
32 |
|
inlines = [OIDCClaimMappingInline]
|
33 |
|
list_filter = ['ou']
|
34 |
|
date_hierarchy = 'modified'
|
35 |
|
readonly_fields = ['created', 'modified']
|
36 |
|
prepopulated_fields = {'slug': ('name',)}
|
37 |
|
|
38 |
|
|
39 |
|
class OIDCAccountAdmin(admin.ModelAdmin):
|
40 |
|
list_display = ['provider', 'user', 'sub', 'created', 'modified']
|
41 |
|
search_fields = ['user__first_name', 'user__last_name', 'user__email', 'user__username']
|
42 |
|
date_hierarchy = 'modified'
|
43 |
|
list_filter = ['provider']
|
44 |
|
readonly_fields = ['provider', 'user', 'sub', 'created', 'modified']
|
45 |
|
|
46 |
|
|
47 |
|
admin.site.register(models.OIDCProvider, OIDCProviderAdmin)
|
48 |
|
admin.site.register(models.OIDCAccount, OIDCAccountAdmin)
|
49 |
|
-
|