-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Improved Permissions: Set purchase cost to null if user has no permission to view the price #15936
base: develop
Are you sure you want to change the base?
Conversation
💖 Thanks for this pull request! 💖 We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
PR Summary
|
Let me know if this fix is okay for this issue. I can also imagine you want to implement this on the presentation logic, my idea doing it this way was to ensure we wouldn't miss a spot where this check should be implemented. |
Hi - thanks for this PR! All PRs should be targeted towards the |
@snipe good point. I'll add the permission and use the correct base branch. |
I guess I'm just not really clear on the use-case here. If you have the ability to view an asset's history, when would you not be able to view the price of assets not assigned to you. We hide that for assets assigned to the user (via the Assigned Assets section), but it's hard for me to imagine a situation where someone who can view asset details for items not checked out just to them shouldn't be able to see it. Additionally, this presents opportunities for data leakage (for example in the asset's history, if the price was changed from null to a specific value, that change would show in asset history.) |
About the use-case: We want to give some customers access to our Snipe-IT instance. These customers can view all the assets that have been assigned to their company, including those checked out to a location instead of a user, but we don't want them to see the purchase cost. These assets will not show up in the Assigned Assets section. The data leakage on the history page is an interesting note. If you're open to eventually merging this, I'll look into this as well. I've also joined Discord if you want to discuss this further over chat. |
That's the use-case I'm referring to - what would be the reason for them being able to view all of the other data on an asset but not the cost? |
Customers buy these assets from us with a margin. Snipe-IT is primarily used by our colleagues internally and we fill the purchase cost from our vendor. The purchase cost for the customer is different from this price, so we want to hide this field for the customers that have access to Snipe-IT. |
Description
We want to give customers access to view all assets that belong to their company. While the current
view_purchase_cost
permission hides this value at the self-assigned assets view, it's still visible in other views.When
getPurchaseCostAttribute
is implemented this way, it hides the purchase cost for all types of assets for users that do not have this permission.Example (as VIP user):
Example (as customer user):
This also ensures this data isn't leaked through API/AJAX calls.
I wasn't able to find a related existing issue for this PR.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: