if (includeTab) {
// user roles check
if (configTab.getGlobalPermissionActions() != null
&& !configTab.getGlobalPermissionActions().isEmpty()) {
try {
GlobalPermission perm =
new GlobalPermission(configTab.getGlobalPermissionActions());
if (!umgr.checkPermission(perm, user)) {
includeTab = false;
}
} catch (WebloggerException ex) {
log.debug("ERROR: fetching user roles", ex);
includeTab = false;
}
}
}
if (includeTab) {
// weblog permissions check
if (configTab.getWeblogPermissionActions() != null
&& !configTab.getWeblogPermissionActions().isEmpty()) {
WeblogPermission perm =
new WeblogPermission(weblog, configTab.getWeblogPermissionActions());
includeTab = umgr.checkPermission(perm, user);
}
}
if (includeTab) {
log.debug("tab allowed - "+configTab.getName());
// all checks passed, tab should be included
MenuTab tab = new MenuTab();
tab.setKey(configTab.getName());
// setup tab items
boolean firstItem = true;
ParsedTabItem configTabItem = null;
Iterator itemsIter = configTab.getTabItems().iterator();
while (itemsIter.hasNext()) {
configTabItem = (ParsedTabItem) itemsIter.next();
log.debug("config tab item = "+configTabItem.getName());
boolean includeItem = true;
if (configTabItem.getEnabledProperty() != null) {
includeItem = getBooleanProperty(configTabItem.getEnabledProperty());
} else if (configTabItem.getDisabledProperty() != null) {
includeItem = ! getBooleanProperty(configTabItem.getDisabledProperty());
}
if (includeItem) {
// user roles check
if (configTabItem.getGlobalPermissionActions() != null
&& !configTabItem.getGlobalPermissionActions().isEmpty()) {
GlobalPermission perm =
new GlobalPermission(configTabItem.getGlobalPermissionActions());
if (!umgr.checkPermission(perm, user)) {
includeItem = false;
}
}
}