snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11.08k stars 3.18k forks source link

[7.0.11][Multi-Company]Multiple bugs handling user #15464

Open swift2512 opened 2 months ago

swift2512 commented 2 months ago

Debug mode

Describe the bug

BUG1. Superadmin can remove users from the Company even if these users have items assigned. (But it doesn't allow to move from company to company.) Then, this user can't be added to any company - you have to check-in all items first. (Doesn't matter to which company you try to move him.) BUG2. If multicompany enabled and user has items assigned to him, this user can't be edited - system throws an error 'This user has items assigned, please check them in before moving companies.' (I am not changing company or altering any data, just pressing button 'Save'.) image BUG3. When editing single or multiple users through Bulk Edit button, information entered in City field isn't stored in database. There are no errors. Item count, assigned to the user, doesn't matter. image

Reproduction steps

BUG1-1. Have multiple companies, assign user to any of them. BUG1-2. Assign items to that user. BUG1-3. Edit this user through 'Pencil button', not through Bulk Edit. BUG1-4. Remove assigned Company via X button next to Company name and hit Save. Result: User is now not assigned to any company, but has items attached to him from his previous company. This user can't be moved to other company until all items are checked in from him.

BUG2-1. Have multiple companies, assign user to any of them. BUG2-2. Assign items to that user. BUG2-3. Edit this user through 'Pencil button', not through Bulk Edit. BUG2-4. Don't change anything, just hit button 'Save'. Result: Error 'This user has items assigned, please check them in before moving companies.' is shown. imageRemove assigned Company via X button next to Company name and hit Save.

BUG3-1. Edit single or multiple users through 'Bulk Edit' button. BUG3-2. Fill in 'City' field with some data and press 'Save'. Result: 'City' field is not updated.

Expected behavior

BUG1. Users can't be pulled out from the company if items are assigned to them. BUG2. User can be edited. BUG3. City field is updated when using 'Bulk Edit'.

Snipe-IT Version

7.0.11 latest master

Operating System

Ubuntu

Web Server

Apache

PHP Version

8.3

Additional context

Can't test that on Snipe-IT demo site, because user update feature is disabled. There could be a closed full featured SnipeIT demo site for testers like me, where we could verify that it's actually a SnipeIT issue and not misconfiguration of our systems. (Bug No.3 is a long standing one, because it's present on v7.0.4/Docker image.)

snipe commented 2 months ago

Thanks for this - I have a fix ready for number 3 shortly. In the future, if you can create these as separate bugs, since they're not really related, that would be a big help. We have workflows set up where if we use the phrase "Fixes #xxxx" in the commit or the PR body, the issue will get automatically closed once the PR is merged into master, and with 3 unrelated bugs, we wouldn't want the issue erroneously closed when only one of the bugs has been addressed.

swift2512 commented 2 months ago

Thanks for this - I have a fix ready for number 3 shortly. In the future, if you can create these as separate bugs, since they're not really related, that would be a big help. We have workflows set up where if we use the phrase "Fixes #xxxx" in the commit or the PR body, the issue will get automatically closed once the PR is merged into master, and with 3 unrelated bugs, we wouldn't want the issue erroneously closed when only one of the bugs has been addressed.

I'll try to be less lazy next time. :)

snipe commented 2 months ago

Hehe - I didn't mean it that way, I'm just afraid that when we solve one bug, we won't realize the other ones weren't solved and then the ticket gets closed and we forget all about it We appreciate all the time you put in. <3