Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8006305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:28:09+00:00 2026-06-04T17:28:09+00:00

I got the following issue: If I give a user staff-status and allow him

  • 0

I got the following issue:
If I give a user staff-status and allow him to create users but not to create new groups and assign entitlements, he is still able to assign another user the ‘admin’-entitlements – so he can easily add a user who has more entitlements than himself!
Has anyone found a way to avoid that without providing a custom user-model / -view?

I’m thankful for any response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:28:12+00:00Added an answer on June 4, 2026 at 5:28 pm

    Django requires that users with permission Can add user have also the permission Can change user. Quoting the documentation:

    Also note: if you want your own user account to be able to create users using the Django admin site, you’ll need to give yourself permission to add users and change users (i.e., the “Add user” and “Change user” permissions). If your account has permission to add users but not to change them, you won’t be able to add users. Why? Because if you have permission to add users, you have the power to create superusers, which can then, in turn, change other users. So Django requires add and change permissions as a slight security measure.

    However, it might be possible to restrict the set of permissions available for a given user to assign by modifying the ModelAdmin (or its form). Here’s an answer showing how to redefine the UserAdmin.

    I believe your new ModelAdmin would have to: a) filter out users that have more permissions than you (so you can’t remove permissions from them); b) modify the change user form so you can’t set the superuser field and the permissions you’re not allowed to assign are excluded from the list (or disable the whole list altogether – but I dunno that’s what you really need, right? Creating an user with no permissions at all would be of little use IMO).

    Update: Here’s what I found so far. Should satisfy all goals above, except the permission filtering problem (it behaves like you asked in the question – deny assiging any permissions by users who are not entitled to). You can modify it to better suit your needs (for instance, replace .is_superuser by whatever logic you want to allow/deny changing permissions).

    from django.contrib.auth.admin import UserAdmin
    from django.contrib.auth.models import User
    
    class MyUserAdmin(UserAdmin):
        def queryset(self,request):
            qs = admin.ModelAdmin.queryset(self,request)
            if request.user.is_superuser:
                return qs
            # Only allow viewing/editing users who are not superusers
            return qs.filter(is_superuser=False)
        def get_readonly_fields(self, request, obj=None):
            # Deny editing groups, permissions and the superuser status
            return () if request.user.is_superuser else ('is_superuser', 'groups', 'user_permissions')
    
    admin.site.unregister(User)
    admin.site.register(User, MyUserAdmin)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I got the following issue while trying to insert multiple entries into a MySQL
I have got the following issue, my function appends code to a string $string
Recently I've spotted a very disturbing issue. I've got the following python code: for
I got following error... System.NullReferenceException: Object reference not set to an instance of an
I got following code from net and it looks everything is proper but i'm
I've got following URL in symfony (specifics not important): /frontend_dev.php/something/25/apple ... and a routing
I succesfully implement shadow volume on iOS. However I got the following issue how
I got the following insistent JS issue just for IE 8-9, in other browsers
I am running into the following issue which has really got me stumped: I
I have got the following issue <a href= class=so title=Schuko></a> <a href= class=so title=French

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.