From 5e14414cb9c7123ba2131ceba0a7833568b98c1c Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 15 Aug 2009 00:03:51 +0000 Subject: User manager tweaks: - Don't select the mysql database - make selections directly from the table where appropriate - Tweak REVOKE syntax to use FROM instead of TO - Rename "create temporary table" permission to "create temporary tables" so it saves correctly --- Interfaces/English.lproj/UserManagerView.xib | 113 ++++++++++++++++++++------- Source/SPUserManager.m | 9 +-- Source/SPUserManager.xcdatamodel/elements | Bin 50142 -> 50105 bytes Source/SPUserManager.xcdatamodel/layout | Bin 5707 -> 5719 bytes 4 files changed, 86 insertions(+), 36 deletions(-) diff --git a/Interfaces/English.lproj/UserManagerView.xib b/Interfaces/English.lproj/UserManagerView.xib index 557617f2..70f2b215 100644 --- a/Interfaces/English.lproj/UserManagerView.xib +++ b/Interfaces/English.lproj/UserManagerView.xib @@ -2,13 +2,12 @@ 1050 - 9L30 + 9J61 677 - 949.54 + 949.46 353.00 YES - YES @@ -75,12 +74,14 @@ 4352 {194, 467} + YES 256 {194, 17} + @@ -88,6 +89,7 @@ -2147483392 {{-26, 0}, {16, 17}} + YES @@ -187,6 +189,7 @@ {{0, 17}, {194, 467}} + @@ -197,6 +200,7 @@ -2147483392 {{246, 17}, {15, 308}} + _doScroller: 9.969040e-01 @@ -206,6 +210,7 @@ -2147483392 {{1, 325}, {245, 15}} + 1 _doScroller: @@ -220,6 +225,7 @@ {194, 17} + @@ -229,6 +235,7 @@ {{0, 22}, {194, 484}} + 560 @@ -248,6 +255,7 @@ 292 {{-1, -1}, {32, 24}} + YES 67239424 @@ -272,6 +280,7 @@ 292 {{30, -1}, {32, 24}} + YES 67239424 @@ -296,6 +305,7 @@ 292 {{61, -1}, {32, 24}} + YES -2076049856 @@ -370,6 +380,7 @@ {194, 23} + YES YES NO @@ -378,6 +389,7 @@ {194, 506} + NSView @@ -390,6 +402,7 @@ 274 {{13, 40}, {531, 460}} + YES @@ -532,7 +545,7 @@ Global Privileges - + 274 YES @@ -556,6 +569,7 @@ 268 {{16, 72}, {133, 18}} + YES 67239424 @@ -583,6 +597,7 @@ 268 {{16, 52}, {133, 18}} + YES 67239424 @@ -603,10 +618,12 @@ {{1, 1}, {175, 98}} + {{252, 128}, {177, 114}} + {0, 0} 67239424 @@ -640,6 +657,7 @@ 268 {{16, 190}, {65, 18}} + YES 67239424 @@ -662,6 +680,7 @@ 268 {{16, 170}, {85, 18}} + YES 67239424 @@ -684,6 +703,7 @@ 268 {{16, 150}, {65, 18}} + YES 67239424 @@ -706,6 +726,7 @@ 268 {{16, 130}, {70, 18}} + YES 67239424 @@ -728,6 +749,7 @@ 268 {{16, 110}, {70, 18}} + YES 67239424 @@ -750,6 +772,7 @@ 268 {{16, 90}, {142, 18}} + YES 67239424 @@ -772,6 +795,7 @@ 268 {{16, 70}, {142, 18}} + YES 67239424 @@ -794,6 +818,7 @@ 268 {{16, 50}, {142, 18}} + YES 67239424 @@ -816,6 +841,7 @@ 268 {{16, 30}, {142, 18}} + YES 67239424 @@ -838,6 +864,7 @@ 268 {{16, 10}, {142, 18}} + YES 67239424 @@ -858,10 +885,12 @@ {{1, 1}, {231, 216}} + {{17, 10}, {233, 232}} + {0, 0} 67239424 @@ -885,6 +914,7 @@ 289 {{318, 84}, {114, 32}} + YES 67239424 @@ -915,6 +945,7 @@ 268 {{16, 92}, {63, 18}} + YES 67239424 @@ -937,6 +968,7 @@ 268 {{16, 72}, {63, 18}} + YES 67239424 @@ -959,6 +991,7 @@ 268 {{16, 52}, {67, 18}} + YES 67239424 @@ -981,6 +1014,7 @@ 268 {{16, 32}, {63, 18}} + YES 67239424 @@ -1003,6 +1037,7 @@ 268 {{16, 12}, {91, 18}} + YES 67239424 @@ -1025,6 +1060,7 @@ 268 {{152, 92}, {63, 18}} + YES 67239424 @@ -1047,6 +1083,7 @@ 268 {{152, 72}, {63, 18}} + YES 67239424 @@ -1069,6 +1106,7 @@ 268 {{152, 52}, {63, 18}} + YES 67239424 @@ -1091,6 +1129,7 @@ 268 {{152, 32}, {63, 18}} + YES 67239424 @@ -1111,10 +1150,12 @@ {{1, 1}, {231, 118}} + {{17, 246}, {233, 134}} + {0, 0} 67239424 @@ -1138,6 +1179,7 @@ 289 {{318, 52}, {114, 32}} + YES 67239424 @@ -1168,6 +1210,7 @@ 268 {{16, 92}, {97, 18}} + YES 67239424 @@ -1190,6 +1233,7 @@ 268 {{16, 72}, {97, 18}} + YES 67239424 @@ -1212,6 +1256,7 @@ 268 {{16, 52}, {116, 18}} + YES 67239424 @@ -1234,6 +1279,7 @@ 268 {{16, 32}, {105, 18}} + YES 67239424 @@ -1256,6 +1302,7 @@ 268 {{16, 12}, {97, 18}} + YES 67239424 @@ -1276,10 +1323,12 @@ {{1, 1}, {175, 118}} + {{252, 246}, {177, 134}} + {0, 0} 67239424 @@ -1301,10 +1350,13 @@ {{17, 11}, {446, 400}} + NSView {{10, 33}, {511, 414}} + + Global Privileges @@ -1313,7 +1365,7 @@ Resources - + 256 YES @@ -1578,20 +1630,19 @@ {{10, 33}, {511, 414}} - Resources - + 0 YES YES - + @@ -1599,6 +1650,7 @@ 289 {{467, 12}, {76, 32}} + YES -2080244224 @@ -1620,6 +1672,7 @@ 289 {{385, 12}, {82, 32}} + YES -2080244224 @@ -1639,17 +1692,20 @@ {{195, 0}, {557, 506}} + NSView {752, 506} + YES 2 {752, 506} + {{0, 0}, {1920, 1178}} {3.40282e+38, 3.40282e+38} @@ -1730,6 +1786,7 @@ replication_client_priv replication_slave_priv parent + create_temporary_tables_priv SPUserItem YES @@ -2235,22 +2292,6 @@ 534 - - - value: selection.create_temporary_table_priv - - - - - - value: selection.create_temporary_table_priv - value - selection.create_temporary_table_priv - 2 - - - 535 - value: selection.lock_tables_priv @@ -2489,6 +2530,22 @@ 605 + + + value: selection.create_temporary_tables_priv + + + + + + value: selection.create_temporary_tables_priv + value + selection.create_temporary_tables_priv + 2 + + + 606 + @@ -3688,7 +3745,7 @@ - 605 + 606 @@ -3741,7 +3798,7 @@ SPUserManager - NSObject + NSWindowController YES @@ -3767,19 +3824,15 @@ YES YES - addHostSheet outlineView tabView treeController - window YES - NSPanel NSOutlineView NSTabView NSTreeController - NSWindow diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index c77c757b..8b26b001 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -62,7 +62,7 @@ privColumnsMODict = [[[NSDictionary alloc] initWithObjectsAndKeys: @"grant_option_priv",@"Grant_priv", @"show_databases_priv",@"Show_db_priv", - @"create_temporary_table_priv",@"Create_tmp_table_priv", + @"create_temporary_tables_priv",@"Create_tmp_tables_priv", @"Replication_slave_priv",@"Repl_slave_priv", @"Replication_client_priv",@"Repl_client_priv",nil] retain]; @@ -114,8 +114,7 @@ NSMutableArray *resultAsArray = [NSMutableArray array]; NSMutableArray *usersResultArray = [NSMutableArray array]; - [[self connection] selectDB:@"mysql"]; - MCPResult *result = [[[self connection] queryString:@"select * from user order by user"] retain]; + MCPResult *result = [[[self connection] queryString:@"SELECT * FROM `mysql`.`user` ORDER BY `user`"] retain]; int rows = [result numOfRows]; if (rows > 0) { @@ -505,7 +504,6 @@ - (BOOL)deleteUsers:(NSArray *)deletedUsers { - [[self connection] selectDB:@"mysql"]; NSMutableString *droppedUsers = [NSMutableString string]; for (NSManagedObject *user in deletedUsers) { @@ -525,7 +523,6 @@ - (BOOL)insertUsers:(NSArray *)insertedUsers { - [[self connection] selectDB:@"mysql"]; for(NSManagedObject *user in insertedUsers) { if ([user parent] != nil) { @@ -587,7 +584,7 @@ // Revoke privileges if ([revokePrivileges count] > 0) { - NSString *revokeStatement = [NSString stringWithFormat:@"REVOKE %@ ON *.* TO %@@%@;", + NSString *revokeStatement = [NSString stringWithFormat:@"REVOKE %@ ON *.* FROM %@@%@;", [revokePrivileges componentsJoinedByCommas], [[[user parent] valueForKey:@"user"] tickQuotedString], [[user valueForKey:@"host"] tickQuotedString]]; diff --git a/Source/SPUserManager.xcdatamodel/elements b/Source/SPUserManager.xcdatamodel/elements index 6766bed3..8bca9833 100644 Binary files a/Source/SPUserManager.xcdatamodel/elements and b/Source/SPUserManager.xcdatamodel/elements differ diff --git a/Source/SPUserManager.xcdatamodel/layout b/Source/SPUserManager.xcdatamodel/layout index 07b18bfd..5c8f25a4 100644 Binary files a/Source/SPUserManager.xcdatamodel/layout and b/Source/SPUserManager.xcdatamodel/layout differ -- cgit v1.2.3