aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/UserManagerView.xib150
-rw-r--r--Source/SPUserMO.m5
-rw-r--r--Source/SPUserManager.m58
3 files changed, 136 insertions, 77 deletions
diff --git a/Interfaces/English.lproj/UserManagerView.xib b/Interfaces/English.lproj/UserManagerView.xib
index 41248f47..3b53174d 100644
--- a/Interfaces/English.lproj/UserManagerView.xib
+++ b/Interfaces/English.lproj/UserManagerView.xib
@@ -3,7 +3,7 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10C540</string>
- <string key="IBDocument.InterfaceBuilderVersion">732</string>
+ <string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
@@ -15,13 +15,13 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>732</string>
+ <string>740</string>
<string>1.2.5</string>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="37"/>
+ <integer value="44"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -436,7 +436,7 @@
<object class="NSTabViewItem" id="820796939">
<string key="NSIdentifier">General</string>
<object class="NSView" key="NSView" id="143215913">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder" ref="716372522"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -565,6 +565,7 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {480, 414}}</string>
+ <reference key="NSSuperview" ref="716372522"/>
</object>
<string key="NSLabel">General</string>
<reference key="NSColor" ref="409859189"/>
@@ -1398,7 +1399,7 @@
<object class="NSTabViewItem" id="487249930">
<string key="NSIdentifier">Schema Privileges</string>
<object class="NSView" key="NSView" id="601698335">
- <reference key="NSNextResponder" ref="716372522"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1845,7 +1846,6 @@
</object>
</object>
<string key="NSFrame">{{10, 33}, {480, 414}}</string>
- <reference key="NSSuperview" ref="716372522"/>
</object>
<string key="NSLabel">Schema Privileges</string>
<reference key="NSColor" ref="409859189"/>
@@ -2122,13 +2122,13 @@
<reference key="NSTabView" ref="716372522"/>
</object>
</object>
- <reference key="NSSelectedTabViewItem" ref="487249930"/>
+ <reference key="NSSelectedTabViewItem" ref="820796939"/>
<reference key="NSFont" ref="746597359"/>
<int key="NSTvFlags">0</int>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="601698335"/>
+ <reference ref="143215913"/>
</object>
</object>
<object class="NSButton" id="445730006">
@@ -3659,70 +3659,6 @@
<int key="connectionID">740</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: selection.user</string>
- <reference key="source" ref="1021720165"/>
- <reference key="destination" ref="889422316"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="1021720165"/>
- <reference key="NSDestination" ref="889422316"/>
- <string key="NSLabel">value: selection.user</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">selection.user</string>
- <object class="NSDictionary" key="NSOptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSNoSelectionPlaceholder</string>
- <string>NSNotApplicablePlaceholder</string>
- <string>NSNullPlaceholder</string>
- <string>NSRaisesForNotApplicableKeys</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>No Selection</string>
- <string>User Not Selected</string>
- <string>Anonymous</string>
- <boolean value="NO"/>
- </object>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">741</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">value: arrangedObjects.displayName</string>
- <reference key="source" ref="716100442"/>
- <reference key="destination" ref="889422316"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="716100442"/>
- <reference key="NSDestination" ref="889422316"/>
- <string key="NSLabel">value: arrangedObjects.displayName</string>
- <string key="NSBinding">value</string>
- <string key="NSKeyPath">arrangedObjects.displayName</string>
- <object class="NSDictionary" key="NSOptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSAllowsEditingMultipleValuesSelection</string>
- <string>NSNullPlaceholder</string>
- <string>NSValidatesImmediately</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <boolean value="NO"/>
- <string>Anonymous</string>
- <boolean value="YES"/>
- </object>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">742</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">availableController</string>
<reference key="source" ref="1001"/>
@@ -3962,6 +3898,74 @@
</object>
<int key="connectionID">884</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: arrangedObjects.displayName</string>
+ <reference key="source" ref="716100442"/>
+ <reference key="destination" ref="889422316"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="716100442"/>
+ <reference key="NSDestination" ref="889422316"/>
+ <string key="NSLabel">value: arrangedObjects.displayName</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">arrangedObjects.displayName</string>
+ <object class="NSDictionary" key="NSOptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSAllowsEditingMultipleValuesSelection</string>
+ <string>NSNullPlaceholder</string>
+ <string>NSValidatesImmediately</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <boolean value="NO"/>
+ <string>Anonymous</string>
+ <boolean value="YES"/>
+ </object>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">887</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBBindingConnection" key="connection">
+ <string key="label">value: selection.displayName</string>
+ <reference key="source" ref="1021720165"/>
+ <reference key="destination" ref="889422316"/>
+ <object class="NSNibBindingConnector" key="connector">
+ <reference key="NSSource" ref="1021720165"/>
+ <reference key="NSDestination" ref="889422316"/>
+ <string key="NSLabel">value: selection.displayName</string>
+ <string key="NSBinding">value</string>
+ <string key="NSKeyPath">selection.displayName</string>
+ <object class="NSDictionary" key="NSOptions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSContinuouslyUpdatesValue</string>
+ <string>NSNoSelectionPlaceholder</string>
+ <string>NSNotApplicablePlaceholder</string>
+ <string>NSNullPlaceholder</string>
+ <string>NSRaisesForNotApplicableKeys</string>
+ <string>NSValidatesImmediately</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <boolean value="YES"/>
+ <string>No Selection</string>
+ <string>User Not Selected</string>
+ <string>Anonymous</string>
+ <boolean value="NO"/>
+ <boolean value="YES"/>
+ </object>
+ </object>
+ <int key="NSNibBindingConnectorVersion">2</int>
+ </object>
+ </object>
+ <int key="connectionID">892</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -5517,7 +5521,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">884</int>
+ <int key="maxID">892</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
diff --git a/Source/SPUserMO.m b/Source/SPUserMO.m
index 386e4831..c4980391 100644
--- a/Source/SPUserMO.m
+++ b/Source/SPUserMO.m
@@ -38,7 +38,10 @@
- (void)setDisplayName:(NSString *)value
{
- [self setValue:value forKey:@"host"];
+ if ([self valueForKey:@"parent"] == nil)
+ [self setValue:value forKey:@"user"];
+ else
+ [self setValue:value forKey:@"host"];
}
- (void)addChildrenObject:(NSManagedObject *)value
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 09d26f1f..b91a019b 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -474,11 +474,60 @@
}
}
+ if ([selectedObject parent] != nil && [selectedObject host] == nil)
+ {
+ [selectedObject setValue:@"%" forKey:@"host"];
+ [outlineView reloadItem:selectedObject];
+ }
[schemasTableView deselectAll:nil];
[grantedTableView deselectAll:nil];
[availableTableView deselectAll:nil];
}
+-(BOOL)selectionShouldChangeInOutlineView:(NSOutlineView *)outlineView
+{
+ if ([[treeController selectedObjects] count] > 0)
+ {
+ id selectedObject = [[treeController selectedObjects] objectAtIndex:0];
+ // Check parents
+ if ([selectedObject valueForKey:@"parent"] == nil)
+ {
+ NSString *name = [selectedObject valueForKey:@"user"];
+ NSArray *results = [self _fetchUserWithUserName:name];
+ if ([results count] > 1)
+ {
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Duplicate User"
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:@"A user with that name already exists"];
+ [alert runModal];
+ return NO;
+ }
+ }
+ else
+ {
+ NSArray *children = [selectedObject valueForKeyPath:@"parent.children"];
+ NSString *host = [selectedObject valueForKey:@"host"];
+ for (NSManagedObject *child in children)
+ {
+ if (![selectedObject isEqual:child] && [[child valueForKey:@"host"] isEqualToString:host])
+ {
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Duplicate Host"
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:@"A user with that host already exists"];
+ [alert runModal];
+ return NO;
+ }
+ }
+ }
+
+ }
+ return YES;
+}
+
- (NSArray *)treeSortDescriptors
{
NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey:@"displayName" ascending:YES] autorelease];
@@ -635,8 +684,7 @@
{
if ([self.managedObjectContext hasChanges])
{
- //NSAlert *alert = [[[NSAlert alloc] init] autorelease];
- NSAlert *alert = [NSAlert alertWithMessageText:@"Window has changes. All changes will be lost!"
+ NSAlert *alert = [NSAlert alertWithMessageText:@"Warning!"
defaultButton:NSLocalizedString(@"Continue", @"Continue")
alternateButton:NSLocalizedString(@"Cancel",@"Cancel")
otherButton:nil
@@ -1050,7 +1098,11 @@
- (BOOL)checkAndDisplayMySqlError
{
if (![[self.mySqlConnection getLastErrorMessage] isEqualToString:@""]) {
- NSAlert *alert = [NSAlert alertWithMessageText:@"MySQL Error" defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:[self.mySqlConnection getLastErrorMessage]];
+ NSAlert *alert = [NSAlert alertWithMessageText:@"MySQL Error"
+ defaultButton:NSLocalizedString(@"OK", @"OK button")
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:[self.mySqlConnection getLastErrorMessage]];
[alert runModal];
return NO;