Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-2179

When removing a user then their alias names are not removed from database

XMLWordPrintable

      When i delete an user then the related alias names are not removed. (database table: cwd_application_alias)

      As workaround i create a crowd plugin with a listener, which cleans up the alias names after removing the user.

      public class RemoveUserAliasListener {
      
      	private static final Logger logger = Logger.getLogger(RemoveUserAliasListener.class);
      
      	private AliasManager aliasManager;
      
      	private GlobalMMSManager globalMMSManager;
      
      	@EventListener
      	public void removeAlias(UserDeletedEvent event) {
      		if (StringUtils.isNotBlank(event.getUsername())) {
      			try {
      				aliasManager.removeAlias(globalMMSManager.getCrowdCAS(), event.getUsername());
      			} catch (Exception e) {
      				logger.warn(e.getMessage());
      			}
      		}
      	}
      
      	public void setAliasManager(AliasManager aliasManager) {
      		this.aliasManager = aliasManager;
      	}
      
      	public void setGlobalMMSManager(GlobalMMSManager globalMMSManager) {
      		this.globalMMSManager = globalMMSManager;
      	}
      
      }

              Unassigned Unassigned
              287676b6b997 Andreas Reif
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: