Search in sources :

Example 1 with PerunPrincipal

use of cz.metacentrum.perun.webgui.model.PerunPrincipal in project perun by CESNET.

the class UsersApplicationsPage method refresh.

/**
	 * Refresh the page
	 */
private void refresh() {
    bodyContents.clear();
    String user = "";
    if (session.getUser() != null) {
        user = this.session.getUser().getFullNameWithTitles().trim();
    } else {
        PerunPrincipal pp = session.getPerunPrincipal();
        if (!pp.getAdditionInformations("displayName").equals("")) {
            user = pp.getAdditionInformations("displayName");
        } else if (!pp.getAdditionInformations("cn").equals("")) {
            user = pp.getAdditionInformations("cn");
        } else {
            if (pp.getExtSourceType().equals("cz.metacentrum.perun.core.impl.ExtSourceX509")) {
                user = Utils.convertCertCN(pp.getActor());
            } else {
                user = pp.getActor();
            }
        }
    }
    bodyContents.add(new HTML("<h1>" + ApplicationMessages.INSTANCE.applicationsForUser(user) + "</h1>"));
    // callback
    int userId = 0;
    if (session.getUser() != null) {
        userId = session.getUser().getId();
    }
    final GetApplicationsForUserForAppFormGui req = new GetApplicationsForUserForAppFormGui(userId);
    final ListBox listBox = new ListBox();
    req.setEvents(new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            ArrayList<Application> appls = JsonUtils.jsoAsList(jso);
            ArrayList<String> vos = new ArrayList<String>();
            for (Application app : appls) {
                if (!vos.contains(app.getVo().getName())) {
                    vos.add(app.getVo().getName());
                }
            }
            Collections.sort(vos);
            for (String s : vos) {
                listBox.addItem(s);
            }
            if (listBox.getItemCount() > 0) {
                listBox.insertItem(WidgetTranslation.INSTANCE.listboxAll(), 0);
            }
            for (int i = 0; i < listBox.getItemCount(); i++) {
                if (listBox.getItemText(i).equals(ApplicationFormGui.getVo().getName())) {
                    listBox.setSelectedIndex(i);
                    req.filterTable(ApplicationFormGui.getVo().getName());
                    break;
                }
            }
        }

        @Override
        public void onError(PerunError error) {
        }

        @Override
        public void onLoadingStart() {
            listBox.clear();
        }
    });
    req.setCheckable(false);
    listBox.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent changeEvent) {
            if (listBox.getSelectedIndex() > 0) {
                req.filterTable(listBox.getItemText(listBox.getSelectedIndex()));
            } else {
                // show all
                req.filterTable("");
            }
        }
    });
    final TabMenu tabMenu = new TabMenu();
    tabMenu.addWidget(new HTML("<strong>" + ApplicationMessages.INSTANCE.filterByVo() + ":</strong>"));
    tabMenu.addWidget(listBox);
    tabMenu.addWidget(new Image(SmallIcons.INSTANCE.helpIcon()));
    tabMenu.addWidget(new HTML("<strong>" + ApplicationMessages.INSTANCE.clickOnApplicationToSee() + "</strong>"));
    tabMenu.addStyleName("tabMenu");
    final VerticalPanel applicationsWrapper = new VerticalPanel();
    applicationsWrapper.setSize("100%", "100%");
    applicationsWrapper.add(tabMenu);
    final CellTable<Application> appsTable = req.getTable(new FieldUpdater<Application, String>() {

        public void update(int index, Application object, String value) {
            applicationsWrapper.clear();
            applicationsWrapper.add(backButton);
            applicationsWrapper.add(getApplicationDetailWidget(object));
        }
    });
    appsTable.addStyleName("perun-table");
    applicationsWrapper.add(appsTable);
    backButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            applicationsWrapper.clear();
            applicationsWrapper.add(tabMenu);
            applicationsWrapper.add(appsTable);
        }
    });
    bodyContents.add(applicationsWrapper);
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal) GetApplicationsForUserForAppFormGui(cz.metacentrum.perun.webgui.json.registrarManager.GetApplicationsForUserForAppFormGui) PerunError(cz.metacentrum.perun.webgui.model.PerunError) Application(cz.metacentrum.perun.webgui.model.Application)

