diff options
author | mltownsend <mltownsend@gmail.com> | 2010-05-24 23:49:58 +0000 |
---|---|---|
committer | mltownsend <mltownsend@gmail.com> | 2010-05-24 23:49:58 +0000 |
commit | 8f3a90128f5f16ddddf58dbc098bb3136e661455 (patch) | |
tree | 3b49abd20c41d519eac49ef41ebfd0fcdd167633 /Source/SPUserManager.m | |
parent | 8b1766fae0ce3b2c4b581a16520d5ae7a09b9a04 (diff) | |
download | sequelpro-8f3a90128f5f16ddddf58dbc098bb3136e661455.tar.gz sequelpro-8f3a90128f5f16ddddf58dbc098bb3136e661455.tar.bz2 sequelpro-8f3a90128f5f16ddddf58dbc098bb3136e661455.zip |
More tweaks in regards to issue#699
Diffstat (limited to 'Source/SPUserManager.m')
-rw-r--r-- | Source/SPUserManager.m | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 4e27b407..48446d22 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -357,7 +357,10 @@ key = [privColumnToGrantMap objectForKey:key]; } [dbPriv setValue:[NSNumber numberWithBool:boolValue] forKey:key]; - } else if (![key isEqualToString:@"Host"] && ![key isEqualToString:@"User"]) { + } else if ([key isEqualToString:@"Db"]) { + [dbPriv setValue:[[rowDict objectForKey:key] stringByReplacingOccurrencesOfString:@"\\_" withString:@"_"] + forKey:key]; + } else if (![key isEqualToString:@"Host"] && ![key isEqualToString:@"User"]) { [dbPriv setValue:[rowDict objectForKey:key] forKey:key]; } } @@ -760,7 +763,8 @@ } [self.managedObjectContext reset]; - [grantedSchemaPrivs removeAllObjects]; + [grantedSchemaPrivs removeAllObjects]; + //[grantedController fetch:nil]; [grantedTableView reloadData]; [self _initializeAvailablePrivs]; [treeController fetch:nil]; @@ -773,8 +777,8 @@ NSArray *userArray = [self.managedObjectContext executeFetchRequest:request error:nil]; for (NSManagedObject *user in userArray) { if (![user parent]) { - [user setValue:[user valueForKey:@"user"] forKey:@"originaluser"]; - [user setValue:[user valueForKey:@"password"] forKey:@"originalpassword"]; + [user setPrimitiveValue:[user valueForKey:@"user"] forKey:@"originaluser"]; + [user setPrimitiveValue:[user valueForKey:@"password"] forKey:@"originalpassword"]; } } } @@ -786,11 +790,12 @@ NSManagedObject *selectedHost = [[treeController selectedObjects] objectAtIndex:0]; NSString *selectedDb = [[[schemaController selectedObjects] objectAtIndex:0] valueForKey:@"Database"]; NSArray *selectedPrivs = [self _fetchPrivsWithUser:[selectedHost valueForKeyPath:@"parent.user"] - schema:selectedDb + schema:[selectedDb stringByReplacingOccurrencesOfString:@"_" withString:@"\\_"] host:[selectedHost valueForKey:@"host"]]; NSManagedObject *priv = nil; BOOL isNew = FALSE; + if ([selectedPrivs count] > 0) { priv = [selectedPrivs objectAtIndex:0]; @@ -1377,8 +1382,9 @@ // Check to see if the user host node was selected if ([user valueForKey:@"host"]) { NSString *selectedSchema = [[[schemaController selectedObjects] objectAtIndex:0] valueForKey:@"Database"]; - selectedSchema = [selectedSchema stringByReplacingOccurrencesOfString:@"_" withString:@"\\\\_"]; - NSArray *results = [self _fetchPrivsWithUser:[[user parent] valueForKey:@"user"] schema:selectedSchema host:[user valueForKey:@"host"]]; + NSArray *results = [self _fetchPrivsWithUser:[[user parent] valueForKey:@"user"] + schema:[selectedSchema stringByReplacingOccurrencesOfString:@"_" withString:@"\\_"] + host:[user valueForKey:@"host"]]; if ([results count] > 0) { NSManagedObject *priv = [results objectAtIndex:0]; |