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

Validate group data on user save API call #15948

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

snipe
Copy link
Owner

@snipe snipe commented Dec 10, 2024

We've been seeing some funky errors in Rollbar from folks who are passing weird (invalid) data to the user's create endpoint. This should validate that the group exists before trying to save it, which should cut them off via validator if the group data is funky.

This would fix the PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'accessories.checkin' in 'field list' in /snipe-it/vendor/laravel/framework/src/Illuminate/Database/MySqlConnection.php:39 errors in RB.

Signed-off-by: snipe <snipe@snipe.net>
@snipe snipe requested a review from uberbrady December 10, 2024 14:26
Copy link

what-the-diff bot commented Dec 10, 2024

PR Summary

  • Enhanced the User Authorization for Creating Users
    The authorize method in SaveUserRequest.php was modified to include an additional check. This check is to ensure that the user attempting to create a new user actually has the permission to do so. This makes the operation of user creation more secure.

  • Inclusion of Group Validation Rule
    In the SaveUserRequest.php file, an additional rule for groups was incorporated within the rules method. This means that whenever a new user is being created, an extra validation process will make sure the 'groups' data provided follows the correct standard.

  • Feature Tests for User Creation added
    A new file, StoreUserTest.php, has been created which contains comprehensive tests for the user creating API. This involves checking if the correct permissions exist for creating a user, verification of successful user creation when valid data is provided, and an investigation into the rejection of invalid group data. This ensures a smoother and more reliable overall user creation process.

Signed-off-by: snipe <snipe@snipe.net>
Signed-off-by: snipe <snipe@snipe.net>
@snipe
Copy link
Owner Author

snipe commented Dec 10, 2024

Looks like that tighter gate broke some tests - will fix when I get back from lunch.

Signed-off-by: snipe <snipe@snipe.net>
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.

1 participant