view m-toolbox/classes/@LTPDARepositoryManager/cb_timerClearPassord.m @ 10:75007001cbfe database-connection-manager

Check for binary only objects
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +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