Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users with view permission cannot see custom action #40

Open
cheng10 opened this issue Jan 16, 2018 · 1 comment
Open

Users with view permission cannot see custom action #40

cheng10 opened this issue Jan 16, 2018 · 1 comment

Comments

@cheng10
Copy link

cheng10 commented Jan 16, 2018

I have a custom action, eg: publish_article. And i want users with only view permission to perform this action. However, this package gives no actions for users with only view permission. I think this is not reasonable.

related code: admin_view_permission/admin.py, line 208:

        # If the user doesn't have delete permission return an empty
        # OrderDict otherwise return only the default admin_site actions
        if not self.has_delete_permission(request):
            return OrderedDict()
@lefterisnik
Copy link
Contributor

Hi @cheng10,

Thank you for the report. To implement something like this requires different permissions per action which adds a lot of complexity.

For example let's say that we have 2 actions:

  1. Updates all the rows with some values.
  2. Return a csv with the selected rows.

In the above scenario a user with view permission only should be able to execute only the 2nd action, not the 1st one. So, we need something that specifies a permission per action. The package cannot handle these cases because it depends on each project and your needs. To succeed that you could override the get_actions method on your modeladmin class and return the appropriate actions according to the permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants