Added "Logged in" role label

This commit is contained in:
Francesco Mangiacrapa 2021-12-13 11:27:03 +01:00
parent ca09e9ef94
commit b028fcd4b4
3 changed files with 22 additions and 3 deletions

View File

@ -186,10 +186,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
} catch (Exception e) { } catch (Exception e) {
} }
initGUI();
myRights = result; myRights = result;
initGUI();
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
String msg = "Logged in as ";
if(userRole != null && userRole.getName()!=null) {
msg+= userRole.getName().substring(userRole.getName().indexOf("-")+1, userRole.getName().length());
}else
msg+="Member";
mainTabPanel.setRoleLabel(msg);
RoleRights roleRights = myRights.getRoleRights(); RoleRights roleRights = myRights.getRoleRights();
boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT); boolean canCreateNewItem = roleRights.getListPermessions().keySet().contains(ACTION_ON_ITEM.CREATE_NEW_PROJECT);

View File

@ -38,6 +38,7 @@ import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
@ -130,6 +131,9 @@ public class GeonaMainTabPanel extends Composite {
@UiField @UiField
Button resetSearch; Button resetSearch;
@UiField
Label roleLabel;
private HandlerManager appManagerBus; private HandlerManager appManagerBus;
@ -341,6 +345,10 @@ public class GeonaMainTabPanel extends Composite {
}); });
} }
public void setRoleLabel(String msg) {
roleLabel.setText(msg);
}
private void doSearchEvent() { private void doSearchEvent() {
String searchText = searchField.getText(); String searchText = searchField.getText();

View File

@ -52,6 +52,8 @@
<g:HTMLPanel> <g:HTMLPanel>
<b:PageHeader subtext="data entry facility" <b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}">GNA</b:PageHeader> styleName="{style.custom-page-header}">GNA</b:PageHeader>
<g:Label ui:field="roleLabel"
addStyleNames="{style.display-right}"></g:Label>
<b:TabPanel tabPosition="above" ui:field="tabPanel"> <b:TabPanel tabPosition="above" ui:field="tabPanel">
<b:Tab icon="FILE_TEXT" heading="New Project" active="true" <b:Tab icon="FILE_TEXT" heading="New Project" active="true"
ui:field="tabNewProject"> ui:field="tabNewProject">