WebGUI
      Click here to register.
      
YAPC North America 2008


     Report a Bug > WebGUI Bug Tracker

SQLForm says Databaselink does not have enough privileges

User xootom
Date 7/3/2007 11:39 am
Severity Critical (mostly not working)
Version WebGUI 7.3.19-stable
Views 246
Rating 7    Rate [
|
]
Karma Rank 0.000000
Previous · Next
User Message
xootom

Trying to add an SQLForm to a page, but receive the following.

Some error(s) occurred:

  • Databaselink does not have enough privileges (Needs ALTER, CREATE, DELETE, INDEX, INSERT, SELECT, UPDATE)

I have checked the database links in admin and added all these as keywords, and ensured that the mysql user has all privileges on the database.

SQLReports are working fine through the same link.



Back to Top
Rate [
|
]
 
 
colink

In your database, please execute this statement and post the answer back here:

 show grants for current_user



Back to Top
Rate [
|
]
 
 
xootom

GRANT USAGE ON *.* TO 'base'@'localhost' IDENTIFIED BY PASSWORD '*xxxxx'

GRANT ALL PRIVILEGES ON `base%`.* TO 'login'@'localhost'



Back to Top
Rate [
|
]
 
 
colink

We'll begin working on the bug.

In the short term, if you change the grants to just base.* instead of base%.*, it should begin working right away.



Back to Top
Rate [
|
]
 
 
xootom
Thank you, I have created a new database and login specific to it, which is working.


Back to Top
Rate [
|
]
 
 
knowmad

Colin,

There is a bug in _databaseLinkHasPrivileges() where it does not return a true value if grants are anything but ALL PRIVILEGES. I have attached a patch.

William 



Attached Files
Back to Top
Rate [
|
]
 
 
colink

William,

Thanks for pointing that out.  When I ported the code from the SQLForm to the DatabaseLink, I noticed that, too and have already fixed it.

The relevant svn revs, for reference, are 4359 (for branch/WebGUI_7.3) and 4348-4350, 4358 for HEAD.  The really cool thing is now you can debug these things in a test that regressable so nothing old will get broken as new fixes are added. 



Back to Top
Rate [
|
]
 
 
colink

Fixed in 7.3.21

Note for future privilege bugs.  There is now a test in t/DatabaseLink.t where you can enter in new DSNs or new grant messages and debug them programmatically, rather than trying to setup databases and the like. 



Back to Top
Rate [
|
]