Does the Django have support for permission for the anonymous users? Reference Topic Link is making it ambiguous for me deciding between its support. Is it talking about a scenario where permission does support anonymous users and its possible consequences w.r.t inactive users?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6bdc87ab-bc43-4a20-a988-1807f500c63b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Wednesday 10 May 2017 09:49:48 Uzair Tariq wrote:
> Consider a scenario in which an anonymous user search for the user
> profiles on the google. He gets public profile link to different
> social network which he can view as the anonymous user but if this
> user is registered and authenticated user on the social site but his
> profile is inactive at the moment he won't be able to view even the
> public profiles as his permission to the profile will be revoke
> thanks to the is_active authentication check. By default in this case
> Anonymous user will have greater surfing space compared with the
> inactive user.
Negative.
An inactive user cannot log in, so for all intents and purposes she is an Anonymous user.
If you use a backend that allows logging in inactive users, then that's a bad choice to make. It's kind of the point of the is_active flag.
So either don't use the feature (use a custom user model that has no is_active flag) or use it and embrace it.
The reason for the is_active flag is that you can moderate bad conduct, lack of payments and so on. If you have no need for it, then that's a good case to implement a custom user model, but be aware, that you will have to delete staff accounts or unmark them as staff if they are no longer allowed to access to the admin.
--
Melvyn Sopacua
django.contrib.auth.models.AnonymousUser
object, allowing the backend to specify custom authorization behavior for anonymous users.--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5368536.rz2B7ec2LH%40devstation.
A Bundle of thank Constantine Covtushenko now the working to Authentication Backend for anonymous and inactive users is clear. Just one last question does the scenario that i defined in my example when you asked for the use case fit this line from the same topic.The support for anonymous users in the permission system allows for a scenario where anonymous users have permissions to do something while inactive authenticated users do not.Can you explain your deduction( The semantics of the line ) from this line of the topic with an example?
On Tuesday, May 9, 2017 at 8:56:47 AM UTC+5, Uzair Tariq wrote:
Does the Django have support for permission for the anonymous users? Reference Topic Link is making it Uzair, for me deciding between its support. Is it talking about a scenario where permission does support anonymous users and its possible consequences w.r.t inactive users?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4d116642-d2ed-4512-a2e8-dd44b715a76a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8a4851aa-77a5-4c9e-b0d6-dc31a85b3262%40googlegroups.com.
On Thursday 11 May 2017 21:59:48 Constantine Covtushenko wrote:
> Let us check terms:
> Anonymous User - is one that is not authenticated. It refers to
> scenarios when someone opens site pages. Even robots can be such
> users.
>
> Inactive Authenticated User - is one that successfully logged in.
*sigh*.
Why would you allow that?
Explain the upside.
In a good system there are no inactive **authenticated** users.
Also good luck restricting permissions for Anonymous users. The functionality exists for allowing anonymous users to do *more*. I'm not saying you can't do it. But if another authentication backend *grants* the permission, there really isn't anything you can do about it.
Please try to understand the whole thing and not just the bible quotes that fit you.
To prevent the anonymous user from doing things, you shall use LoginRequiredMixin or the corresponding decorator.
--
Melvyn Sopacua
On Thursday 11 May 2017 21:59:48 Constantine Covtushenko wrote:
> Let us check terms:
> Anonymous User - is one that is not authenticated. It refers to
> scenarios when someone opens site pages. Even robots can be such
> users.
>
> Inactive Authenticated User - is one that successfully logged in.
*sigh*.
Why would you allow that?
Explain the upside.
In a good system there are no inactive **authenticated** users.
False
instead of deleting accounts; that way, if your applications have any foreign keys to users, the foreign keys won’t break.This doesn’t necessarily control whether or not the user can log in. Authentication backends aren’t required to check for the is_active
flag but the default backend (ModelBackend
) and the RemoteUserBackend
do. You can use AllowAllUsersModelBackend
or AllowAllUsersRemoteUserBackend
if you want to allow inactive users to login. "
Also good luck restricting permissions for Anonymous users. The functionality exists for allowing anonymous users to do *more*. I'm not saying you can't do it. But if another authentication backend *grants* the permission, there really isn't anything you can do about it.
Please try to understand the whole thing and not just the bible quotes that fit you.
Thanks man! So basically my example and deduction of the sentence was right about the anonymous and inactive authenticated users where i stated that the anonymous may be able to view the public profile but if it's an inactive authenticated user because of some reason he may be directed to some other error page because of is_active() permission check and he wont be able to view even public profile because the whole system will logically be promoting about account activation or any sort of equivalent reason/error.
On Friday 12 May 2017 02:38:23 James Schneider wrote:
> On May 12, 2017 12:32 AM, "Melvyn Sopacua" <m.r.s...@gmail.com>
> wrote:
> On Thursday 11 May 2017 21:59:48 Constantine Covtushenko wrote:
> > Let us check terms:
> >
> > Anonymous User - is one that is not authenticated. It refers to
> >
> > scenarios when someone opens site pages. Even robots can be such
> >
> > users.
> >
> >
> >
> > Inactive Authenticated User - is one that successfully logged in.
>
> *sigh*.
>
> Why would you allow that?
>
> Explain the upside.
>
>
>
> In a good system there are no inactive **authenticated** users.
>
>
> Not necessarily. It depends on how narrowly you define 'is_active'.
> Even the user model in the recent Django releases note ambiguity:
>
> "is_active: Boolean. Designates whether this user account should be
> considered active. We recommend that you set this flag to False
> instead of deleting accounts; that way, if your applications have any
> foreign keys to users, the foreign keys won’t break.
>
> This doesn’t necessarily control whether or not the user can log in.
I don't see the ambiguity here. In fact it enforces the notion that inactive users should not be able to log in, because it makes them analog to deleted users.
> You can use AllowAllUsersModelBackend
> <https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contr
> ib.auth.backends.AllowAllUsersModelBackend> or
> AllowAllUsersRemoteUserBackend
> <https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contr
> ib.auth.backends.AllowAllUsersRemoteUserBackend> if
> you want to allow inactive users to login. "
Only use case for this I can see is some form of resubscribe tease (downgraded but slightly better access) that is better handled with proper subscription levels. I don't even get why it's in the core, as it is trivial to write and forces one to evaluate the consequences.
> https://docs.djangoproject.com/en/1.11/ref/contrib/auth/#django.contri
> b.auth.models.User.is_active
>
> It depends on how the user work flow is built. In some cases, the flag
> will disallow the user to log in at all, as you've stated. It renders
> the account unusable, but keeps it in the system for reference. This
> is the intention of the first paragraph from the docs.
>
> In other cases, this flag may represent a user that has changed state
> for some reason (password expired, content subscription ended, length
> of time since last login, etc.). These accounts should be able to at
> least log in to the system with a minimal set of privileges necessary
> to restore the account to it's normal state,
No they don't need to.
What you need is to know why authentication failed. You have all the information to present a form that reinstates the account. And instead of guarding inactive user permissions in numerous places, you only have to do one perhaps two queries to fetch any additional information you'd need in one place.
Again - I don't see the upside.
> Also good luck restricting permissions for Anonymous users. The
> functionality exists for allowing anonymous users to do *more*. I'm
> not saying you can't do it. But if another authentication backend
> *grants* the permission, there really isn't anything you can do about
> it.
>
>
> If that's the case, the permission system may be implemented by the
> programmer incorrectly. Anonymous users with the standard
> authorization back-end cannot have privileges. You end up authorizing
> based on the type of user, not a permission associated with a user.
You missed some context. The intention of OP is to write a custom backend that stores privileges for Anonymous users. So far so good, but, the expectation is to further restrict them.
Since permissions are implemented as "the first backend that says "yes", we grant it", restriction becomes troublesome. In any decent size project there's more then one authentication backend involved and keeping track of who allows what becomes ugly real quick.
--
Melvyn Sopacua