User cache is removed on configuration update/create

migrating_to_smartgears_4
Luca Frosini 2 years ago
parent c227d5069d
commit 7acdc6a718

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.gcat.persistence.ckan.CKANUserCache;
/**
* @author Luca Frosini (ISTI - CNR)
@ -52,6 +53,11 @@ public class CatalogueConfigurationFactory {
GCoreISConfigurationProxy gCoreISConfigurationProxy = new GCoreISConfigurationProxy(context, catalogueConfiguration);
catalogueConfiguration = gCoreISConfigurationProxy.createOrUpdateOnIS();
catalogueConfigurations.put(context, catalogueConfiguration);
// The supported organizations could be changed we need to empty the user cache for the context
// to avoid to miss to add an user in an organization which has been added.
CKANUserCache.emptyUserCache();
return catalogueConfiguration;
}

@ -69,6 +69,12 @@ public abstract class CKANUserCache {
}
}
public synchronized static void emptyUserCache() {
SecretManager secretManager = SecretManagerProvider.instance.get();
String context = secretManager.getContext();
userCachePerContext.remove(context);
}
@Override
protected void finalize() throws Throwable {
super.finalize();

Loading…
Cancel
Save