Giter Site home page Giter Site logo

django-su's People

Contributors

adamcharnock avatar aljosa avatar aymericderbois avatar bashu avatar blueyed avatar bradbeattie avatar bufke avatar chroniton avatar dfrdmn avatar fredpalmer avatar gengue avatar ghferrari avatar goinnn avatar gustavo-sdo avatar johnsmclay avatar katzj avatar lagg avatar leknarf avatar marknotfound avatar mroci avatar petrdlouhy avatar seleznev-nvkz avatar somewes avatar thisboyiscrazy avatar wolever avatar xrmx avatar yakky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-su's Issues

Urls use deprecated syntax

Consider changing to simply

from . import views
urlpatterns = patterns("django_su.views",
    url(r"^$", views.su_logout, name="su_logout"),
    url(r"^login/$", views.su_login, name="su_login"),
    url(r"^(?P<user_id>-?[\d]+)/$", views.login_as_user, name="login_as_user"),
)
urlpatterns = patterns("django_su.views",
    url(r"^$", "su_logout", name="su_logout"),
    url(r"^login/$", "su_login", name="su_login"),
    url(r"^(?P<user_id>-?[\d]+)/$", "login_as_user", name="login_as_user"),
)

Pass the target user to the SU_LOGIN function where available

Adam, thanks for your sweet little app. My use case needs us to restrict su permissions for users based on who they're trying to become. So I'd like the target user passed as a second parameter to the SU_LOGIN function.

I've forked and committed something that's working for me so far. It maintains backwards compatibility by using introspection to discover how many arguments the SU_LOGIN function takes. It only passes the second argument if the function takes two arguments. I wondered what you thought so far, before I issue a pull request.

Staff can login as superuser

This package is great work, thanks !

I've tested it for my app, and because I need any of my staff to login as a user, I added the login callback:
SU_LOGIN_CALLBACK = "example.utils.su_login_callback"

The problem is that now, any staff can login as superuser and edit their own permissions...

How can I restrict the login as to non-staff user only ?

Thanks

Update category @ Django Packages / Feature Request

Just thought you may like to know your app is listed externally here:
https://www.djangopackages.com/packages/p/django-su/

However, there appears to be a more appropriate category and when searching for packages that provide similar functionality yours may not get evaluated:
https://www.djangopackages.com/grids/g/user-switching/

Since I already knew about and utilize your app, I thought you should know. It's extremely useful. I would also like to request one feature:

Please allow the ability to enable staff users to impersonate users and/or the ability for a super-user to assign the permission to staff user to impersonate a user.

Logging in as a user shouldn't change the user's `last_login` timestamp

This happens when we call Django's login() function, which triggers the user_logged_in signal. This in turn triggers django's update_last_login().

The only obvious way I can see to achieve this is to change the last_login value back after it has been set, but this does not feel ideal. Better suggestions welcome!

Django 1.10 compatibility: RemovedInDjango110Warning

There is warning about future incompatibility with Django 1.10

/home/petr/soubory/programovani/Auto-mat/DPNK/dpnk/env/lib/python3.4/site-packages/django_su/urls.py:12: RemovedInDjango110Warning: django.conf.urls.patterns() is deprecated and will be removed in Django 1.10. Update your urlpatterns to be a list of django.conf.urls.url() instances instead.

Add a License...

I noticed that your package doesn't have a license... Could you please add one?

I hope you'll select an open-source licence (BSD, MIT, GPL -- in that order), but it's up to you. I can't really use any of your code without a license... :-/

Adding SuBackend to AUTHENTICATION_BACKENDS

I didn't see this in the documentation but it appears that one needs to add this to the authentication backends for django_su to work:

AUTHENTICATION_BACKENDS = (
    # Needed to login by username in Django admin
    "django.contrib.auth.backends.ModelBackend",

    # Needed for django su to work
    "django_su.backends.SuBackend",
)

Please advise.

Django==1.5.2
django-su==0.3.2

Any chance of a new version on pypi?

I prefer installing from pypi. Version 0.8 does what I need, but I no longer have any django projects that use anything older than Django 1.11. It'd be nice to have a version that explicitly supports 1.11 and pythons newer than 3.4, which is after all end-of-lifed. When 1.11 is eol, another version that officially does not support python 2 would also be appreciated.

error updating to 0.3.2

I get the following error trying to --update django-su. Any ideas?

Downloading/unpacking django-su==0.3.2 (from -r statuspath/Documentation/requirements.txt (line 30))
Running setup.py egg_info for package django-su
Traceback (most recent call last):
File "", line 16, in
File "/tmp/pip-build/django-su/setup.py", line 6, in
from django_su import version
ImportError: cannot import name version
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 16, in

File "/tmp/pip-build/django-su/setup.py", line 6, in

from django_su import __version__

