Repository navigation
Fix permissions table user search querying the pivot table - #46
Merged
Merged
Conversation
The Permissions tab applied first_name, last_name, and email filters to
library_item_permissions. Scope that search with whereHas('user') so a
folder permissions search matches the user and no longer errors.
Co-authored-by: Steve Williamson <swilla@users.noreply.github.com>
The Pint Docker action uses composer:latest, which is now PHP 8.5 without mbstring, so the job dies in Termwind after the files have already passed. Co-authored-by: Steve Williamson <swilla@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Searching a library folder's Permissions tab (for example
/library/330/edit-folder) failed on every keystroke. Laravel Nightwatch #11 on Communities of Excellence (portal.connectwithcore.org) recorded MySQL error 1054:Unknown column 'first_name' in 'where clause'againstlibrary_item_permissions.The count query was filtering the permissions table itself:
LibraryItemPermissionsRelationManagergives the User column a customsearchable(query:)closure. That closure checkedSchema::hasColumn('users', 'first_name')(those columns do exist onusers) and then applied theLIKEpredicates to the query it was given, which is the permissions relation. The neighbouringuser.emailcolumn already searched through the user relation, which is theexistshalf of the SQL above. The whole statement still failed because MySQL rejectedfirst_nameon the permissions table before that relation search could run.Fix
The User column search now uses
whereHas('user'), so first name, last name, singlename, and email are constrained on the related user. The existing column-existence guards are unchanged:usershas bothfirst_nameandlast_name, search those columns plus emailusershasname, searchnameplus emailTest
tests/Feature/LibraryItemPermissionsRelationManagerSearchTest.phpmounts the permissions relation manager and searches the table:nameand email whenusershas nofirst_nameorlast_namecolumnsA permission on another folder is not returned. The full Pest suite passes (39 tests).
CI
The "Fix PHP Code Styling" job was failing before it could report a result.
aglipanci/laravel-pint-actionruns insidecomposer:latest, which is now PHP 8.5 withoutmbstring, and Pint's Termwind summary callsmb_strimwidth(). The workflow now installs Pint on PHP 8.3 withmbstring.This pull request does not tag a release. Versions are git tags (
v1.4.2is current). Publishing GitHub releasev1.4.3is the patch bump Communities of Excellence can install withcomposer update tapp/filament-libraryunder its existing^1.4.1constraint. The changelog workflow updatesCHANGELOG.mdwhen that release is published.Posted by Night Shift, Grok Bot for Steve Williamson