diff m-toolbox/classes/@LTPDARepositoryManager/cb_timerClearPassord.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m-toolbox/classes/@LTPDARepositoryManager/cb_timerClearPassord.m	Wed Nov 23 19:22:13 2011 +0100
@@ -0,0 +1,40 @@
+% cb_timerClearPassord callback method which disconnects the connection and clears the password
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% description: cb_timerClearPassord callback method which disconnects the
+%              connection and clears the password
+%
+% version:     $Id: cb_timerClearPassord.m,v 1.6 2010/08/16 18:04:36 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function varargout = cb_timerClearPassord(varargin)
+  
+  prefs = getappdata(0, 'LTPDApreferences');
+  
+  rm    = LTPDARepositoryManager();
+  conns = rm.manager.getConnections();
+  
+  if ~isempty(conns)
+    
+    for ii=1:conns.size
+      conn = conns.get(ii-1);
+      
+      % Clear the password only if the connection is not locked
+      if ~conn.isLocked
+        if conn.isConnected
+          conn.closeConnection();
+        end
+        
+        if (conn.agePassword > double(prefs.getRepoPrefs.getExpiry))
+          conn.setPassword('');
+        end
+      end
+      
+    end
+    
+  end
+  if ~isempty(rm.gui)
+    rm.gui.reloadConnectionTable();
+  end
+end