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

Return QuerySet based on User group/permissions

I'm trying to figure out what's the "best practice" to limit QuerySets based on Users permissions. For example, there is a table of invoices on the dashboard. User that has Group called Admin can see all invoices but User that has group Broker can…
Milano
  • 18,048
  • 37
  • 153
  • 353
0
votes
1 answer

Django REST Framework view permissions not called

I am trying to create a custom permission for my view that allow read and write permissions to the owner of the model in the QuerySet but do not allow any permission/request to other users or un-authenticated ones. Source:…
0
votes
2 answers

How to implement a user access based on licenses using custom permissions and APIView?

I have the following models. class Post(models.Model): content = models.TextField() class User(AbstractUser): pen_name = models.Charfield() I want to restrict a user to create a specific number of posts (let's say 10) and no more than…
0
votes
0 answers

Django view - switch login_required on and off

I have a Django application, some view functions have a @login_required mixin and permissions to access. In some site installations, admin want to switch off the login required and permissions for some functions, to make it public. What is the best…
Y.N
  • 4,989
  • 7
  • 34
  • 61
0
votes
1 answer

Django user-specific files (browse, download)

I have a situation where I have a Django app where users sign up for an account. The users generate a bunch of Excel files each month. These files are currently simply files generated on the server and stored in the filesystem, and are not part of…
chefsmart
  • 6,873
  • 9
  • 42
  • 47
0
votes
0 answers

How to setup custom permissions exactly for an app in Django?

In admin panel we can see a list of permissions look like this auth | user | add user which are suit to template | | What if I don't have models and i just want to have two permissions on the whole app change and view?…
Alex Burla
  • 127
  • 1
  • 14
0
votes
3 answers

How to create a permissions table independent of the user permissions in Django?

I want to create a permission table that takes django-users and another table as its foreign key . And then gives permissions to it . What should be there in models.py ? The doubt can be put across as two separate questions : How to use…
Hick
  • 35,524
  • 46
  • 151
  • 243
0
votes
0 answers

How to use Django Sessions Framework in generic views to send data to another

In my Django application, I am trying to use sessions to store a variable in my class view and later use it to send it to a function view. In the past I have used sessions on function views and now I am trying to use it on a class view. class…
0
votes
0 answers

drf model permissions in custom viewset

at the moment i have a custom view for example: class DocumentViewSet(RevisionMixin, viewsets.ViewSet): def destroy(self, request, pk=None): ... and these models: class Company(models.Model): ... class Document(models.Model): …
0
votes
0 answers

How to implement user permission assignment module in Django template?

i want to implement a module within Django template where admin user can assign model wise permissions to users/group. Attached is the image for your reference. please check and help
0
votes
1 answer

Custom object level DRF permission not working

In the code i am trying to implement profile part of the user where he can see his profile and update it. Here i apply some restriction at object level so that only a logged in user can see only his profile.but the custom permission part of the code…
0
votes
0 answers

Permission_required decorator not working on view in Django

I have an model called client, and a group called managers that has the permission "can view clients" granted in Django admin. I have a view using the permission_required decorator like so: @permission_required('client.view_client',…
Jake Rankin
  • 714
  • 6
  • 22
0
votes
1 answer

use django-guardian with Custom User

I use custom user And i want to django-guardian to handle the permissions and groups. How i can do that my user: class ProfileUser(AbstractBaseUser, PermissionsMixin): email = models.EmailField(_('email address'), unique=True) is_staff =…
Alami
  • 45
  • 1
  • 6
0
votes
1 answer

Creating Groups and Modifying View Access Django

I am building a web app using Django 3.0.7 and Python 3.8 that will use some business intelligence tool, like Tableau or Power BI, as a reporting source. There is absolutely no issue with the code I am using, however I need to be able to reduce…
0
votes
1 answer

DRF : how to add user permissions to user detail api?

So I am writing a UserDetails view as follows. class UserDetailsView(RetrieveUpdateAPIView): serializer_class = AuthUserSerializer def get_object(self): return self.request.user My Serializers are as follows. class…