Example 2 with PerunPrincipal

use of cz.metacentrum.perun.webgui.model.PerunPrincipal in project perun by CESNET.

the class PasswordResetGui method loadPerunPrincipal.

/**
	 * Performs a login into the RPC, loads user and his roles into session and enables GUI.
	 */
private void loadPerunPrincipal() {
    // show loading box
    final PopupPanel loadingBox = session.getUiElements().perunLoadingBox();
    loadingBox.show();
    // events after getting PerunPrincipal from RPC
    final JsonCallbackEvents events = new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // store perun principal into session for future use
            PerunPrincipal pp = (PerunPrincipal) jso;
            session.setPerunPrincipal(pp);
            // check if user exists
            if (session.getUser() != null && !pp.getRoles().hasAnyRole() && !session.getRpcUrl().startsWith("/non/rpc")) {
                // if not and no role, redraw page body
                RootLayoutPanel body = RootLayoutPanel.get();
                loadingBox.hide();
                body.clear();
                body.add(new NotUserOfPerunWidget());
                return;
            }
            if (session.getUser() != null && !pp.getRoles().hasAnyRole()) {
                // store users roles and editable entities into session
                session.setRoles(pp.getRoles());
                // display logged user
                session.getUiElements().setLoggedUserInfo(pp);
            }
            GetGuiConfiguration getConf = new GetGuiConfiguration(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    session.setConfiguration((BasicOverlayType) jso.cast());
                    // hides the loading box
                    loadingBox.hide();
                    if (session.getRpcUrl().startsWith("/non/rpc")) {
                        // CHALLENGE WITH CAPTCHA
                        FlexTable ft = new FlexTable();
                        ft.setSize("100%", "500px");
                        // captcha with public key
                        String key = Utils.getReCaptchaPublicKey();
                        if (key == null) {
                            PerunError error = new JSONObject().getJavaScriptObject().cast();
                            error.setErrorId("0");
                            error.setName("Missing public key");
                            error.setErrorInfo("Public key for Re-Captcha service is missing. Please add public key to GUIs configuration file.");
                            error.setRequestURL("");
                            UiElements.generateError(error, "Missing public key", "Public key for Re-Captcha service is missing.<br />Accessing password reset without authorization is not possible.");
                            loadingBox.hide();
                            return;
                        }
                        final RecaptchaWidget captcha = new RecaptchaWidget(key, LocaleInfo.getCurrentLocale().getLocaleName(), "clean");
                        final CustomButton cb = new CustomButton();
                        cb.setIcon(SmallIcons.INSTANCE.arrowRightIcon());
                        cb.setText(ApplicationMessages.INSTANCE.captchaSendButton());
                        cb.setImageAlign(true);
                        final TextBox response = new TextBox();
                        captcha.setOwnTextBox(response);
                        Scheduler.get().scheduleDeferred(new Command() {

                            @Override
                            public void execute() {
                                response.setFocus(true);
                            }
                        });
                        response.addKeyDownHandler(new KeyDownHandler() {

                            @Override
                            public void onKeyDown(KeyDownEvent event) {
                                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                                    cb.click();
                                }
                            }
                        });
                        cb.addClickHandler(new ClickHandler() {

                            @Override
                            public void onClick(ClickEvent clickEvent) {
                                VerifyCaptcha req = new VerifyCaptcha(captcha.getChallenge(), captcha.getResponse(), JsonCallbackEvents.disableButtonEvents(cb, new JsonCallbackEvents() {

                                    public void onFinished(JavaScriptObject jso) {
                                        BasicOverlayType bt = jso.cast();
                                        if (bt.getBoolean()) {
                                            // OK captcha answer - load GUI
                                            // add menu item and load content
                                            contentPanel.setWidget(new PasswordResetFormPage().getContent());
                                        //Anchor a = leftMenu.addMenuContents("Password reset", SmallIcons.INSTANCE.keyIcon(), new PasswordResetFormPage().getContent());
                                        //a.fireEvent(new ClickEvent(){});
                                        } else {
                                            // wrong captcha answer
                                            UiElements.generateAlert(ApplicationMessages.INSTANCE.captchaErrorHeader(), ApplicationMessages.INSTANCE.captchaErrorMessage());
                                        }
                                    }
                                }));
                                req.retrieveData();
                            }
                        });
                        // set layout
                        int row = 0;
                        ft.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE);
                        ft.setHTML(row, 0, "<h2>In order to continue to the password reset page, please, use CAPTCHA below.</h2>");
                        ft.setWidget(row + 1, 0, captcha);
                        ft.getFlexCellFormatter().setHorizontalAlignment(row + 1, 0, HasHorizontalAlignment.ALIGN_CENTER);
                        ft.getFlexCellFormatter().setVerticalAlignment(row + 1, 0, HasVerticalAlignment.ALIGN_BOTTOM);
                        FlexTable sendFt = new FlexTable();
                        sendFt.setStyleName("inputFormFlexTable");
                        sendFt.setWidget(0, 0, response);
                        sendFt.setWidget(0, 1, cb);
                        ft.setWidget(row + 2, 0, sendFt);
                        ft.getFlexCellFormatter().setHorizontalAlignment(row + 2, 0, HasHorizontalAlignment.ALIGN_CENTER);
                        ft.getFlexCellFormatter().setVerticalAlignment(row + 2, 0, HasVerticalAlignment.ALIGN_TOP);
                        ft.setHeight("100%");
                        ft.getFlexCellFormatter().setHeight(row, 0, "50%");
                        ft.getFlexCellFormatter().setHeight(row + 2, 0, "50%");
                        // finish loading GUI
                        loadingBox.hide();
                        contentPanel.setWidget(ft);
                    } else {
                        // add menu item and load content
                        contentPanel.setWidget(new PasswordResetFormPage().getContent());
                    //Anchor a = leftMenu.addMenuContents("Password reset", SmallIcons.INSTANCE.keyIcon(), new PasswordResetFormPage().getContent());
                    //a.fireEvent(new ClickEvent(){});
                    }
                }

                @Override
                public void onError(PerunError error) {
                    // hides the loading box
                    loadingBox.hide();
                    // shows error box
                    PopupPanel loadingFailedBox;
                    if (error == null) {
                        loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
                    } else {
                        if (error.getName().contains("UserNotExistsException")) {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                        } else {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                        }
                    }
                    loadingFailedBox.show();
                    leftMenu.addItem("Password reset", SmallIcons.INSTANCE.keyIcon(), null);
                }
            });
            getConf.retrieveData();
        }

        @Override
        public void onError(PerunError error) {
            // hides the loading box
            loadingBox.hide();
            // shows error box
            PopupPanel loadingFailedBox;
            if (error == null) {
                loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
            } else {
                if (error.getName().contains("UserNotExistsException")) {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                } else {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                }
            }
            loadingFailedBox.show();
            leftMenu.addItem("Password reset", SmallIcons.INSTANCE.keyIcon(), null);
        }
    };
    GetPerunPrincipal loggedUserRequest = new GetPerunPrincipal(events);
    loggedUserRequest.retrieveData();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) BasicOverlayType(cz.metacentrum.perun.webgui.model.BasicOverlayType) VerifyCaptcha(cz.metacentrum.perun.webgui.json.registrarManager.VerifyCaptcha) JSONObject(com.google.gwt.json.client.JSONObject) Command(com.google.gwt.user.client.Command) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) RecaptchaWidget(cz.metacentrum.perun.webgui.widgets.recaptcha.RecaptchaWidget) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) PerunError(cz.metacentrum.perun.webgui.model.PerunError) PasswordResetFormPage(cz.metacentrum.perun.webgui.client.passwordresetresources.PasswordResetFormPage) GetGuiConfiguration(cz.metacentrum.perun.webgui.json.GetGuiConfiguration)