ImportError: cannot import name version


Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/django-su
Storing complete log in /root/.pip/pip.log
[ec2-user@qa1 ~]$ sudo pip install django-su --upgrade
Downloading/unpacking django-su from https://pypi.python.org/packages/source/d/django-su/django-su-0.3.2.tar.gz#md5=6ce232bb52d0124d3e957e9c634e91de
Running setup.py egg_info for package django-su
Traceback (most recent call last):
File "", line 16, in
File "/tmp/pip-build/django-su/setup.py", line 6, in
from django_su import version
ImportError: cannot import name version
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 16, in

File "/tmp/pip-build/django-su/setup.py", line 6, in

from django_su import __version__

ImportError: cannot import name version


Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/django-su

Broken link to log in as "group"

The "Login as" object tool shows up in Group. I don't see any reason for this. If I'm not mistaken, it would make sense to place the change_form.html in /admin/auth/user/ instead of /admin/auth/

Usage with custom AUTH_USER_MODEL

The django-su application doesn't work out of the box. It requires setting of template paths. Please mention this in the README for future developers. My code looks like:

@admin.register(models.UserProfile)
class UserProfileAdmin(UserAdmin):
    change_form_template = "admin/auth/user/change_form.html"
    change_list_template = "admin/auth/user/change_list.html"

Support for string view arguments is deprecated

According to logs (running with Django 1.9.4):
django_su/urls.py:10: RemovedInDjango110Warning: Support for string view arguments to url() is deprecated and will be removed in Django 1.10 (got su_logout). Pass the callable instead.

avoid entering user_logged_in when using django-su

Hi!

I want to log user log in date using something like this:

from django.contrib.auth.signals import user_logged_in
def set_last_seen(sender, user, request, **kwargs):
    if not len(request.session.get("exit_users_pk", default=[])):
       user.profile.last_seen = timezone.now()
       user.profile.save()
user_logged_in.connect(set_last_seen)

But looks like exit_users_pk is being populated after the signal is sent, cause it's always empty.
Is there a way we can check in this signal if the login is triggered by django-su?

Customize presentation of text on the admin site

I am using django-suit.
I made a small change in my base_site.html (extended) file to set the text display otherwise to the accessed user.

admin_user_1

After access:

admin_user_2

The code:

{% block welcome-msg %}
  {% if IS_SU %}
    <a href="/su/" title="{% trans 'Restabelecer papel original' %}">{% trans 'Você' %}</a>{% trans ' acessou como,' %}
  {% else %}
    {% trans 'Welcome,' %}
  {% endif %}
  <strong>
    {% filter force_escape %}
      {% firstof user.first_name user.username %}
    {% endfilter %}
  </strong>.
{% endblock %}

After using this not able to login as super admin.

I have setup a fresh Django project in my local with super admin and install the plugin after that I am facing problem. The Dijango landing page is not opening up it say 404 and I am not able to login into other Django admin after using this but if I remove this plugin I am able to login in the Django admin with my existing superuser account . I have followed the step for 1 to 4 written in the description for the plugin. I am very new to Django can anyone help me. If anyone need screenshot or code sample I can give that . Thank You

paint1
paint2

User not found

Hello,

When I attempt to use django-su to switch to a different user, I get the error "User not found". Nothing comes back in the output of the built in Django server and that is all that shows. I am using Django 1.5.1 with the latest version of django-su.

Any ideas?

A couple of quick suggestions

Hello!.

A couple of quick suggestions for the module, hoping you guys like them:

  • Combo/Autocomplete selector: since many times user logins are dictated by ids, or national id, or whatever, add Name and Surname both in the displayed options and as searchable strings for the ajax selects, i.e., instead of user "100000065" show "100000065 (Pepe Pérez)".
  • Add a link to stop _su_ing a user, perhaps one besides "change password" and "logout". Another alternative could be showing the user being _su_ed and the real user in brackets, and clicking in the real user login would bring you back to your own profile. Example: "Welcome, 100000065 [pperez]"

Thank you, and again, great work!

Breaks user admin in django-suit

Hi!.

Great work with the plugin, it's really useful.

However, it looks like it doesn't like to work with django-suit. "Login as" works ok in the changelist, but it breaks completely the user form in the admin.

Thanks!

Error in setup.py

Change:
from tz_detect import __version__
to:
from django_su import __version__

ModuleNotFoundError: No module named 'django_sudjango'

Hi, I am trying to use this library but for some reason I cannot get it to work. I have followed all of the instructions but still I am getting an error saying that django_sudjango was not found (although I did not use django_sudjago anywhere as import)

I am pretty sure that I am doing something silly, but I would love to hear back from you.

CSRF error when selecting user in /su/login

Couldn't reopen issue #48, so I'll copy and paste here:

Hi, bashu!

Sorry it took me a bit more to test your changes.

User admin page now looks great and works great as well. In the beginning it was deleting my session, but I think it was because I didn't remove 0.5.0 before installing 0.5.1.

However, now selecting a user in the /su/login page gives me a CSRF error. It was working ok with 0.5.0 (which I reinstalled to be sure).

Also, I don't know why, the "Login as another user" button in that page looks different because the anchor tag is inside a List Item. I don't know if there's a way to fix that in the plug-in or if I should retouch the template. Here's a screenshot:

8e83452a-f68c-11e5-9e4d-2096a878f605

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.