diff options
author | stuconnolly <stuart02@gmail.com> | 2010-03-23 13:30:26 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-03-23 13:30:26 +0000 |
commit | 92b9f5d4c025c6bd50367d6a2e9b39e257769107 (patch) | |
tree | 89951e7bee578a1e9f25c177ed630df31ef98473 /Source | |
parent | 6d72a0d3c3a047ce952e0e78a1e5232eb7f15be3 (diff) | |
download | sequelpro-92b9f5d4c025c6bd50367d6a2e9b39e257769107.tar.gz sequelpro-92b9f5d4c025c6bd50367d6a2e9b39e257769107.tar.bz2 sequelpro-92b9f5d4c025c6bd50367d6a2e9b39e257769107.zip |
Before opening the user manager check that the current user has access to the mysql.user table. If they don't display a warning message that they don't have the necessary privileges for user management.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableDocument.m | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 797631e3..ac076c8b 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -2302,6 +2302,24 @@ */ - (IBAction)showUserManager:(id)sender { + // Before displaying the user manager make sure the current user has access to the mysql.user table. + MCPResult *result = [mySQLConnection queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"]; + + if ((![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) && ([result numOfRows] == 0)) { + + NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Unable to get list of users", @"unable to get list of users message") + defaultButton:NSLocalizedString(@"OK", @"OK button") + alternateButton:nil + otherButton:nil + informativeTextWithFormat:NSLocalizedString(@"An error occurred while trying to get the list of users. Please make sure you have the necessary privileges to perform user management, including access to the mysql.user table.", @"unable to get list of users informative message")]; + + [alert setAlertStyle:NSCriticalAlertStyle]; + + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"cannotremovefield"]; + + return; + } + [NSApp beginSheet:[userManagerInstance window] modalForWindow:tableWindow modalDelegate:userManagerInstance |