Example 3 with PerunPrincipal

use of cz.metacentrum.perun.webgui.model.PerunPrincipal in project perun by CESNET.

the class GetPerunPrincipal method onFinished.

/**
 * When successfully finishes
 */
public void onFinished(JavaScriptObject jso) {
    PerunPrincipal pp = (PerunPrincipal) jso;
    pp.setObjectType("PerunPrincipal");
    session.getUiElements().setLogText("Logged as: " + pp.getActor() + " with Ext source: " + pp.getExtSource());
    events.onFinished(jso);
}
Also used : PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal)

Example 4 with PerunPrincipal

use of cz.metacentrum.perun.webgui.model.PerunPrincipal in project perun by CESNET.

the class WebGui method loadPerunPrincipal.

/**
 * Performs a login into the RPC, loads user and his roles into session and enables GUI.
 */
private void loadPerunPrincipal() {
    // WEB PAGE SPLITTER
    final DockLayoutPanel bodySplitter = new DockLayoutPanel(Unit.PX);
    body.add(bodySplitter);
    // MAIN CONTENT WRAPPER - make content resize-able
    final ResizeLayoutPanel contentWrapper = new ResizeLayoutPanel();
    contentWrapper.setSize("100%", "100%");
    // MAIN CONTENT
    AbsolutePanel contentPanel = new AbsolutePanel();
    contentPanel.setSize("100%", "100%");
    // put content into wrapper
    contentWrapper.setWidget(contentPanel);
    // SETUP SESSION
    // store handler for main contetn's elements (tabs etc.) into session
    session.setUiElements(new UiElements(contentPanel));
    // Store TabManager into session for handling tabs (add/remove/close...)
    session.setTabManager(new TabManager());
    // Store this class into session
    session.setWebGui(webgui);
    // Set this class as browser's History handler
    History.addValueChangeHandler(webgui);
    // show loading box
    final PopupPanel loadingBox = session.getUiElements().perunLoadingBox();
    loadingBox.show();
    // events after getting PerunPrincipal from RPC
    final JsonCallbackEvents events = new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // store perun principal into session for future use
            final PerunPrincipal pp = (PerunPrincipal) jso;
            session.setPerunPrincipal(pp);
            GetGuiConfiguration getConfig = new GetGuiConfiguration(new JsonCallbackEvents() {

                @Override
                public void onFinished(JavaScriptObject jso) {
                    session.setConfiguration((BasicOverlayType) jso.cast());
                    String newGuiAlertContent = session.getConfiguration().getCustomProperty("newAdminGuiAlert");
                    if (newGuiAlertContent != null && !newGuiAlertContent.isEmpty()) {
                        DOM.getElementById("perun-new-gui-alert").setInnerHTML(newGuiAlertContent);
                        DOM.getElementById("perun-new-gui-alert").setClassName("newGuiAlertActive");
                    }
                    // check if user exists
                    if (session.getUser() == null && !pp.getRoles().hasAnyRole()) {
                        // if not and no role, redraw page body
                        RootLayoutPanel body = RootLayoutPanel.get();
                        loadingBox.hide();
                        body.clear();
                        body.add(new NotUserOfPerunWidget());
                        return;
                    }
                    // check if user exists
                    if (session.getUser().isServiceUser()) {
                        // if not and no role, redraw page body
                        RootLayoutPanel body = RootLayoutPanel.get();
                        loadingBox.hide();
                        body.clear();
                        body.add(new CantLogAsServiceUserWidget());
                        return;
                    }
                    // Sets URL mapper for loading proper tabs
                    urlMapper = new UrlMapper();
                    // MENU WRAPPER
                    VerticalPanel menuWrapper = new VerticalPanel();
                    menuWrapper.setHeight("100%");
                    // add menu
                    menuWrapper.add(session.getUiElements().getMenu().getWidget());
                    menuWrapper.setCellVerticalAlignment(session.getUiElements().getMenu().getWidget(), HasVerticalAlignment.ALIGN_TOP);
                    // Put all panels into web page splitter
                    // bodySplitter.addNorth(session.getUiElements().getHeader(), 78);
                    bodySplitter.addNorth(session.getUiElements().getHeader(), 64);
                    bodySplitter.addSouth(session.getUiElements().getFooter(), 30);
                    bodySplitter.addWest(menuWrapper, 202);
                    // content must be added as last !!
                    bodySplitter.add(contentWrapper);
                    // Append more GUI elements from UiElements class which are not part of splitted design
                    if ("true".equalsIgnoreCase(Location.getParameter("log"))) {
                        // log
                        bodySplitter.getElement().appendChild(session.getUiElements().getLog().getElement());
                    }
                    // status
                    bodySplitter.getElement().appendChild(session.getUiElements().getStatus().getElement());
                    // keep alive
                    VerticalPanel vp = new VerticalPanel();
                    vp.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
                    vp.add(new HTML("<h2>Connection to Perun has been lost.</h2><strong>Please check your internet connection.</strong>"));
                    final FlexTable layout = new FlexTable();
                    layout.setVisible(false);
                    layout.setHTML(0, 0, "<p>You can also try to <strong>refresh the browser window</strong>. However, all <strong>unsaved changes will be lost</strong>.");
                    layout.getFlexCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_TOP);
                    vp.add(layout);
                    vp.setSpacing(10);
                    final Confirm c = new Confirm("", vp, true);
                    c.setAutoHide(false);
                    c.setHideOnButtonClick(false);
                    c.setOkIcon(SmallIcons.INSTANCE.arrowRefreshIcon());
                    c.setOkButtonText("Re-connect");
                    c.setNonScrollable(true);
                    c.setOkClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            KeepAlive call = new KeepAlive(JsonCallbackEvents.disableButtonEvents(c.getOkButton(), new JsonCallbackEvents() {

                                @Override
                                public void onLoadingStart() {
                                    checkPending = true;
                                }

                                @Override
                                public void onFinished(JavaScriptObject jso) {
                                    BasicOverlayType type = jso.cast();
                                    checkPending = false;
                                    connected = true;
                                    keepAliveCounter = 0;
                                    if (type.getString().equals("OK")) {
                                        if (c.isShowing()) {
                                            c.hide();
                                        }
                                    }
                                    // If ok, append new keepalive checker
                                    appendKeepAliveChecker(c);
                                }

                                @Override
                                public void onError(PerunError error) {
                                    checkPending = false;
                                    // connection lost only IF TIMEOUT
                                    if (error != null && error.getErrorId().equals("0")) {
                                        keepAliveCounter++;
                                        if (keepAliveCounter >= keepAliveTreshold) {
                                            connected = false;
                                            if (!c.isShowing()) {
                                                c.show();
                                            }
                                            layout.setVisible(true);
                                            c.getOkButton().setText("Reload");
                                            c.getOkButton().addClickHandler(new ClickHandler() {

                                                @Override
                                                public void onClick(ClickEvent event) {
                                                    Window.Location.reload();
                                                }
                                            });
                                        } else {
                                            // not connected but under treshold
                                            appendKeepAliveChecker(c);
                                        }
                                    }
                                }
                            }));
                            call.retrieveData();
                        }
                    });
                    appendKeepAliveChecker(c);
                    // store users roles and editable entities into session
                    session.setRoles(pp.getRoles());
                    // display logged user
                    session.getUiElements().setLoggedUserInfo(pp);
                    session.getUiElements().setLogText("Welcome " + pp.getUser().getFullNameWithTitles());
                    // show extended info ?
                    boolean showExtendedInfo = false;
                    // is perun admin ?
                    if (session.isPerunAdmin()) {
                        showExtendedInfo = true;
                    }
                    // replace by local storage if possible
                    Storage localStorage = Storage.getLocalStorageIfSupported();
                    if (localStorage != null) {
                        String value = localStorage.getItem("urn:perun:gui:preferences:extendedInfo");
                        if (value != null) {
                            showExtendedInfo = Boolean.parseBoolean(value);
                        }
                    }
                    // finally set it
                    JsonUtils.setExtendedInfoVisible(showExtendedInfo);
                    // set extended info button
                    session.getUiElements().getExtendedInfoButtonWidget().setDown(showExtendedInfo);
                    // Specific GDPR approval is required only from admins
                    if (session.isFacilityAdmin() || session.isVoAdmin() || session.isVoObserver() || session.isGroupAdmin() || session.isPerunAdmin() || session.isSecurityAdmin()) {
                        checkGdprApproval(new JsonCallbackEvents() {

                            @Override
                            public void onFinished(JavaScriptObject jso) {
                                // FINISH LOADING UI ONCE ITS CHECKED
                                // perun loaded = true
                                perunLoaded = true;
                                // loads the page based on URL or default
                                loadPage();
                                // hides the loading box
                                loadingBox.hide();
                                // load proper parts of menu (based on roles)
                                session.getUiElements().getMenu().prepare();
                            }

                            @Override
                            public void onError(PerunError error) {
                                // hides the loading box
                                loadingBox.hide();
                                // shows error box
                                PopupPanel loadingFailedBox;
                                if (error != null) {
                                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                                } else {
                                    String checkFailed = session.getConfiguration().getGDPRproperty("check_failed");
                                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(checkFailed);
                                }
                                loadingFailedBox.show();
                            }
                        });
                    } else {
                        // NO GDPR CHECK NEEDED
                        // perun loaded = true
                        perunLoaded = true;
                        // loads the page based on URL or default
                        loadPage();
                        // hides the loading box
                        loadingBox.hide();
                        // load proper parts of menu (based on roles)
                        session.getUiElements().getMenu().prepare();
                    }
                }

                @Override
                public void onError(PerunError error) {
                    // hides the loading box
                    loadingBox.hide();
                    // shows error box
                    PopupPanel loadingFailedBox;
                    if (error != null) {
                        loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
                    } else {
                        if (error.getName().contains("UserNotExistsException")) {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                        } else {
                            loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                        }
                    }
                    if (!error.getErrorId().equals("0")) {
                        loadingFailedBox.show();
                    }
                }
            });
            getConfig.retrieveData();
        }

        @Override
        public void onError(PerunError error) {
            // hides the loading box
            loadingBox.hide();
            // shows error box
            PopupPanel loadingFailedBox;
            if (error == null) {
                loadingFailedBox = session.getUiElements().perunLoadingFailedBox("Request timeout exceeded.");
            } else {
                if (error.getName().contains("UserNotExistsException")) {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox("You are not registered to any Virtual Organization.</br></br>" + error.getErrorInfo());
                } else {
                    loadingFailedBox = session.getUiElements().perunLoadingFailedBox(error.getErrorInfo());
                }
            }
            loadingFailedBox.show();
        }
    };
    GetPerunPrincipal loggedUserRequst = new GetPerunPrincipal(events);
    loggedUserRequst.retrieveData();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) TabManager(cz.metacentrum.perun.webgui.tabs.TabManager) BasicOverlayType(cz.metacentrum.perun.webgui.model.BasicOverlayType) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) CantLogAsServiceUserWidget(cz.metacentrum.perun.webgui.widgets.CantLogAsServiceUserWidget) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) PerunPrincipal(cz.metacentrum.perun.webgui.model.PerunPrincipal) GetPerunPrincipal(cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal) GetGuiConfiguration(cz.metacentrum.perun.webgui.json.GetGuiConfiguration) UrlMapper(cz.metacentrum.perun.webgui.tabs.UrlMapper) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Storage(com.google.gwt.storage.client.Storage) NotUserOfPerunWidget(cz.metacentrum.perun.webgui.widgets.NotUserOfPerunWidget) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) KeepAlive(cz.metacentrum.perun.webgui.json.authzResolver.KeepAlive) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Aggregations

PerunPrincipal (cz.metacentrum.perun.webgui.model.PerunPrincipal)4 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)3 PerunError (cz.metacentrum.perun.webgui.model.PerunError)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 GetGuiConfiguration (cz.metacentrum.perun.webgui.json.GetGuiConfiguration)2 GetPerunPrincipal (cz.metacentrum.perun.webgui.json.authzResolver.GetPerunPrincipal)2 BasicOverlayType (cz.metacentrum.perun.webgui.model.BasicOverlayType)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 JSONObject (com.google.gwt.json.client.JSONObject)1 Storage (com.google.gwt.storage.client.Storage)1 Command (com.google.gwt.user.client.Command)1 PasswordResetFormPage (cz.metacentrum.perun.webgui.client.passwordresetresources.PasswordResetFormPage)1 KeepAlive (cz.metacentrum.perun.webgui.json.authzResolver.KeepAlive)1 GetApplicationsForUserForAppFormGui (cz.metacentrum.perun.webgui.json.registrarManager.GetApplicationsForUserForAppFormGui)1 VerifyCaptcha (cz.metacentrum.perun.webgui.json.registrarManager.VerifyCaptcha)1 Application (cz.metacentrum.perun.webgui.model.Application)1 TabManager (cz.metacentrum.perun.webgui.tabs.TabManager)1