From c410bfd1469d2cfd44fe1ee5851b8a4a1a2313fa Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 27 Mar 2007 05:40:54 +0000 Subject: [PATCH] fix for SQLForm database table permissions where the user is granted permission on all databases --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/Wobject/SQLForm.pm | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 5cbb2fa97..ee650555d 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -15,6 +15,8 @@ - fix: Clear Login History period is calculated 24 times longer if it is set in months (thanks to Todor Kouyoumdjiev ECoCoMS Ltd.) http://www.plainblack.com/bugs/tracker/clear-login-history-period-is-calculated-24-times-longer-if-it-is-set-in-months#VomZpVCroSN6WoQ-UYo7Xw + - fix: SQLForm - cannot add new asset (revisited) (thanks to Joek Hondius) + http://www.plainblack.com/bugs/tracker/sqlform---cannot-add-new-asset-revisited#barqLwFe3LPODb4Mksc6ZA 7.3.13 - fix: Stale pages after user login diff --git a/lib/WebGUI/Asset/Wobject/SQLForm.pm b/lib/WebGUI/Asset/Wobject/SQLForm.pm index ef46db9f4..5de233bde 100644 --- a/lib/WebGUI/Asset/Wobject/SQLForm.pm +++ b/lib/WebGUI/Asset/Wobject/SQLForm.pm @@ -656,12 +656,13 @@ sub _databaseLinkHasPrivileges { @grants = $dbLink->db->buildArray('show grants for current_user'); foreach (@grants) { - if (m/GRANT ([\w\s\d,]*?) ON .$databaseName.*$/) { + ##Checks for grants on all databases '*' or grants on a specific database + if (m/GRANT ([\w\s\d,]*?) ON (?:\*|.$databaseName.)\./) { push(@privileges, (split(/, /,$1))); } } - # Check ik all required privs are present. + # Check if all required privs are present. return 1 if (isIn('ALL PRIVILEGES', @privileges)); foreach (@$wantedPrivileges) {