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:
parent
ec3fe3ddca
commit
6e81905da1
|
@ -49,7 +49,7 @@ public class MyVREs implements EntryPoint {
|
|||
RootPanel.get("myVREsDIV").add(new VresPanel(params));
|
||||
}
|
||||
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
|
||||
public void onSuccess(AuthorizationBean result) {
|
||||
if (result.isSuccess()) {
|
||||
|
|
|
@ -18,5 +18,5 @@ public interface MyVREsService extends RemoteService {
|
|||
|
||||
String getSiteLandingPagePath();
|
||||
|
||||
AuthorizationBean getUserQualifierToken(String context, String state, String clientId, String authorisedRedirectURL);
|
||||
AuthorizationBean getOAuthTempCode(String context, String state, String clientId, String authorisedRedirectURL);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface MyVREsServiceAsync {
|
|||
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.gcube.portlet.user.my_vres.client.widgets.ClickableVRE;
|
|||
import org.gcube.portlet.user.my_vres.shared.VRE;
|
||||
|
||||
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.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
|
@ -33,7 +34,7 @@ public class VresPanel extends Composite {
|
|||
private HorizontalPanel imagesPanel = new HorizontalPanel();
|
||||
private Image loadingImage = new Image(loading);
|
||||
private LinkedHashMap<String, ArrayList<VRE>> cachedVREs = null;
|
||||
|
||||
|
||||
boolean hasVres = false;
|
||||
|
||||
public VresPanel(GetParameters params) {
|
||||
|
@ -48,10 +49,14 @@ public class VresPanel extends Composite {
|
|||
catPanel.setWidth("95%");
|
||||
loadVREs(params);
|
||||
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) {
|
||||
|
||||
|
||||
mainPanel.add(loadingImage);
|
||||
myVREsService.getUserVREs(new AsyncCallback<LinkedHashMap<String,ArrayList<VRE>>>() {
|
||||
|
||||
|
@ -92,9 +97,14 @@ public class VresPanel extends Composite {
|
|||
hasVREs = true;
|
||||
ClickableVRE vreButton = new ClickableVRE(myVREsService, vre, (i < LOAD_MAX_IMAGE_NO), params);
|
||||
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++;
|
||||
}
|
||||
|
||||
|
||||
mainPanel.add(flowPanel);
|
||||
}
|
||||
}
|
||||
|
@ -107,9 +117,9 @@ public class VresPanel extends Composite {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.portlet.user.my_vres.shared.AuthorizationBean;
|
|||
import org.gcube.portlet.user.my_vres.shared.VRE;
|
||||
|
||||
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.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.MouseOverEvent;
|
||||
|
@ -62,7 +63,7 @@ public class ClickableVRE extends HTML {
|
|||
if (params != null) {
|
||||
addClickHandler(new ClickHandler() {
|
||||
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
|
||||
public void onSuccess(AuthorizationBean result) {
|
||||
if (result.isSuccess()) {
|
||||
|
@ -121,8 +122,8 @@ public class ClickableVRE extends HTML {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -57,7 +57,6 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
|||
* needed when querying for authorised services in authentication
|
||||
*/
|
||||
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_IMAGE_PATH= "images/More.png";
|
||||
|
@ -263,7 +262,7 @@ public class MyVREsServiceImpl extends RemoteServiceServlet implements MyVREsSer
|
|||
}
|
||||
|
||||
@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();
|
||||
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");
|
||||
|
|
Loading…
Reference in New Issue