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

Added #2353: Add ability to tie locations to companies #10705

Closed

Conversation

Toreg87
Copy link
Contributor

@Toreg87 Toreg87 commented Feb 21, 2022

Description

Locations are the last big part of the application that can't be tied to companies.
This can be a problem with FullMultipleCompanySupport, because you can't restrict the visibility of locations to the company of the users.

The first commit wires everything up so that locations have a company_id and are properly scoped with FullMultipleCompanySupport.

The second commit preserve backward compatibility with the existing behaviour, as locations with company_id = null are shown regardless of the users company. I'm not sure if this is worth it and personally I don't need this for my organisation, but I included this just to show how it could be made possible.

The third commit introduces bulk operations for locations to ease transition for this new feature.

Fixes #2353

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

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

I developed and tested this feature with V5 and rebased it later to V6. All tests passed on this version either.
I checked that the correct locations are shown as SuperUser and scoped user with FullMultipleCompanySupport.

Checklist:

Locations are the last big part of the application that can't be tied to companies.
This can be a problem with FullMultipleCompanySupport, because you can't restrict the visibility of locations to the company of the users.

In order to change this, add a company_id to the locations table and wire everything up in the views and controllers.
Aditionally add a new formatter to filter the locations to a specific company, like it is done for assets.
With FullMultipleCompanySupport enabled, a standard user can only see locations from its own company.
This is a backward incompatible change. To preserve backward compatibility, locations with company_id = null are shown to all users.

Note that if a scoped user with permissions to change locations updates a location, the location inherits the company of the user.
To ease transition after tying locations to companies introduce bulk operations to locations.
For now only bulk edit for a few fields (including company) is supported.
This can easily be extended in the future.
@Toreg87
Copy link
Contributor Author

Toreg87 commented Jun 9, 2022

@snipe @uberbrady: Now that V6 is out, can someone please look at this PR? Is the general idea useful and acceptable upstream? I'm willing to work on the details if I get feedback.

@jairzee-trio
Copy link

@snipe - is the ability to tie locations to companies now available? Seems to be a lot of conflicting threads about this, thanks in advance!

@Toreg87
Copy link
Contributor Author

Toreg87 commented Feb 28, 2023

There is an updated PR #12577

@Toreg87 Toreg87 closed this Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants