Skip to content

Company permissions - #1064

Merged
SchrodingersGat merged 4 commits into
inventree:masterfrom
eeintech:company_permissions
Oct 23, 2020
Merged

SchrodingersGat merged 4 commits into
inventree:masterfrom
eeintech:company_permissions

Conversation

@eeintech

Copy link
Copy Markdown
Contributor

Added permissions to views and templates.

Note the change on the InvenTreeRoleMixin class to allow permission_required declaration in views.

<h3>{{ title }}</h3>
<hr>

{% if title == 'Manufacturers' and roles.purchase_order.add or title == 'Suppliers' and roles.purchase_order.add or title == 'Customers' and roles.sales_order.add %}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check will fail if the title has been translated from english to another language.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a different context variable needs to be supplied to the template?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll add another variable to the context

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually found pagetype very suitable 😃

@SchrodingersGat

Copy link
Copy Markdown
Member

@eeintech thanks again for the contribution 👍

@SchrodingersGat
SchrodingersGat merged commit cd4cb12 into inventree:master Oct 23, 2020
@eeintech
eeintech deleted the company_permissions branch July 14, 2021 19:11
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

Successfully merging this pull request may close these issues.

2 participants