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
3
votes
1 answer

Checking the existence of a permission object in Django unit test

Suppose that I want to write a test to make sure that a permission does not exist. I want the following test to pass (instead it gives an error): from django.test import TestCase from django.contrib.auth.models import Permission class…
HBat
  • 4,873
  • 4
  • 39
  • 56
3
votes
2 answers

Django (drf) dynamic permissions from BasePermission

I want to have easy way to check if somebody is owner or admin of post, proposal and so on he's trying to edit \ delete. So, every time I use IsAuthenticated permission and in the method of ModelViewSet I get instance and check if instance.author or…
Dionid
  • 97
  • 8
3
votes
1 answer

permissions checking in serializer, Django rest framework,

I'm fairly new and django rest framework and I have some questions regardin permissions. So I have a user who is a member of organization and member of some group. Lets say we have a model: class SomeModel: organization =…
3
votes
1 answer

django 1.1 permission question in template

I have an app that makes user of filtering certain things for users with different permissions. Django 1.1 does for some reason not seem to recognize these. I have a group called corporate and permissions are granted as needed. now in my template I…
ApPeL
  • 4,801
  • 9
  • 47
  • 84
3
votes
0 answers

Django LDAP authentication: Add custom field and set permissions

I got the LDAP authentication working but now I need two more things. I need to add the new User to the permission group default. And I need to store the department field additionally to the User. For the first Problem I didn't find any solutions.…
baam
  • 1,122
  • 2
  • 14
  • 25
3
votes
1 answer

Permissions on my Model for Django

I have a model called Logs: class Logs(models.Model): entry = models.CharField(max_length=100) Some Users can administer logs, others edit and the rest only view. How would you handle such permissions in Django? I was thinking of adding a new…
Prometheus
  • 32,405
  • 54
  • 166
  • 302
3
votes
0 answers

Django admin 403 Forbidden error for user even though he has staff permissions and group permissions

In the Django admin when the user is accessing a link '/admin/app/routes', there is a 403 Forbidden error, even though he has group permissions and staff status.
Vijay
  • 924
  • 1
  • 12
  • 27
3
votes
2 answers

Django - Ability to assign permissions and groups for custom user model in admin console

I just created a custom user model in django called Subscriber which inherits from AbstractBaseUser and PermissionsMixin. I then subclassed the necessary form classes in my admin.py file in order to register my custom user model with the admin…
BDUB
  • 387
  • 6
  • 18
3
votes
1 answer

Inheriting group permissions in Django UserProfile models

Suppose I have a project where I know in advance that I will only have three user groups. Can I define them in advance inheriting from a GroupParent and then add a field to my UserProfile with these group choices?? This is basically what I'd like to…
la_f0ka
  • 1,773
  • 3
  • 23
  • 44
3
votes
1 answer

Migrate user groups and permissions in Django?

I've built an application that I want to move from my development server to my production server. In this application I have defined 3 custom groups in auth.group and each of those have specific permissions. I've tried to dump the data from…
NewGuy
  • 3,273
  • 7
  • 43
  • 61
2
votes
1 answer

Does Django's permission system give advantages with custom Access Levels for a community webapp?

Django permissions are great if you need to let someone access the admin and restrict what they can do. But what if I want to use a similar functionality in the frontend of an application? Example: model Group has its own Members, a member can have…
nemesisdesign
  • 8,159
  • 12
  • 58
  • 97
2
votes
1 answer

What is the best app for row level permissions in Django?

What is the best app for row level permissions in Django? There are many of them at http://djangopackages.com/grids/g/perms/, but how to choose more promising one?
Alexander Artemenko
  • 21,378
  • 8
  • 39
  • 36
2
votes
1 answer

How to update 'Allow' headers in DRF to match an OPTIONS request's permissions?

I am using Django Rest Framework 3.14 with ModelViewsets and a settings-wide DjangoModelOrAnonReadOnly permission class. Given this config, out of the box my JSON API seems to respond to OPTIONS requests in a misleading way, i.e. sending…
2
votes
1 answer

View specified permission isn't replaced by default permission class

When I set default permission settings to "DEFAULT_PERMISSION_CLASSES": [ "rest_framework.permissions.AllowAny", ], and then define different permission for views…
2
votes
0 answers

403 Forbidden with Django Permission error

I cannot seem to have a user create a post without having a 403 error display after creating an account, would anyone be willing to take a look at the code and see if they can tell me why I the user is not automatically placed into the default group…