the list of licenses, organizations in which the user can publish and product profiles are preloaded and put into session by the ckan portlet
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@129805 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d0f8e7e12c
commit
b2b8dc97d5
|
@ -53,13 +53,14 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
public static final String TEST_SCOPE = "/gcube/devsec/devVRE";
|
||||||
public static final String TEST_USER = "test.user";
|
public static final String TEST_USER = "test.user";
|
||||||
|
|
||||||
public static final String CKAN_TOKEN_KEY = "ckanToken";
|
|
||||||
public static final String CKAN_LICENSES_KEY = "ckanLicenses";
|
|
||||||
private static final String CKAN_ORGANIZATIONS_KEY = "ckanOrganizations";
|
|
||||||
private static final String CKAN_PROFILES_KEY = "ckanProfiles";
|
|
||||||
private final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
|
private final static String TEST_SEC_TOKEN = "4620e6d0-2313-4f48-9d54-eb3efd01a810";
|
||||||
|
|
||||||
|
// ckan keys for ASL
|
||||||
|
private static final String CKAN_TOKEN_KEY = "ckanToken";
|
||||||
|
private static final String CKAN_LICENSES_KEY = "ckanLicenses"; // licenses
|
||||||
|
private static final String CKAN_ORGANIZATIONS_PUBLISH_KEY = "ckanOrganizationsPublish"; // here he can publish
|
||||||
|
private static final String CKAN_PROFILES_KEY = "ckanProfiles"; // product profiles
|
||||||
|
|
||||||
private Object LOCK = new Object();
|
private Object LOCK = new Object();
|
||||||
|
|
||||||
// library util instance
|
// library util instance
|
||||||
|
@ -170,9 +171,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
CKanUtilsImpl ckanUtils = getCkanUtilsObj();
|
CKanUtilsImpl ckanUtils = getCkanUtilsObj();
|
||||||
|
|
||||||
if(session.getAttribute(CKAN_ORGANIZATIONS_KEY) != null){
|
if(session.getAttribute(CKAN_ORGANIZATIONS_PUBLISH_KEY) != null){
|
||||||
orgsName = (List<String>)session.getAttribute(CKAN_ORGANIZATIONS_KEY);
|
orgsName = (List<String>)session.getAttribute(CKAN_ORGANIZATIONS_PUBLISH_KEY);
|
||||||
logger.debug("List of organizations was into session");
|
logger.info("List of organizations was into session");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
if(getCkanUtilsObj().isSysAdmin(username, getUserCKanTokenFromSession())){
|
if(getCkanUtilsObj().isSysAdmin(username, getUserCKanTokenFromSession())){
|
||||||
|
@ -199,8 +200,8 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
logger.debug("The user has a role ADMIN/EDITOR into org " + entry.getKey());
|
logger.debug("The user has a role ADMIN/EDITOR into org " + entry.getKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session.setAttribute(CKAN_ORGANIZATIONS_KEY, orgsName);
|
session.setAttribute(CKAN_ORGANIZATIONS_PUBLISH_KEY, orgsName);
|
||||||
logger.debug("Organizations name for user " + username + " has been saved into session");
|
logger.info("Organizations name for user " + username + " has been saved into session");
|
||||||
}
|
}
|
||||||
|
|
||||||
return orgsName;
|
return orgsName;
|
||||||
|
@ -244,7 +245,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
|
|
||||||
if(session.getAttribute(CKAN_PROFILES_KEY) != null){
|
if(session.getAttribute(CKAN_PROFILES_KEY) != null){
|
||||||
beans = (List<MetaDataProfileBean>)session.getAttribute(CKAN_PROFILES_KEY);
|
beans = (List<MetaDataProfileBean>)session.getAttribute(CKAN_PROFILES_KEY);
|
||||||
logger.debug("List of profiles was into session");
|
logger.info("List of profiles was into session");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
@ -289,7 +290,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
||||||
beans.add(bean);
|
beans.add(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("List of beans is " + beans);
|
logger.info("List of beans is " + beans);
|
||||||
session.setAttribute(CKAN_PROFILES_KEY, beans);
|
session.setAttribute(CKAN_PROFILES_KEY, beans);
|
||||||
logger.debug("List of profiles has been saved into session");
|
logger.debug("List of profiles has been saved into session");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue