diff options
Diffstat (limited to 'Source/SPUserManager.m')
-rw-r--r-- | Source/SPUserManager.m | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 48446d22..e6809921 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -756,18 +756,28 @@ return; } } - NSSet *registeredObjects = [managedObjectContext registeredObjects]; - for (NSManagedObject *registeredObject in registeredObjects) - { - [self.managedObjectContext refreshObject:registeredObject mergeChanges:NO]; - } [self.managedObjectContext reset]; [grantedSchemaPrivs removeAllObjects]; - //[grantedController fetch:nil]; [grantedTableView reloadData]; [self _initializeAvailablePrivs]; - [treeController fetch:nil]; + [outlineView reloadData]; + [treeController rearrangeObjects]; + + // Get all the stores on the current MOC and remove them. + NSArray *stores = [[self.managedObjectContext persistentStoreCoordinator] persistentStores]; + for(NSPersistentStore* store in stores) + { + NSError *error = nil; + [[self.managedObjectContext persistentStoreCoordinator] removePersistentStore:store error:error]; + } + // Add a new store + NSError *error = nil; + [[self.managedObjectContext persistentStoreCoordinator] + addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:&error]; + + // Reinitialize the tree with values from the database. + [self _initializeUsers]; // After the reset, ensure all original password and user values are up-to-date. NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"SPUser" @@ -928,11 +938,6 @@ if (!isInitializing) [outlineView reloadData]; } -- (void)userManagerSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void*)context -{ - [self refresh:nil]; -} - - (BOOL)updateUsers:(NSArray *)updatedUsers { for (NSManagedObject *user in updatedUsers) |