Projet

Général

Profil

0001-removed-django-admin-tools-22626.patch

Anonyme, 16 juillet 2018 14:28

Télécharger (18,5 ko)

Voir les différences:

Subject: [PATCH] removed django-admin-tools (#22626)

 debian-jessie/control                         |   1 -
 debian-wheezy/control                         |   1 -
 doc/installation_modes.rst                    |   1 -
 .../authentic2_plugin_template/__init__.py    |   8 +-
 .../authentic2_plugin_template/dashboard.py   |  11 --
 setup.py                                      |   1 -
 .../migrations/0002_auto_20150410_1823.py     |   9 --
 src/authentic2/dashboard.py                   | 130 ------------------
 .../dashboard_migrations/0001_initial.py      |  33 -----
 src/authentic2/idp/saml/__init__.py           |  11 --
 src/authentic2/menu.py                        |  30 ----
 .../menu_migrations/0001_initial.py           |  29 ----
 src/authentic2/settings.py                    |   4 -
 src/authentic2/urls.py                        |   1 -
 src/authentic2_auth_oidc/__init__.py          |   9 --
 src/authentic2_idp_cas/__init__.py            |  11 +-
 src/authentic2_idp_oidc/__init__.py           |  11 +-
 17 files changed, 4 insertions(+), 297 deletions(-)
 delete mode 100644 samples/authentic2-plugin-template/src/authentic2_plugin_template/dashboard.py
 delete mode 100644 src/authentic2/dashboard.py
 delete mode 100644 src/authentic2/dashboard_migrations/0001_initial.py
 delete mode 100644 src/authentic2/menu.py
 delete mode 100644 src/authentic2/menu_migrations/0001_initial.py
debian-jessie/control
14 14
Depends: ${misc:Depends}, ${python:Depends},
15 15
    python-requests (>=2.3),
16 16
    python-django-model-utils (>= 2.4),
17
    python-django-admin-tools (>= 0.5.2),
18 17
    python-lasso (>= 2.4.1.100),
19 18
    python-dnspython (>= 1.10),
20 19
    python-django-select2 (>= 5),
debian-wheezy/control
14 14
Depends: ${misc:Depends}, ${python:Depends},
15 15
    python-requests (>=2.3),
16 16
    python-django-model-utils (>= 2.4),
17
    python-django-admin-tools (>= 0.5.2),
18 17
    python-lasso (>= 2.4.1.100),
19 18
    python-dnspython (>= 1.10),
20 19
    python-django-select2 (>= 5),
doc/installation_modes.rst
17 17
- Django>=1.7.6,<1.9
18 18
- requests>=2.
19 19
- django-model-utils>=2
20
- django-admin-tools>=0.5.2
21 20
- dnspython>=1.12
22 21
- django-select2>=4.3.0
23 22
- django-tables2>=1.0
samples/authentic2-plugin-template/src/authentic2_plugin_template/__init__.py
26 26
    def get_idp_backends(self):
27 27
        return []
28 28

  
29
    def get_admin_modules(self):
30
        from . import dashboard
31
        return dashboard.get_admin_modules()
32

  
33 29
    def service_list(self, request):
34 30
        '''For IdP plugins this method add links to the user homepage.
35
           
31

  
36 32
           It must return a list of authentic2.utils.Service objects, each
37 33
           object has a name and can have an url and some actions.
38 34

  
......
49 45
    def logout_list(self, request):
50 46
        '''For IdP or SP plugins this method add actions to logout from remote
51 47
           IdP or SP.
52
           
48

  
53 49
           It must returns a list of HTML fragments, each fragment is
54 50
           responsible for calling the view doing the logout. Views are usually
55 51
           called using <img/> or <iframge/> tags and finally redirect to an
samples/authentic2-plugin-template/src/authentic2_plugin_template/dashboard.py
1
from django.utils.translation import ugettext_lazy as _
2

  
3
from admin_tools.dashboard import modules
4

  
5

  
6
def get_admin_modules():
7
    '''Show Client model in authentic2 admin'''
8
    model_list = modules.ModelList(_('Authentic2 Plugin Template'),
9
            models=('authentic2_plugin_template.models.*',))
10
    return (model_list,)
11

  
setup.py
112 112
          'django>=1.8,<1.9',
113 113
          'requests>=2.3',
114 114
          'django-model-utils>=2.4',
115
          'django-admin-tools>=0.6,<0.7',
116 115
          'dnspython>=1.10',
117 116
          'Django-Select2>5,<6',
118 117
          'django-tables2>=1.0,<1.1',
src/authentic2/custom_user/migrations/0002_auto_20150410_1823.py
38 38
class Migration(migrations.Migration):
39 39
    dependencies = [
40 40
        ('custom_user', '0001_initial'),
41
        ('menu', '__first__'),
42 41
        ('admin', '__first__'),
43 42
    ]
44 43

  
......
55 54
                field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
56 55
                preserve_default=True
57 56
            ),
58
            # Django admin-tools menu bookmark
59
            ThirdPartyAlterField(
60
                app_label='menu',
61
                model_name='bookmark',
62
                name='user',
63
                field=models.ForeignKey(to=settings.AUTH_USER_MODEL),
64
                preserve_default=True
65
            ),
66 57
    ]
src/authentic2/dashboard.py
1
"""
2
This file was generated with the customdashboard management command, it
3
contains the two classes for the main dashboard and app index dashboard.
4
You can customize these classes as you want.
5

  
6
To activate your index dashboard add the following to your settings.py::
7
    ADMIN_TOOLS_INDEX_DASHBOARD = 'authentic2.dashboard.CustomIndexDashboard'
8

  
9
And to activate the app index dashboard::
10
    ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'authentic2.dashboard.CustomAppIndexDashboard'
11
"""
12

  
13
from django.conf import settings
14
from django.utils.translation import ugettext_lazy as _
15
from django.core.urlresolvers import reverse
16

  
17
from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
18
from admin_tools.utils import get_admin_site_name
19

  
20
from . import plugins, compat
21

  
22
class CustomIndexDashboard(Dashboard):
23
    """
24
    Custom index dashboard for authentic2.
25
    """
26
    def init_with_context(self, context):
27
        site_name = get_admin_site_name(context)
28
        # append a link list module for "quick links"
29
        self.children.append(modules.LinkList(
30
            _('Quick links'),
31
            layout='inline',
32
            draggable=False,
33
            deletable=False,
34
            collapsible=False,
35
            children=[
36
                [_('Return to site'), '/'],
37
                [_('Change password'),
38
                 reverse('%s:password_change' % site_name)],
39
                [_('Log out'), reverse('%s:logout' % site_name)],
40
            ]
41
        ))
42

  
43
        # append an app list module for "Applications"
44
        User = compat.get_user_model()
45
        user_class = '{0}.{1}'.format(User.__module__, User.__name__)
46
        self.children.append(modules.ModelList(
47
            _('Users and groups'),
48
            models=(user_class,
49
                'django.contrib.auth.models.*',
50
                'authentic2.models.Attribute',
51
                'authentic2.models.PasswordReset'),
52
        ))
53
        self.children.append(modules.ModelList(
54
            _('Access control'),
55
            models=('authentic2.a2_rbac.models.OrganizationalUnit',
56
                'authentic2.a2_rbac.models.Role',
57
                'authentic2.a2_rbac.models.Permission',
58
                'authentic2.models.ServiceRole',
59
            ),
60
        ))
61
        self.children.append(modules.ModelList(
62
            _('Debug'),
63
            models=(
64
                'authentic2.models.AttributeValue',
65
                'authentic2.nonce.models.Nonce',
66
                'authentic2.models.LogoutUrl',
67
                'authentic2.models.AuthenticationEvent',
68
                'authentic2.models.UserExternalId',
69
                'authentic2.models.DeletedUser',
70
                'django.contrib.sessions.*',
71
            ),
72
        ))
73
        for plugin in plugins.get_plugins():
74
            if hasattr(plugin, 'get_admin_modules') and callable(plugin.get_admin_modules):
75
                plugin_modules = plugin.get_admin_modules()
76
                for module in plugin_modules:
77
                    self.children.append(module)
78

  
79
        # append a recent actions module
80
        self.children.append(modules.RecentActions(_('Recent Actions'), 5))
81

  
82
        # append another link list module for "support".
83
        self.children.append(modules.LinkList(
84
            _('Support'),
85
            children=[
86
                {
87
                    'title': _('Authentic2 documentation'),
88
                    'url': 'http://pythonhosted.org/authentic2/',
89
                    'external': True,
90
                },
91
                {
92
                    'title': _('Authentic2 project'),
93
                    'url': 'http://dev.entrouvert.org/projects/authentic/',
94
                    'external': True,
95
                },
96
                {
97
                    'title': _('Authentic Mailing List'),
98
                    'url': 'http://listes.entrouvert.com/info/authentic',
99
                    'external': True,
100
                },
101
            ]
102
        ))
103

  
104

  
105
class CustomAppIndexDashboard(AppIndexDashboard):
106
    """
107
    Custom app index dashboard for authentic2.
108
    """
109

  
110
    # we disable title because its redundant with the model list module
111
    title = ''
112

  
113
    def __init__(self, *args, **kwargs):
114
        AppIndexDashboard.__init__(self, *args, **kwargs)
115

  
116
        # append a model list module and a recent actions module
117
        self.children += [
118
            modules.ModelList(self.app_title, self.models),
119
            modules.RecentActions(
120
                _('Recent Actions'),
121
                include_list=self.get_app_content_types(),
122
                limit=5
123
            )
124
        ]
125

  
126
    def init_with_context(self, context):
127
        """
128
        Use this method if you need to access the request context.
129
        """
130
        return super(CustomAppIndexDashboard, self).init_with_context(context)
src/authentic2/dashboard_migrations/0001_initial.py
1
# -*- coding: utf-8 -*-
2
from __future__ import unicode_literals
3

  
4
from django.db import models, migrations
5
from django.conf import settings
6

  
7

  
8
class Migration(migrations.Migration):
9

  
10
    dependencies = [
11
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
    ]
13

  
14
    operations = [
15
        migrations.CreateModel(
16
            name='DashboardPreferences',
17
            fields=[
18
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19
                ('data', models.TextField()),
20
                ('dashboard_id', models.CharField(max_length=100)),
21
                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
22
            ],
23
            options={
24
                'ordering': ('user',),
25
                'db_table': 'admin_tools_dashboard_preferences',
26
            },
27
            bases=(models.Model,),
28
        ),
29
        migrations.AlterUniqueTogether(
30
            name='dashboardpreferences',
31
            unique_together=set([('user', 'dashboard_id')]),
32
        ),
33
    ]
src/authentic2/idp/saml/__init__.py
22 22
    def get_apps(self):
23 23
        return ['authentic2.idp.saml']
24 24

  
25
    def get_admin_modules(self):
26
        from admin_tools.dashboard import modules
27
        return [modules.ModelList(
28
            _('SAML2'),
29
            models=(
30
                'authentic2.saml.models.LibertyProvider',
31
                'authentic2.saml.models.SPOptionsIdPPolicy',
32
                'authentic2.saml.models.IdPOptionsSPPolicy',
33
            ),
34
        )]
35

  
36 25
    def get_idp_backends(self):
37 26
        return ['authentic2.idp.saml.backend.SamlBackend']
38 27

  
src/authentic2/menu.py
1
"""
2
This file was generated with the custommenu management command, it contains
3
the classes for the admin menu, you can customize this class as you want.
4

  
5
To activate your custom menu add the following to your settings.py::
6
    ADMIN_TOOLS_MENU = 'authentic2.menu.CustomMenu'
7
"""
8

  
9
from django.core.urlresolvers import reverse
10
from django.utils.translation import ugettext_lazy as _
11

  
12
from admin_tools.menu import items, Menu
13

  
14

  
15
class CustomMenu(Menu):
16
    """
17
    Custom Menu for authentic2 admin site.
18
    """
19
    def __init__(self, **kwargs):
20
        Menu.__init__(self, **kwargs)
21
        self.children += [
22
            items.MenuItem(_('Dashboard'), reverse('admin:index')),
23
            items.Bookmarks(),
24
        ]
25

  
26
    def init_with_context(self, context):
27
        """
28
        Use this method if you need to access the request context.
29
        """
30
        return super(CustomMenu, self).init_with_context(context)
src/authentic2/menu_migrations/0001_initial.py
1
# -*- coding: utf-8 -*-
2
from __future__ import unicode_literals
3

  
4
from django.db import models, migrations
5
from django.conf import settings
6

  
7

  
8
class Migration(migrations.Migration):
9

  
10
    dependencies = [
11
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
12
    ]
13

  
14
    operations = [
15
        migrations.CreateModel(
16
            name='Bookmark',
17
            fields=[
18
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
19
                ('url', models.CharField(max_length=255)),
20
                ('title', models.CharField(max_length=255)),
21
                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
22
            ],
23
            options={
24
                'ordering': ('id',),
25
                'db_table': 'admin_tools_menu_bookmark',
26
            },
27
            bases=(models.Model,),
28
        ),
29
    ]
src/authentic2/settings.py
113 113
    'django.contrib.auth',
114 114
    'django.contrib.sessions',
115 115
    'django.contrib.messages',
116
    'admin_tools',
117
    'admin_tools.theming',
118
    'admin_tools.menu',
119
    'admin_tools.dashboard',
120 116
    'django.contrib.admin',
121 117
    'django_select2',
122 118
    'django_tables2',
src/authentic2/urls.py
24 24
not_homepage_patterns += [
25 25
    url(r'^accounts/', include(app_settings.A2_REGISTRATION_URLCONF)),
26 26
    url(r'^admin/', include(admin.site.urls)),
27
    url(r'^admin_tools/', include('admin_tools.urls')),
28 27
    url(r'^idp/', include('authentic2.idp.urls')),
29 28
    url(r'^manage/', include('authentic2.manager.urls')),
30 29
    url(r'^api/', include('authentic2.api_urls'))
src/authentic2_auth_oidc/__init__.py
66 66
            return
67 67
        logger.info(u'revoked token from OIDC provider %s', provider.issuer)
68 68

  
69
    def get_admin_modules(self):
70
        from admin_tools.dashboard import modules
71
        return [modules.ModelList(
72
            _('OpenID Connect authentication'),
73
            models=(
74
                'authentic2_auth_oidc.models.OIDCProvider',
75
                'authentic2_auth_oidc.models.OIDCAccount',
76
            ),
77
        )]
src/authentic2_idp_cas/__init__.py
30 30
            }
31 31
            content = render_to_string('authentic2_idp_cas/logout_fragment.html', ctx)
32 32
            fragments.append(content)
33
        return fragments
34

  
35
    def get_admin_modules(self):
36
        from admin_tools.dashboard import modules
37
        return [modules.ModelList(
38
            _('CAS'),
39
            models=(
40
                '%s.*' % __name__,
41
            ),
42
        )]
33
        return fragments
src/authentic2_idp_oidc/__init__.py
31 31
                render_to_string(
32 32
                    'authentic2_idp_oidc/logout_fragment.html',
33 33
                    ctx))
34
        return fragments
35

  
36
    def get_admin_modules(self):
37
        from admin_tools.dashboard import modules
38
        return [modules.ModelList(
39
            _('OpenID Connect authentication'),
40
            models=(
41
                'authentic2_idp_oidc.models.*',
42
            ),
43
        )]
34
        return fragments
44
-