Re: Using auth stuff without installing the auth app

2017-07-23 Thread Mark Steward
And it was reverted with https://github.com/django/django/pull/7410 because of a link to ContentType. I've recently run into this (as an infrequent user of Django) with a custom backend and middleware that I'd like to keep reusable by using the standard login and authenticate methods. I'm also

Re: Using auth stuff without installing the auth app

2016-08-28 Thread Aymeric Augustin
On 23 Mar 2016, at 01:57, Matt wrote: > I like to use the authentication machinery in Django, without explicitly > putting 'django.contrib.auth' in INSTALLED_APPS. This prevents a bunch of > unused tables from being creating in the database. Hello, For the record, we came to the following r

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Matt
First pass (still haven't figured out how to test it): https://github.com/satchamo/django/commit/d5accc17122cd7486a5e5fd2d63b4c1f732a5c68 It's not obvious from the diff, but AnonymousUser depends on permission stuff (see AnonymousUser._get_groups/_get_user_permissions). On top of that, Anonymous

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Florian Apolloner
On Thursday, March 24, 2016 at 12:07:14 AM UTC+1, Matt wrote: > > > the ModelBackend uses the Permission model, so why would that ever work > without beeing in INSTALLED_APPS? > > ModelBackend.authenticate() doesn't use the permissions models. And that's > the method that gets used when authen

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Matt
> the ModelBackend uses the Permission model, so why would that ever work without beeing in INSTALLED_APPS? ModelBackend.authenticate() doesn't use the permissions models. And that's the method that gets used when authenticating a user. If I did something like `user.has_perm()`, things would b

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Florian Apolloner
On Wednesday, March 23, 2016 at 8:36:39 PM UTC+1, Matt wrote: > > I created https://code.djangoproject.com/ticket/26401 > > > > Since the usage of any of the ba

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Matt
I created https://code.djangoproject.com/ticket/26401 > Since the usage of any of the backends requires models I used the ModelBackend with no issues in Django 1.8 (without auth in INSTALLED_APPS). So that is the place I want to refactor. I'm trying to write a regression test for this, but I c

Re: Using auth stuff without installing the auth app

2016-03-23 Thread Florian Apolloner
Oh yes, this is a bug. We should ensure that RemoteUser backend is imported in the middleware itself or that backends.py does not trigger any model imports. Since the usage of any of the backends requires models, the import there seems fine -- I'd import RemoteUserBackend in RemoteUserMiddlewar

Using auth stuff without installing the auth app

2016-03-22 Thread Matt
I like to use the authentication machinery in Django, without explicitly putting 'django.contrib.auth' in INSTALLED_APPS. This prevents a bunch of unused tables from being creating in the database. This was possible in earlier version of Django. In 1.8, a spurious warning was generated, but tha