Questions tagged [django-permissions]

django-permissions is a pluggable django app that provides per-object permissions for Django based on roles

django-permissions is a pluggable django app that provides per-object permissions for Django based on roles.

431 questions
0
votes
2 answers

Build a custom View to give permissions to a specific User (not using ADMIN)

I want to build a custom view that gives ( or take depending on the situation) permission(s) to user. What I want to do is to produce a form with all the permissions listed with check boxes next to each permission, checked already against a…
Deshwal
  • 3,436
  • 4
  • 35
  • 94
0
votes
0 answers

How should I add permissions to a model correctly?

When users register, then I add a permission to view content. However, the added permission is classing with Django default. I'd like to add a view permission, but do not know how. Once, users get this permission, they can view specialized content.…
user11846186
0
votes
1 answer

Make readable the post only if the user is staff

I'm developing the backend of my blog and I need to make a difference between the typology of posts: published, future post, draft. For do this I'm started with the indications comes inside my past request: Create a restricted area Django: put…
MaxDragonheart
  • 1,117
  • 13
  • 34
0
votes
1 answer

How to link AbstractUser to Group and query in Views for Business Logic

I have limited the amount of files a user can upload to my site using a logical query in my upload app's views.py file. Long story short, after the user has uploaded 5 files, they are redirected to a page that says they must become a premium member.…
0
votes
1 answer

redirecting to two different view from a form input

I have a PostForm model form to create posts for my blog app. Now the user has two options after filling the post form he/she can publish it immediately or can put it into the drafts for later publishing. when published the user will be redirected…
0
votes
1 answer

Django saving model inline

I have two model's , Model1 class Model1(models.Model): ........ Model2 class Model2(models.Model): model1 = models.ForeignKey(Model1, related_name='Model1Objects',on_delete=models.CASCADE) ...... Model1.admin class…
0
votes
1 answer

Advice on how to test DRF model permissions with TDD

I am writing a DRF API for an educational website where users can access data based on the permission groups and object level permissions they have. When I started writing the tests, I wondered whether it is necessary to test requests with all…
0
votes
1 answer

How to edit user permission in Django Rest Framework

I am following the tutorial of django Rest Framework. I want to add user-based permission so that only authenticated user can view each user's detail information. Objective : Anyone can view the UserList, but only owner can view its…
Hashnut
  • 367
  • 3
  • 18
0
votes
0 answers

Django Permission

Hi i am having trouble with Django User object. I have created a group named 'Admin' and this group have the following permission 'can_change_name','can_update_name'. A user 'falcon' belong to group 'Admin' i did this by performing the following…
skid
  • 958
  • 4
  • 13
  • 29
0
votes
0 answers

How to check user have permission or not on url in django

How to check user have permission or not on URL in Django I have URL - admin/users/userprofile and I want to check that login user have permission to access how to do that ? def get_nav_list(context, **kwargs): request = context['request'] …
Saurabh Chandra Patel
  • 12,712
  • 6
  • 88
  • 78
0
votes
3 answers

DRF - how to implement object based permission on queryset?

I implemented DRF as per the document. At one point I figured out, once the user is authenticated, the user is allowed to fetch data of any user in the systems. I have implemented filtering as per this document. I read through the permission…
Kishor Pawar
  • 3,386
  • 3
  • 28
  • 61
0
votes
1 answer

How to check if a user has permission when looping through all permissions?

I have a model named Account, which is connected to the default User model. As of now, I'm looping through all permissions associated with the Account model, but I also want to check if the Account profile page's user has the one or more of the…
0
votes
1 answer

check condition in permission class

Why can't I check the condition in the permission class ? class ViewUserLeaveRequest(BasePermission): def has_permission(self, request, view): id = view.kwargs['id'] user = User.objects.get(id = request.user.id) …
Bishwa Karki
  • 359
  • 4
  • 20
0
votes
0 answers

understanding QuerySet of Django Permissions

Am new to Django, have been working on linking some permissions to groups and then adding users to those groups. Have managed some of that so far, but am stuck on understanding exactly what is going on with the permissions. Here is my attempt so…
cardamom
  • 6,873
  • 11
  • 48
  • 102
0
votes
0 answers

How to restrict screens on front end SPA powered by Django based on user roles?

I ended up having to plug a react SPA front end with a django backend. Now I want to restrict some screens for some users based on user roles. I can use django user groups to create roles. The entire JS for the website is sent to the browser on the…
Jeff P Chacko
  • 4,908
  • 4
  • 24
  • 32