personalised view in case of scope selection for authorisation

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/my-vres@142115 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-02-02 18:24:36 +00:00
parent ec3fe3ddca
commit 6e81905da1
6 changed files with 24 additions and 14 deletions

View File

@ -49,7 +49,7 @@ public class MyVREs implements EntryPoint {
RootPanel.get("myVREsDIV").add(new VresPanel(params)); RootPanel.get("myVREsDIV").add(new VresPanel(params));
} }
else { else {
myVREsService.getUserQualifierToken(params.context, params.state, params.clientId, params.redirectURI, new AsyncCallback<AuthorizationBean>() { myVREsService.getOAuthTempCode(params.context, params.state, params.clientId, params.redirectURI, new AsyncCallback<AuthorizationBean>() {
@Override @Override
public void onSuccess(AuthorizationBean result) { public void onSuccess(AuthorizationBean result) {
if (result.isSuccess()) { if (result.isSuccess()) {

View File

@ -18,5 +18,5 @@ public interface MyVREsService extends RemoteService {
String getSiteLandingPagePath(); String getSiteLandingPagePath();
AuthorizationBean getUserQualifierToken(String context, String state, String clientId, String authorisedRedirectURL); AuthorizationBean getOAuthTempCode(String context, String state, String clientId, String authorisedRedirectURL);
} }

View File

@ -15,7 +15,7 @@ public interface MyVREsServiceAsync {
void getSiteLandingPagePath(AsyncCallback<String> callback); void getSiteLandingPagePath(AsyncCallback<String> callback);
void getUserQualifierToken(String context, String state, String clientId, String authorisedRedirectURI, void getOAuthTempCode(String context, String state, String clientId, String authorisedRedirectURI,
AsyncCallback<AuthorizationBean> callback); AsyncCallback<AuthorizationBean> callback);
} }

View File

@ -8,6 +8,7 @@ import org.gcube.portlet.user.my_vres.client.widgets.ClickableVRE;
import org.gcube.portlet.user.my_vres.shared.VRE; import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
@ -48,6 +49,10 @@ public class VresPanel extends Composite {
catPanel.setWidth("95%"); catPanel.setWidth("95%");
loadVREs(params); loadVREs(params);
initWidget(mainPanel); initWidget(mainPanel);
//change the portlet title only if is an authorisation
if (params != null)
ScriptInjector.fromString("$wnd.jQuery(\".portlet-title-text\").text('Please select in which of your VREs you approve this application');").inject();
} }
private void loadVREs(final GetParameters params) { private void loadVREs(final GetParameters params) {
@ -92,6 +97,11 @@ public class VresPanel extends Composite {
hasVREs = true; hasVREs = true;
ClickableVRE vreButton = new ClickableVRE(myVREsService, vre, (i < LOAD_MAX_IMAGE_NO), params); ClickableVRE vreButton = new ClickableVRE(myVREsService, vre, (i < LOAD_MAX_IMAGE_NO), params);
flowPanel.add(vreButton); flowPanel.add(vreButton);
//do not show the add more placeholder VRE is is an authorisation
if (params != null && vre.getName().compareTo("") == 0) {
mainPanel.remove(catPanel);
flowPanel.remove(vreButton);
}
i++; i++;
} }

View File

@ -7,6 +7,7 @@ import org.gcube.portlet.user.my_vres.shared.AuthorizationBean;
import org.gcube.portlet.user.my_vres.shared.VRE; import org.gcube.portlet.user.my_vres.shared.VRE;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.ScriptInjector;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.MouseOverEvent; import com.google.gwt.event.dom.client.MouseOverEvent;
@ -62,7 +63,7 @@ public class ClickableVRE extends HTML {
if (params != null) { if (params != null) {
addClickHandler(new ClickHandler() { addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
myVREsService.getUserQualifierToken(vre.getContext(), params.getState(), params.getClientId(), params.getRedirectURI(), new AsyncCallback<AuthorizationBean>() { myVREsService.getOAuthTempCode(vre.getContext(), params.getState(), params.getClientId(), params.getRedirectURI(), new AsyncCallback<AuthorizationBean>() {
@Override @Override
public void onSuccess(AuthorizationBean result) { public void onSuccess(AuthorizationBean result) {
if (result.isSuccess()) { if (result.isSuccess()) {
@ -121,8 +122,8 @@ public class ClickableVRE extends HTML {
} }
}); });
} }
} }

View File

@ -57,7 +57,6 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
* needed when querying for authorised services in authentication * needed when querying for authorised services in authentication
*/ */
public static final String REDIRECT_URL = "RedirectURL"; public static final String REDIRECT_URL = "RedirectURL";
private static final String SERVICE_ENDPOINT_CATEGORY = "OnlineService";
public static final String ADD_MORE_CATEGORY = "Add More"; public static final String ADD_MORE_CATEGORY = "Add More";
public static final String ADD_MORE_IMAGE_PATH= "images/More.png"; public static final String ADD_MORE_IMAGE_PATH= "images/More.png";
@ -263,7 +262,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
} }
@Override @Override
public AuthorizationBean getUserQualifierToken(String context, String state, String clientId, String redirectURL) { public AuthorizationBean getOAuthTempCode(String context, String state, String clientId, String redirectURL) {
String infraName = PortalContext.getConfiguration().getInfrastructureName(); String infraName = PortalContext.getConfiguration().getInfrastructureName();
if (clientId == null || clientId.compareTo("")== 0) { if (clientId == null || clientId.compareTo("")== 0) {
return new AuthorizationBean(null, null, false, "client_id is null, you MUST register your application to allow users connect with their D4Science Credentials"); return new AuthorizationBean(null, null, false, "client_id is null, you MUST register your application to allow users connect with their D4Science Credentials");