view m-toolbox/classes/@LTPDARepositoryManager/cb_timerClearPassord.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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