Revision: 27935
          http://sourceforge.net/p/bibdesk/svn/27935
Author:   hofman
Date:     2022-09-26 09:45:50 +0000 (Mon, 26 Sep 2022)
Log Message:
-----------
remove passwordFromKeychain accessor. Get dictionary for server file to save 
from a copy so we don't save the password twice.

Modified Paths:
--------------
    trunk/bibdesk/BDSKSearchGroupServerManager.m
    trunk/bibdesk/BDSKServerInfo.h
    trunk/bibdesk/BDSKServerInfo.m

Modified: trunk/bibdesk/BDSKSearchGroupServerManager.m
===================================================================
--- trunk/bibdesk/BDSKSearchGroupServerManager.m        2022-09-26 09:25:09 UTC 
(rev 27934)
+++ trunk/bibdesk/BDSKSearchGroupServerManager.m        2022-09-26 09:45:50 UTC 
(rev 27935)
@@ -166,14 +166,16 @@
 
 - (void)addServer:(BDSKServerInfo *)serverInfo
 {
-    [searchGroupServers addObject:[[serverInfo copy] autorelease]];
+    serverInfo = [[serverInfo copy] autorelease];
+    [searchGroupServers addObject:serverInfo];
     [searchGroupServers sortUsingDescriptors:sortDescriptors];
     [self saveServerFile:serverInfo];
 }
 
 - (void)setServer:(BDSKServerInfo *)serverInfo atIndex:(NSUInteger)idx {
+    serverInfo = [[serverInfo copy] autorelease];
     [self deleteServerFile:[searchGroupServers objectAtIndex:idx]];
-    [searchGroupServers replaceObjectAtIndex:idx withObject:[[serverInfo copy] 
autorelease]];
+    [searchGroupServers replaceObjectAtIndex:idx withObject:serverInfo];
     [searchGroupServers sortUsingDescriptors:sortDescriptors];
     [self saveServerFile:serverInfo];
 }

Modified: trunk/bibdesk/BDSKServerInfo.h
===================================================================
--- trunk/bibdesk/BDSKServerInfo.h      2022-09-26 09:25:09 UTC (rev 27934)
+++ trunk/bibdesk/BDSKServerInfo.h      2022-09-26 09:45:50 UTC (rev 27935)
@@ -83,6 +83,7 @@
 
 @property (nonatomic, readonly) BDSKServerType serverType;
 
+// use this to get the password, as the accessor returns nil to deny access to 
templating
 - (BOOL)getUsername:(NSString **)username password:(NSString **)password;
 
 @end

Modified: trunk/bibdesk/BDSKServerInfo.m
===================================================================
--- trunk/bibdesk/BDSKServerInfo.m      2022-09-26 09:25:09 UTC (rev 27934)
+++ trunk/bibdesk/BDSKServerInfo.m      2022-09-26 09:45:50 UTC (rev 27935)
@@ -69,10 +69,6 @@
 // Currently, anything other than zoom is expected to have just a type, name, 
and database.
 // Also when other validations are necessary, changing the type must make sure 
that the data validates properly for the new type, if necessary adding missing 
values.
 
-@interface BDSKServerInfo ()
-@property (nonatomic, readonly) NSString *passwordFromKeychain;
-@end
-
 @interface BDSKMutableServerInfo ()
 - (void)savePasswordInKeychain;
 @end
@@ -80,7 +76,7 @@
 @implementation BDSKServerInfo
 
 @synthesize type, name, database;
-@dynamic dictionaryValue, host, port, password, username, recordSyntax, 
resultEncoding, queryConfig, removeDiacritics, lite, options, entrez, zoom, 
ISI, DBLP, passwordFromKeychain, serverType;
+@dynamic dictionaryValue, host, port, password, username, recordSyntax, 
resultEncoding, queryConfig, removeDiacritics, lite, options, entrez, zoom, 
ISI, DBLP, serverType;
 
 + (BOOL)accessInstanceVariablesDirectly { return NO; }
 
@@ -296,16 +292,6 @@
     return YES;
 }
 
-- (NSString *)passwordFromKeychain {
-    if ([self isZoom] == NO && [self isISI] == NO)
-        return nil;
-    NSString *account = [self username];
-    NSString *server = [self isISI] ? ISI_SERVER : [self host];
-    if (account == nil || server == nil)
-        return nil;
-    return [BDSKPasswordController passwordForKeychainServer:server 
port:[[self port] integerValue] account:account];
-}
-
 @end
 
 
@@ -395,6 +381,7 @@
 }
 
 - (NSString *)password {
+    // do return the value to the UI while editing
     NSString *password = nil;
     [self getUsername:NULL password:&password];
     return password;

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to