You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/03/22 11:47:34 UTC
svn commit: r1303723 - in /incubator/syncope/trunk:
client/src/main/java/org/syncope/types/
client/src/test/java/org/syncope/client/test/
console/src/main/java/org/syncope/console/pages/
console/src/main/java/org/syncope/console/pages/panels/ console/s...
Author: ilgrosso
Date: Thu Mar 22 10:47:33 2012
New Revision: 1303723
URL: http://svn.apache.org/viewvc?rev=1303723&view=rev
Log:
[SYNCOPE-20] console UI for audit management completed
Added:
incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java (with props)
incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java (with props)
incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java (with props)
incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html (with props)
incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html (with props)
incubator/syncope/trunk/console/src/main/webapp/img/tabs/
incubator/syncope/trunk/console/src/main/webapp/img/tabs/bg.gif (with props)
incubator/syncope/trunk/console/src/main/webapp/img/tabs/left.gif (with props)
incubator/syncope/trunk/console/src/main/webapp/img/tabs/left_on.gif (with props)
incubator/syncope/trunk/console/src/main/webapp/img/tabs/right.gif (with props)
incubator/syncope/trunk/console/src/main/webapp/img/tabs/right_on.gif (with props)
Modified:
incubator/syncope/trunk/client/src/test/java/org/syncope/client/test/JSONTest.java
incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java
incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java
incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java
incubator/syncope/trunk/console/src/main/resources/authorizations.xml
incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.html
incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.properties
incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports_it.properties
incubator/syncope/trunk/console/src/test/java/org/syncope/console/ReportTestITCase.java
incubator/syncope/trunk/core/src/main/java/org/syncope/core/audit/AuditManager.java
incubator/syncope/trunk/core/src/main/java/org/syncope/core/init/LoggerLoader.java
incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java
incubator/syncope/trunk/core/src/main/resources/content.xml
incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/LoggerTestITCase.java
incubator/syncope/trunk/core/src/test/resources/content.xml
Added: incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java?rev=1303723&view=auto
==============================================================================
--- incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java (added)
+++ incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java Thu Mar 22 10:47:33 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.types;
+
+import java.text.ParseException;
+import org.codehaus.jackson.annotate.JsonCreator;
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.springframework.util.StringUtils;
+import org.syncope.client.AbstractBaseBean;
+import org.syncope.types.AuditElements.Category;
+import org.syncope.types.AuditElements.Result;
+
+public class AuditLoggerName extends AbstractBaseBean {
+
+ private Category category;
+
+ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+ private Enum<?> subcategory;
+
+ private Result result;
+
+ @JsonCreator
+ public AuditLoggerName(@JsonProperty("category") final Category category,
+ @JsonProperty("subcategory") final Enum<?> subcategory, @JsonProperty("result") final Result result)
+ throws IllegalArgumentException {
+
+ if (category == null || subcategory == null || result == null) {
+ throw new IllegalArgumentException("Null values not permitted");
+ }
+
+ if (!category.getSubCategoryElements().contains(subcategory)) {
+ throw new IllegalArgumentException(category.name() + " does not contain " + subcategory.name());
+ }
+
+ this.category = category;
+ this.subcategory = subcategory;
+ this.result = result;
+ }
+
+ public Category getCategory() {
+ return category;
+ }
+
+ public Result getResult() {
+ return result;
+ }
+
+ public Enum<?> getSubcategory() {
+ return subcategory;
+ }
+
+ public String toLoggerName() {
+ return new StringBuilder().append(SyncopeLoggerType.AUDIT.getPrefix()).append('.').
+ append(category.name()).append('.').
+ append(subcategory.name()).append('.').
+ append(result.name()).toString();
+ }
+
+ public static AuditLoggerName fromLoggerName(final String loggerName)
+ throws IllegalArgumentException, ParseException {
+
+ if (!StringUtils.hasText(loggerName)) {
+ throw new IllegalArgumentException("Null value not permitted");
+ }
+
+ if (!loggerName.startsWith(SyncopeLoggerType.AUDIT.getPrefix())) {
+ throw new ParseException("Audit logger name must start with " + SyncopeLoggerType.AUDIT.getPrefix(), 0);
+ }
+
+ String[] splitted = loggerName.split("\\.");
+ if (splitted == null || splitted.length < 5) {
+ throw new ParseException("Unparsable logger name", 0);
+ }
+
+ Category category = Category.valueOf(splitted[2]);
+ Enum<?> subcategory = Enum.valueOf(category.getSubCategory(), splitted[3]);
+ Result result = Result.valueOf(splitted[4]);
+
+ return new AuditLoggerName(category, subcategory, result);
+ }
+}
Propchange: incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/client/src/main/java/org/syncope/types/AuditLoggerName.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/client/src/test/java/org/syncope/client/test/JSONTest.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/client/src/test/java/org/syncope/client/test/JSONTest.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/client/src/test/java/org/syncope/client/test/JSONTest.java (original)
+++ incubator/syncope/trunk/client/src/test/java/org/syncope/client/test/JSONTest.java Thu Mar 22 10:47:33 2012
@@ -34,6 +34,8 @@ import org.syncope.client.search.NodeCon
import org.syncope.client.to.ReportTO;
import org.syncope.client.to.SchemaTO;
import org.syncope.client.to.WorkflowFormPropertyTO;
+import org.syncope.types.AuditElements;
+import org.syncope.types.AuditLoggerName;
public class JSONTest {
@@ -47,8 +49,8 @@ public class JSONTest {
final MembershipCond membershipCond = new MembershipCond();
membershipCond.setRoleName("root");
- final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(usernameCond), NodeCond
- .getLeafCond(membershipCond));
+ final NodeCond searchCondition = NodeCond.getAndCond(NodeCond.getLeafCond(usernameCond), NodeCond.getLeafCond(
+ membershipCond));
assertTrue(searchCondition.checkValidity());
@@ -115,4 +117,18 @@ public class JSONTest {
ReportTO actual = mapper.readValue(writer.toString(), ReportTO.class);
assertEquals(report, actual);
}
+
+ @Test
+ public void testAuditLoggerName() throws IOException {
+ AuditLoggerName auditLoggerName = new AuditLoggerName(AuditElements.Category.report,
+ AuditElements.ReportSubCategory.create, AuditElements.Result.failure);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ StringWriter writer = new StringWriter();
+ mapper.writeValue(writer, auditLoggerName);
+
+ AuditLoggerName actual = mapper.readValue(writer.toString(), AuditLoggerName.class);
+ assertEquals(auditLoggerName, actual);
+ }
}
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Configuration.java Thu Mar 22 10:47:33 2012
@@ -72,6 +72,7 @@ import org.syncope.console.commons.Prefe
import org.syncope.console.commons.SortableDataProviderComparator;
import org.syncope.console.pages.panels.PoliciesPanel;
import org.syncope.console.rest.ConfigurationRestClient;
+import org.syncope.console.rest.LoggerRestClient;
import org.syncope.console.rest.NotificationRestClient;
import org.syncope.console.rest.WorkflowRestClient;
import org.syncope.console.wicket.markup.html.form.ActionLink;
@@ -90,6 +91,9 @@ public class Configuration extends BaseP
private ConfigurationRestClient confRestClient;
@SpringBean
+ private LoggerRestClient loggerRestClient;
+
+ @SpringBean
private NotificationRestClient notificationRestClient;
@SpringBean
@@ -188,7 +192,7 @@ public class Configuration extends BaseP
add(workflowDefContainer);
// Logger stuff
- PropertyListView coreLoggerList = new LoggerPropertyList(null, "corelogger", confRestClient.listLogs());
+ PropertyListView coreLoggerList = new LoggerPropertyList(null, "corelogger", loggerRestClient.listLogs());
WebMarkupContainer coreLoggerContainer = new WebMarkupContainer("coreLoggerContainer");
coreLoggerContainer.add(coreLoggerList);
coreLoggerContainer.setOutputMarkupId(true);
@@ -367,8 +371,8 @@ public class Configuration extends BaseP
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- prefMan.set(getRequest(), getResponse(), Constants.PREF_CONFIGURATION_PAGINATOR_ROWS, String
- .valueOf(confPaginatorRows));
+ prefMan.set(getRequest(), getResponse(), Constants.PREF_CONFIGURATION_PAGINATOR_ROWS, String.valueOf(
+ confPaginatorRows));
confTable.setItemsPerPage(confPaginatorRows);
target.add(confContainer);
@@ -512,8 +516,8 @@ public class Configuration extends BaseP
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- prefMan.set(getRequest(), getResponse(), Constants.PREF_NOTIFICATION_PAGINATOR_ROWS, String
- .valueOf(notificationPaginatorRows));
+ prefMan.set(getRequest(), getResponse(), Constants.PREF_NOTIFICATION_PAGINATOR_ROWS, String.valueOf(
+ notificationPaginatorRows));
notificationTable.setItemsPerPage(notificationPaginatorRows);
target.add(notificationContainer);
@@ -652,11 +656,11 @@ public class Configuration extends BaseP
protected void onUpdate(final AjaxRequestTarget target) {
try {
if (getId().equals("corelogger")) {
- confRestClient.setLogLevel(item.getModelObject().getName(), item.getModelObject()
- .getLevel());
+ loggerRestClient.setLogLevel(item.getModelObject().getName(),
+ item.getModelObject().getLevel());
} else {
- consoleLoggerController.setLogLevel(item.getModelObject().getName(), item.getModelObject()
- .getLevel());
+ consoleLoggerController.setLogLevel(item.getModelObject().getName(),
+ item.getModelObject().getLevel());
}
info(getString("operation_succeded"));
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/Reports.java Thu Mar 22 10:47:33 2012
@@ -22,8 +22,11 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.apache.wicket.Page;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
@@ -36,25 +39,41 @@ import org.apache.wicket.extensions.mark
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider;
+import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.html.form.Check;
+import org.apache.wicket.markup.html.form.CheckGroup;
+import org.apache.wicket.markup.html.form.CheckGroupSelector;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
+import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.markup.repeater.Item;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.springframework.util.StringUtils;
import org.syncope.client.to.ReportTO;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
import org.syncope.console.commons.Constants;
import org.syncope.console.commons.PreferenceManager;
import org.syncope.console.commons.SortableDataProviderComparator;
+import org.syncope.console.pages.panels.JQueryTabbedPanel;
+import org.syncope.console.rest.LoggerRestClient;
import org.syncope.console.rest.ReportRestClient;
import org.syncope.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
import org.syncope.console.wicket.markup.html.form.ActionLink;
import org.syncope.console.wicket.markup.html.form.ActionLinksPanel;
+import org.syncope.types.AuditElements.Category;
+import org.syncope.types.AuditElements.Result;
+import org.syncope.types.AuditLoggerName;
/**
* Auditing and Reporting.
@@ -71,10 +90,15 @@ public class Reports extends BasePage {
private ReportRestClient reportRestClient;
@SpringBean
+ private LoggerRestClient loggerRestClient;
+
+ @SpringBean
private PreferenceManager prefMan;
private WebMarkupContainer reportContainer;
+ private WebMarkupContainer auditContainer;
+
private int paginatorRows;
private final ModalWindow window;
@@ -90,6 +114,7 @@ public class Reports extends BasePage {
add(window);
setupReport();
+ setupAudit();
}
private void setupReport() {
@@ -206,8 +231,8 @@ public class Reports extends BasePage {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- prefMan.set(getRequest(), getResponse(), Constants.PREF_REPORT_PAGINATOR_ROWS, String
- .valueOf(paginatorRows));
+ prefMan.set(getRequest(), getResponse(), Constants.PREF_REPORT_PAGINATOR_ROWS,
+ String.valueOf(paginatorRows));
reportTable.setItemsPerPage(paginatorRows);
target.add(reportContainer);
@@ -243,6 +268,34 @@ public class Reports extends BasePage {
add(createLink);
}
+ private void setupAudit() {
+ auditContainer = new WebMarkupContainer("auditContainer");
+ auditContainer.setOutputMarkupId(true);
+ add(auditContainer);
+
+ MetaDataRoleAuthorizationStrategy.authorize(auditContainer, RENDER, xmlRolesReader.getAllAllowedRoles("Audit",
+ "list"));
+
+ Form form = new Form("auditForm");
+ auditContainer.add(form);
+
+ List<ITab> tabs = new ArrayList<ITab>();
+
+ for (final Category category : Category.values()) {
+ tabs.add(new AbstractTab(new Model<String>(StringUtils.capitalize(category.name()))) {
+
+ private static final long serialVersionUID = -5861786415855103549L;
+
+ @Override
+ public WebMarkupContainer getPanel(final String panelId) {
+ return new AuditCategoryPanel(panelId, category);
+ }
+ });
+ }
+
+ form.add(new JQueryTabbedPanel("categoriesTabs", tabs));
+ }
+
private class ReportProvider extends SortableDataProvider<ReportTO> {
private static final long serialVersionUID = -2311716167583335852L;
@@ -284,4 +337,157 @@ public class Reports extends BasePage {
};
}
}
+
+ private class AuditsByCategoryModel implements IModel<List<AuditLoggerName>> {
+
+ private static final long serialVersionUID = 605983084097505724L;
+
+ private final Category category;
+
+ private final Result result;
+
+ public AuditsByCategoryModel(final Category category, final Result result) {
+ this.category = category;
+ this.result = result;
+ }
+
+ @Override
+ public List<AuditLoggerName> getObject() {
+ Map<Category, Set<AuditLoggerName>> audits = loggerRestClient.listAuditsByCategory();
+
+ List<AuditLoggerName> object = new ArrayList<AuditLoggerName>();
+ for (Enum<?> subcategory : category.getSubCategoryElements()) {
+ AuditLoggerName auditLoggerName = new AuditLoggerName(category, subcategory, result);
+ if (audits.containsKey(category) && audits.get(category).contains(auditLoggerName)) {
+ object.add(auditLoggerName);
+ }
+ }
+
+ return object;
+ }
+
+ @Override
+ public void setObject(final List<AuditLoggerName> object) {
+ for (Enum<?> subcategory : category.getSubCategoryElements()) {
+ AuditLoggerName auditLoggerName = new AuditLoggerName(category, subcategory, result);
+
+ if (object.contains(auditLoggerName)) {
+ loggerRestClient.enableAudit(auditLoggerName);
+ } else {
+ loggerRestClient.disableAudit(auditLoggerName);
+ }
+ }
+ }
+
+ @Override
+ public void detach() {
+ // Not needed.
+ }
+ }
+
+ private class AuditCategoryPanel extends Panel {
+
+ private static final long serialVersionUID = 1076251735476895253L;
+
+ public AuditCategoryPanel(final String id, final Category category) {
+ super(id);
+ setOutputMarkupId(true);
+
+ final CheckGroup<AuditLoggerName> successGroup = new CheckGroup<AuditLoggerName>("successGroup",
+ new AuditsByCategoryModel(category, Result.success));
+ successGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
+
+ private static final long serialVersionUID = -151291731388673682L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // Empty method: here only to let Model.setObject() be invoked.
+ }
+ });
+ add(successGroup);
+ MetaDataRoleAuthorizationStrategy.authorize(successGroup, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "enable"));
+ MetaDataRoleAuthorizationStrategy.authorize(successGroup, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "disable"));
+
+ final CheckGroupSelector successSelector = new CheckGroupSelector("successSelector", successGroup);
+ add(successSelector);
+ MetaDataRoleAuthorizationStrategy.authorize(successSelector, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "enable"));
+ MetaDataRoleAuthorizationStrategy.authorize(successSelector, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "disable"));
+
+ final CheckGroup<AuditLoggerName> failureGroup = new CheckGroup<AuditLoggerName>("failureGroup",
+ new AuditsByCategoryModel(category, Result.failure));
+ failureGroup.add(new AjaxFormChoiceComponentUpdatingBehavior() {
+
+ private static final long serialVersionUID = -151291731388673682L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ // Empty method: here only to let Model.setObject() be invoked.
+ }
+ });
+ add(failureGroup);
+ MetaDataRoleAuthorizationStrategy.authorize(failureGroup, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "enable"));
+ MetaDataRoleAuthorizationStrategy.authorize(failureGroup, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "disable"));
+
+ final CheckGroupSelector failureSelector = new CheckGroupSelector("failureSelector", failureGroup);
+ add(failureSelector);
+ MetaDataRoleAuthorizationStrategy.authorize(failureSelector, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "enable"));
+ MetaDataRoleAuthorizationStrategy.authorize(failureSelector, RENDER,
+ xmlRolesReader.getAllAllowedRoles("Audit", "disable"));
+
+ ListView<Enum<?>> categoryView =
+ new ListView<Enum<?>>("categoryView", new ArrayList(category.getSubCategoryElements())) {
+
+ private static final long serialVersionUID = 4949588177564901031L;
+
+ @Override
+ protected void populateItem(final ListItem<Enum<?>> item) {
+ final Enum<?> subcategory = item.getModelObject();
+
+ item.add(new Label("subcategory", subcategory.name()));
+ }
+ };
+ add(categoryView);
+
+ ListView<Enum<?>> successView =
+ new ListView<Enum<?>>("successView", new ArrayList(category.getSubCategoryElements())) {
+
+ private static final long serialVersionUID = 4949588177564901031L;
+
+ @Override
+ protected void populateItem(final ListItem<Enum<?>> item) {
+ final Enum<?> subcategory = item.getModelObject();
+
+ final Check<AuditLoggerName> successCheck = new Check<AuditLoggerName>("successCheck",
+ new Model<AuditLoggerName>(
+ new AuditLoggerName(category, subcategory, Result.success)), successGroup);
+ item.add(successCheck);
+ }
+ };
+ successGroup.add(successView);
+
+ ListView<Enum<?>> failureView =
+ new ListView<Enum<?>>("failureView", new ArrayList(category.getSubCategoryElements())) {
+
+ private static final long serialVersionUID = 4949588177564901031L;
+
+ @Override
+ protected void populateItem(final ListItem<Enum<?>> item) {
+ final Enum<?> subcategory = item.getModelObject();
+
+ final Check<AuditLoggerName> failureCheck = new Check<AuditLoggerName>("failureCheck",
+ new Model<AuditLoggerName>(
+ new AuditLoggerName(category, subcategory, Result.failure)), failureGroup);
+ item.add(failureCheck);
+ }
+ };
+ failureGroup.add(failureView);
+ }
+ }
}
Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java?rev=1303723&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java Thu Mar 22 10:47:33 2012
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.pages.panels;
+
+import java.util.List;
+import org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel;
+import org.apache.wicket.extensions.markup.html.tabs.ITab;
+
+public class JQueryTabbedPanel extends AjaxTabbedPanel {
+
+ private static final long serialVersionUID = -5059184710433341333L;
+
+ public JQueryTabbedPanel(final String id, final List<ITab> tabs) {
+ super(id, tabs);
+ }
+
+ @Override
+ protected String getTabContainerCssClass() {
+ return "";
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/pages/panels/JQueryTabbedPanel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/ConfigurationRestClient.java Thu Mar 22 10:47:33 2012
@@ -22,8 +22,6 @@ import java.util.Arrays;
import java.util.List;
import org.springframework.stereotype.Component;
import org.syncope.client.to.ConfigurationTO;
-import org.syncope.client.to.LoggerTO;
-import org.syncope.types.SyncopeLoggerLevel;
@Component
public class ConfigurationRestClient extends AbstractBaseRestClient {
@@ -65,12 +63,4 @@ public class ConfigurationRestClient ext
public void deleteConfiguration(final String key) {
restTemplate.delete(baseURL + "configuration/delete/{key}.json", key);
}
-
- public List<LoggerTO> listLogs() {
- return Arrays.asList(restTemplate.getForObject(baseURL + "logger/log/list", LoggerTO[].class));
- }
-
- public void setLogLevel(final String name, final SyncopeLoggerLevel level) {
- restTemplate.postForObject(baseURL + "logger/log/{name}/{level}", null, LoggerTO.class, name, level);
- }
}
Added: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java?rev=1303723&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java Thu Mar 22 10:47:33 2012
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.syncope.console.rest;
+
+import java.util.Arrays;
+import java.util.EnumMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.springframework.stereotype.Component;
+import org.syncope.client.to.LoggerTO;
+import org.syncope.types.AuditElements;
+import org.syncope.types.AuditElements.Category;
+import org.syncope.types.AuditLoggerName;
+import org.syncope.types.SyncopeLoggerLevel;
+
+@Component
+public class LoggerRestClient extends AbstractBaseRestClient {
+
+ public List<LoggerTO> listLogs() {
+ return Arrays.asList(restTemplate.getForObject(baseURL + "logger/log/list", LoggerTO[].class));
+ }
+
+ public List<AuditLoggerName> listAudits() {
+ return Arrays.asList(restTemplate.getForObject(baseURL + "logger/audit/list", AuditLoggerName[].class));
+ }
+
+ public Map<AuditElements.Category, Set<AuditLoggerName>> listAuditsByCategory() {
+ Map<Category, Set<AuditLoggerName>> result = new EnumMap<Category, Set<AuditLoggerName>>(Category.class);
+ for (AuditLoggerName auditLoggerName : listAudits()) {
+ if (!result.containsKey(auditLoggerName.getCategory())) {
+ result.put(auditLoggerName.getCategory(), new HashSet<AuditLoggerName>());
+ }
+
+ result.get(auditLoggerName.getCategory()).add(auditLoggerName);
+ }
+
+ return result;
+ }
+
+ public void setLogLevel(final String name, final SyncopeLoggerLevel level) {
+ restTemplate.postForObject(baseURL + "logger/log/{name}/{level}", null, LoggerTO.class, name, level);
+ }
+
+ public void enableAudit(final AuditLoggerName auditLoggerName) {
+ restTemplate.put(baseURL + "logger/audit/enable", auditLoggerName);
+ }
+
+ public void deleteLog(final String name) {
+ restTemplate.delete(baseURL + "logger/log/delete/{name}", name);
+ }
+
+ public void disableAudit(final AuditLoggerName auditLoggerName) {
+ restTemplate.put(baseURL + "logger/audit/disable", auditLoggerName);
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/syncope/console/rest/LoggerRestClient.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/console/src/main/resources/authorizations.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/authorizations.xml?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/authorizations.xml (original)
+++ incubator/syncope/trunk/console/src/main/resources/authorizations.xml Thu Mar 22 10:47:33 2012
@@ -130,12 +130,12 @@ under the License.
<entitlement>AUDIT_LIST</entitlement>
</action>
- <action id="setLevel">
- <entitlement>AUDIT_SET_LEVEL</entitlement>
+ <action id="enable">
+ <entitlement>AUDIT_ENABLE</entitlement>
</action>
- <action id="delete">
- <entitlement>AUDIT_DELETE</entitlement>
+ <action id="disable">
+ <entitlement>AUDIT_DISABLE</entitlement>
</action>
</page>
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports%24AuditCategoryPanel.html?rev=1303723&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html Thu Mar 22 10:47:33 2012
@@ -0,0 +1,108 @@
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ under the License.
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org">
+ <wicket:head>
+ <style>
+ .divtableheaderlabel {
+ font-weight: bold;
+ float:left;
+ margin-left: 5px;
+ }
+
+ .divtableheadercell {
+ display:table-cell;
+ vertical-align:top;
+ text-align:right;
+ width:70px;
+ height:20px;
+ }
+
+ .divtablecheckcolumn {
+ display:table-cell;
+ vertical-align:top;
+ text-align:right;
+ }
+
+ .divtablecheck {
+ width:70px;
+ height:20px;
+ }
+ </style>
+ </wicket:head>
+ <wicket:panel>
+ <div style="display:block;">
+ <div style="display:inline-table;">
+ <div style="display:table-cell;vertical-align:top;">
+ <div>
+ <div class="tablecolumn_label medium_fixedsize">
+ </div>
+ </div>
+ </div>
+ <div class="divtableheadercell">
+ <div class="divtableheaderlabel">Success</div>
+ <input type="checkbox" wicket:id="successSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+ </div>
+ <div class="divtableheadercell">
+ <div class="divtableheaderlabel">Failure</div>
+ <input type="checkbox" wicket:id="failureSelector" style="margin-top: 0px;margin-bottom: 0px;"/>
+ </div>
+ </div>
+ </div>
+
+ <div style="display:inline-table;">
+ <div style="display:table-cell;vertical-align:top;">
+ <div id="divtablerow-label" wicket:id="categoryView">
+ <div class="tablecolumn_label medium_fixedsize" style="height:20px;">
+ <span wicket:id="subcategory">[subcategory]</span>
+ </div>
+ </div>
+
+ <script type="text/javascript">
+ $(function() {
+ $('#divtablerow-label div:even').addClass("alt");
+ });
+ </script>
+ </div>
+
+ <div id="divtablerow-success" class="divtablecheckcolumn">
+ <span wicket:id="successGroup">
+ <div wicket:id="successView" class="divtablecheck">
+ <input type="checkbox" wicket:id="successCheck"/>
+ </div>
+ </span>
+
+ <script type="text/javascript">
+ $(function() {
+ $('#divtablerow-success div:even').addClass("alt");
+ });
+ </script>
+ </div>
+
+ <div id="divtablerow-failure" class="divtablecheckcolumn">
+ <span wicket:id="failureGroup">
+ <div wicket:id="failureView" class="divtablecheck">
+ <input type="checkbox" wicket:id="failureCheck"/>
+ </div>
+ </span>
+
+ <script type="text/javascript">
+ $(function() {
+ $('#divtablerow-failure div:even').addClass("alt");
+ });
+ </script>
+ </div>
+ </div>
+ </wicket:panel>
+</html>
\ No newline at end of file
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports$AuditCategoryPanel.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Modified: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.html?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.html (original)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.html Thu Mar 22 10:47:33 2012
@@ -14,37 +14,40 @@
-->
<wicket:extend>
- <div id="tabs">
- <ul>
- <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="reports"/></span></a></li>
- <li><a href="#tabs-2"><span><wicket:message key="auditing"/></span></a></li>
- </ul>
-
- <div id="tabs-1">
- <div id="users-contain" class="ui-widget" style="width:inherit;">
- <span wicket:id="reportContainer">
- <table class="ui-widget ui-widget-content table-hover"
- wicket:id="reportTable"/>
- </span>
- <span style="float:right">
- <form wicket:id="paginatorForm" style="display:inline">
- <label><wicket:message key="displayRows"/></label>
- <select class="text ui-widget-content ui-corner-all"
- wicket:id="rowsChooser"/>
- </form>
- </span>
- </div>
-
- <div wicket:id="reportWin">[Show modal window for report editing]</div>
- <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
- wicket:id="createLink">
- <wicket:message key="create_report"/>
- </a>
+ <div id="tabs">
+ <ul>
+ <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="reports"/></span></a></li>
+ <li><a href="#tabs-2"><span><wicket:message key="audit"/></span></a></li>
+ </ul>
+
+ <div id="tabs-1">
+ <div id="users-contain" class="ui-widget" style="width:inherit;">
+ <span wicket:id="reportContainer">
+ <table class="ui-widget ui-widget-content table-hover" wicket:id="reportTable"/>
+ </span>
+ <span style="float:right">
+ <form wicket:id="paginatorForm" style="display:inline">
+ <label><wicket:message key="displayRows"/></label>
+ <select class="text ui-widget-content ui-corner-all" wicket:id="rowsChooser"/>
+ </form>
+ </span>
+ </div>
+
+ <div wicket:id="reportWin">[Show modal window for report editing]</div>
+ <a class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" wicket:id="createLink">
+ <wicket:message key="create_report"/>
+ </a>
- </div>
+ </div>
- <div id="tabs-2">
- </div>
+ <div id="tabs-2">
+ <span wicket:id="auditContainer">
+ <form wicket:id="auditForm">
+
+ <div wicket:id="categoriesTabs"/>
+ </form>
+ </span>
</div>
+ </div>
</wicket:extend>
\ No newline at end of file
Modified: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.properties
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.properties?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.properties (original)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports.properties Thu Mar 22 10:47:33 2012
@@ -14,8 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-auditing=Auditing
+audit=Audit
create_report=Create new report
lastExec=Last Execution
nextExec=Next Execution
latestExecStatus=Last status
+category=Category
+subcategory=Subcategory
Modified: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports_it.properties
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports_it.properties?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports_it.properties (original)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/Reports_it.properties Thu Mar 22 10:47:33 2012
@@ -14,8 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-auditing=Auditing
+audit=Audit
create_report=Crea un nuovo rapporto
lastExec=Ultima Esecuzione
nextExec=Prossima Esecuzione
latestExecStatus=Ultimo stato
+category=Categoria
+subcategory=Sottocategoria
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html?rev=1303723&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html Thu Mar 22 10:47:33 2012
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<wicket:head>
+ <style>
+ .selected {
+ background: url("../images/ui-bg_glass_65_ffffff_1x400.png") repeat-x scroll 50% 50% #FFFFFF !important;
+ border: 1px solid #AAAAAA !important;
+ margin-bottom: 0 !important;
+ padding-bottom: 1px !important;
+ color: #212121 !important;
+ font-weight: normal !important;
+ }
+ .tab-panel {
+ padding: 9px 12px;
+ }
+ </style>
+</wicket:head>
+<wicket:panel xmlns:wicket="http://wicket.apache.org">
+ <div class="ui-tabs ui-widget ui-widget-content ui-corner-all">
+ <span wicket:id="tabs-container">
+ <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
+ <li wicket:id="tabs" class="tabs-selected ui-state-default ui-corner-top">
+ <a href="#" wicket:id="link"><span wicket:id="title">[[tab title]]</span></a>
+ </li>
+ </ul>
+ </span>
+ <div wicket:id="panel" class="tab-panel">[panel]</div>
+ </div>
+</wicket:panel>
\ No newline at end of file
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/panels/JQueryTabbedPanel.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: incubator/syncope/trunk/console/src/main/webapp/img/tabs/bg.gif
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/tabs/bg.gif?rev=1303723&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/tabs/bg.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: incubator/syncope/trunk/console/src/main/webapp/img/tabs/left.gif
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/tabs/left.gif?rev=1303723&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/tabs/left.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: incubator/syncope/trunk/console/src/main/webapp/img/tabs/left_on.gif
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/tabs/left_on.gif?rev=1303723&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/tabs/left_on.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: incubator/syncope/trunk/console/src/main/webapp/img/tabs/right.gif
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/tabs/right.gif?rev=1303723&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/tabs/right.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: incubator/syncope/trunk/console/src/main/webapp/img/tabs/right_on.gif
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/tabs/right_on.gif?rev=1303723&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/tabs/right_on.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Modified: incubator/syncope/trunk/console/src/test/java/org/syncope/console/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/test/java/org/syncope/console/ReportTestITCase.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/test/java/org/syncope/console/ReportTestITCase.java (original)
+++ incubator/syncope/trunk/console/src/test/java/org/syncope/console/ReportTestITCase.java Thu Mar 22 10:47:33 2012
@@ -44,7 +44,7 @@ public class ReportTestITCase extends Ab
}
@Test
- public void execute() {
+ public void executeReport() {
selenium.click("css=img[alt=\"Reports\"]");
selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
@@ -53,4 +53,25 @@ public class ReportTestITCase extends Ab
selenium.waitForCondition("selenium.isTextPresent(\"Operation executed successfully\");", "30000");
}
+
+ @Test
+ public void navigateAudit() {
+ selenium.click("css=img[alt=\"Reports\"]");
+ selenium.waitForCondition("selenium.isElementPresent(\"//div[@id='tabs']\");", "30000");
+
+ selenium.click("//div[@id='tabs']/ul/li[2]/a/span");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[2]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[3]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[4]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[5]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[6]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[7]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[8]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[9]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[10]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[11]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[12]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[13]/a");
+ selenium.click("//div[3]/div[2]/span/form/div[2]/div/span/ul/li[14]/a");
+ }
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/audit/AuditManager.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/audit/AuditManager.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/audit/AuditManager.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/audit/AuditManager.java Thu Mar 22 10:47:33 2012
@@ -22,9 +22,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
+import org.syncope.types.AuditLoggerName;
import org.syncope.types.AuditElements.Category;
import org.syncope.types.AuditElements.Result;
-import org.syncope.types.SyncopeLoggerType;
public class AuditManager {
@@ -33,14 +33,6 @@ public class AuditManager {
*/
private static final Logger LOG = LoggerFactory.getLogger(AuditManager.class);
- public String getLoggerName(final Category category, final Enum<?> subcategory, final Result result) {
-
- return new StringBuilder().append(SyncopeLoggerType.AUDIT.getPrefix()).append('.').
- append(category.name()).append('.').
- append(subcategory.name()).append('.').
- append(result.name()).toString();
- }
-
public void audit(final Category category, final Enum<?> subcategory, final Result result, final String message) {
audit(category, subcategory, result, message, null);
}
@@ -48,9 +40,14 @@ public class AuditManager {
public void audit(final Category category, final Enum<?> subcategory, final Result result, final String message,
final Throwable throwable) {
- if (category == null || subcategory == null || result == null) {
- LOG.error("Invalid request: some null items {} {} {}", new Object[]{category, subcategory, result});
- } else if (category.getSubCategoryElements().contains(subcategory)) {
+ AuditLoggerName auditLoggerName = null;
+ try {
+ auditLoggerName = new AuditLoggerName(category, subcategory, result);
+ } catch (IllegalArgumentException e) {
+ LOG.error("Invalid audit parameters, aborting...", e);
+ }
+
+ if (auditLoggerName != null) {
StringBuilder auditMessage = new StringBuilder();
final SecurityContext ctx = SecurityContextHolder.getContext();
@@ -59,15 +56,12 @@ public class AuditManager {
}
auditMessage.append(message);
- Logger logger = LoggerFactory.getLogger(getLoggerName(category, subcategory, result));
+ Logger logger = LoggerFactory.getLogger(auditLoggerName.toLoggerName());
if (throwable == null) {
logger.debug(auditMessage.toString());
} else {
logger.debug(auditMessage.toString(), throwable);
}
- } else {
- LOG.error("Invalid request: {} does not belong to {}", new Object[]{subcategory, category});
}
-
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/init/LoggerLoader.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/init/LoggerLoader.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/init/LoggerLoader.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/init/LoggerLoader.java Thu Mar 22 10:47:33 2012
@@ -59,7 +59,7 @@ public class LoggerLoader {
if (loggerLogs.containsKey(logger.getName())) {
logger.setLevel(loggerLogs.get(logger.getName()).getLevel().getLevel());
loggerLogs.remove(logger.getName());
- } else {
+ } else if (!logger.getName().equals(SyncopeLoggerType.AUDIT.getPrefix())) {
SyncopeLogger syncopeLogger = new SyncopeLogger();
syncopeLogger.setName(logger.getName());
syncopeLogger.setLevel(SyncopeLoggerLevel.fromLevel(logger.getLevel()));
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/LoggerController.java Thu Mar 22 10:47:33 2012
@@ -32,9 +32,11 @@ import org.springframework.security.acce
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.syncope.client.to.LoggerTO;
+import org.syncope.types.AuditLoggerName;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
import org.syncope.client.validation.SyncopeClientException;
import org.syncope.core.audit.AuditManager;
@@ -65,8 +67,8 @@ public class LoggerController extends Ab
result.add(loggerTO);
}
- auditManager.audit(Category.logger, LoggerSubCategory.list, Result.success, "Successfully listed all loggers ("
- + type + "): " + result.size());
+ auditManager.audit(Category.logger, LoggerSubCategory.list, Result.success,
+ "Successfully listed all loggers (" + type + "): " + result.size());
return result;
}
@@ -81,8 +83,18 @@ public class LoggerController extends Ab
@PreAuthorize("hasRole('AUDIT_LIST')")
@RequestMapping(method = RequestMethod.GET, value = "/audit/list")
@Transactional(readOnly = true)
- public List<LoggerTO> listAudits() {
- return list(SyncopeLoggerType.AUDIT);
+ public List<AuditLoggerName> listAudits() {
+ List<AuditLoggerName> result = new ArrayList<AuditLoggerName>();
+
+ for (LoggerTO logger : list(SyncopeLoggerType.AUDIT)) {
+ try {
+ result.add(AuditLoggerName.fromLoggerName(logger.getName()));
+ } catch (Exception e) {
+ LOG.error("Unexpected audit logger name: {}", logger.getName(), e);
+ }
+ }
+
+ return result;
}
private void throwInvalidLogger(final SyncopeLoggerType type) {
@@ -120,8 +132,8 @@ public class LoggerController extends Ab
LoggerTO result = new LoggerTO();
BeanUtils.copyProperties(syncopeLogger, result);
- auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success, String.format(
- "Successfully set level %s to logger %s (%s)", level, name, expectedType));
+ auditManager.audit(Category.logger, LoggerSubCategory.setLevel, Result.success,
+ String.format("Successfully set level %s to logger %s (%s)", level, name, expectedType));
return result;
}
@@ -132,17 +144,24 @@ public class LoggerController extends Ab
return setLevel(name, level, SyncopeLoggerType.LOG);
}
- @PreAuthorize("hasRole('AUDIT_SET_LEVEL')")
- @RequestMapping(method = RequestMethod.POST, value = "/audit/{category}/{subcategory}/{result}/{level}")
- public LoggerTO setAuditLevel(@PathVariable("category") final Category category,
- @PathVariable("subcategory") final Enum<?> subcategory, @PathVariable("result") final Result result,
- @PathVariable("level") final Level level) {
+ @PreAuthorize("hasRole('AUDIT_ENABLE')")
+ @RequestMapping(method = RequestMethod.PUT, value = "/audit/enable")
+ public void enableAudit(@RequestBody final AuditLoggerName auditLoggerName) {
+ try {
+ setLevel(auditLoggerName.toLoggerName(), Level.DEBUG, SyncopeLoggerType.AUDIT);
+ } catch (IllegalArgumentException e) {
+ SyncopeClientCompositeErrorException sccee =
+ new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
+
+ SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidLogger);
+ sce.addElement(e.getMessage());
+ sccee.addException(sce);
- return setLevel(auditManager.getLoggerName(category, subcategory, result), level, SyncopeLoggerType.AUDIT);
+ throw sccee;
+ }
}
private void delete(final String name, final SyncopeLoggerType expectedType) throws NotFoundException {
-
SyncopeLogger syncopeLogger = loggerDAO.find(name);
if (syncopeLogger == null) {
throw new NotFoundException("Logger " + name);
@@ -165,16 +184,26 @@ public class LoggerController extends Ab
@PreAuthorize("hasRole('LOG_DELETE')")
@RequestMapping(method = RequestMethod.DELETE, value = "/log/delete/{name}")
public void deleteLog(@PathVariable("name") final String name) throws NotFoundException {
-
delete(name, SyncopeLoggerType.LOG);
}
- @PreAuthorize("hasRole('AUDIT_DELETE')")
- @RequestMapping(method = RequestMethod.DELETE, value = "/audit/delete/{category}/{subcategory}/{result}")
- public void deleteAudit(@PathVariable("category") final Category category,
- @PathVariable("subcategory") final Enum<?> subcategory, @PathVariable("result") final Result result) throws
- NotFoundException {
+ @PreAuthorize("hasRole('AUDIT_DISABLE')")
+ @RequestMapping(method = RequestMethod.PUT, value = "/audit/disable")
+ public void disableAudit(@RequestBody final AuditLoggerName auditLoggerName) {
+
+ try {
+ delete(auditLoggerName.toLoggerName(), SyncopeLoggerType.AUDIT);
+ } catch (NotFoundException e) {
+ LOG.debug("Ignoring disable of non existing logger {}", auditLoggerName.toLoggerName());
+ } catch (IllegalArgumentException e) {
+ SyncopeClientCompositeErrorException sccee =
+ new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
+
+ SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.InvalidLogger);
+ sce.addElement(e.getMessage());
+ sccee.addException(sce);
- delete(auditManager.getLoggerName(category, subcategory, result), SyncopeLoggerType.AUDIT);
+ throw sccee;
+ }
}
}
Modified: incubator/syncope/trunk/core/src/main/resources/content.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/content.xml?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/content.xml (original)
+++ incubator/syncope/trunk/core/src/main/resources/content.xml Thu Mar 22 10:47:33 2012
@@ -29,25 +29,25 @@ under the License.
<SyncopeConf confKey="createRequest.allowed" confValue="false"/>
<Policy DTYPE="SyncPolicy" id="1" description="Global Sync Policy" type="GLOBAL_SYNC"
- specification="%3Corg.syncope.types.SyncPolicySpec%2F%3E"/>
+ specification="%3Corg.syncope.types.SyncPolicySpec%2F%3E"/>
<Policy DTYPE="PasswordPolicy" id="2" description="Global Password Policy" type="GLOBAL_PASSWORD"
- specification="%3Corg.syncope.types.PasswordPolicySpec%3E%0A++%3ChistoryLength%3E0%3C%2FhistoryLength%3E%0A++%3CmaxLength%3E0%3C%2FmaxLength%3E%0A++%3CminLength%3E0%3C%2FminLength%3E%0A++%3CnonAlphanumericRequired%3Efalse%3C%2FnonAlphanumericRequired%3E%0A++%3CalphanumericRequired%3Efalse%3C%2FalphanumericRequired%3E%0A++%3CdigitRequired%3Efalse%3C%2FdigitRequired%3E%0A++%3ClowercaseRequired%3Efalse%3C%2FlowercaseRequired%3E%0A++%3CuppercaseRequired%3Efalse%3C%2FuppercaseRequired%3E%0A++%3CmustStartWithDigit%3Efalse%3C%2FmustStartWithDigit%3E%0A++%3CmustntStartWithDigit%3Efalse%3C%2FmustntStartWithDigit%3E%0A++%3CmustEndWithDigit%3Efalse%3C%2FmustEndWithDigit%3E%0A++%3CmustntEndWithDigit%3Efalse%3C%2FmustntEndWithDigit%3E%0A++%3CmustStartWithNonAlpha%3Efalse%3C%2FmustStartWithNonAlpha%3E%0A++%3CmustStartWithAlpha%3Efalse%3C%2FmustStartWithAlpha%3E%0A++%3CmustntStartWithNonAlpha%3Efalse%3C%2FmustntStartWithNonAlpha%3E%0A++%3CmustntStartWithAlpha%3Efalse%3C%2Fmustn
tStartWithAlpha%3E%0A++%3CmustEndWithNonAlpha%3Efalse%3C%2FmustEndWithNonAlpha%3E%0A++%3CmustEndWithAlpha%3Efalse%3C%2FmustEndWithAlpha%3E%0A++%3CmustntEndWithNonAlpha%3Efalse%3C%2FmustntEndWithNonAlpha%3E%0A++%3CmustntEndWithAlpha%3Efalse%3C%2FmustntEndWithAlpha%3E%0A%3C%2Forg.syncope.types.PasswordPolicySpec%3E"/>
+ specification="%3Corg.syncope.types.PasswordPolicySpec%3E%0A++%3ChistoryLength%3E0%3C%2FhistoryLength%3E%0A++%3CmaxLength%3E0%3C%2FmaxLength%3E%0A++%3CminLength%3E0%3C%2FminLength%3E%0A++%3CnonAlphanumericRequired%3Efalse%3C%2FnonAlphanumericRequired%3E%0A++%3CalphanumericRequired%3Efalse%3C%2FalphanumericRequired%3E%0A++%3CdigitRequired%3Efalse%3C%2FdigitRequired%3E%0A++%3ClowercaseRequired%3Efalse%3C%2FlowercaseRequired%3E%0A++%3CuppercaseRequired%3Efalse%3C%2FuppercaseRequired%3E%0A++%3CmustStartWithDigit%3Efalse%3C%2FmustStartWithDigit%3E%0A++%3CmustntStartWithDigit%3Efalse%3C%2FmustntStartWithDigit%3E%0A++%3CmustEndWithDigit%3Efalse%3C%2FmustEndWithDigit%3E%0A++%3CmustntEndWithDigit%3Efalse%3C%2FmustntEndWithDigit%3E%0A++%3CmustStartWithNonAlpha%3Efalse%3C%2FmustStartWithNonAlpha%3E%0A++%3CmustStartWithAlpha%3Efalse%3C%2FmustStartWithAlpha%3E%0A++%3CmustntStartWithNonAlpha%3Efalse%3C%2FmustntStartWithNonAlpha%3E%0A++%3CmustntStartWithAlpha%3Efalse%3C%2FmustntS
tartWithAlpha%3E%0A++%3CmustEndWithNonAlpha%3Efalse%3C%2FmustEndWithNonAlpha%3E%0A++%3CmustEndWithAlpha%3Efalse%3C%2FmustEndWithAlpha%3E%0A++%3CmustntEndWithNonAlpha%3Efalse%3C%2FmustntEndWithNonAlpha%3E%0A++%3CmustntEndWithAlpha%3Efalse%3C%2FmustntEndWithAlpha%3E%0A%3C%2Forg.syncope.types.PasswordPolicySpec%3E"/>
<Policy DTYPE="AccountPolicy" id="3" description="Global Account Policy" type="GLOBAL_ACCOUNT"
- specification="%3Corg.syncope.types.AccountPolicySpec%3E%0A++%3CmaxLength%3E0%3C%2FmaxLength%3E%0A++%3CminLength%3E0%3C%2FminLength%3E%0A++%3CallUpperCase%3Efalse%3C%2FallUpperCase%3E%0A++%3CallLowerCase%3Efalse%3C%2FallLowerCase%3E%0A++%3CpropagateSuspension%3Efalse%3C%2FpropagateSuspension%3E%0A++%3CpermittedLoginRetries%3E0%3C%2FpermittedLoginRetries%3E%0A%3C%2Forg.syncope.types.AccountPolicySpec%3E"/>
+ specification="%3Corg.syncope.types.AccountPolicySpec%3E%0A++%3CmaxLength%3E0%3C%2FmaxLength%3E%0A++%3CminLength%3E0%3C%2FminLength%3E%0A++%3CallUpperCase%3Efalse%3C%2FallUpperCase%3E%0A++%3CallLowerCase%3Efalse%3C%2FallLowerCase%3E%0A++%3CpropagateSuspension%3Efalse%3C%2FpropagateSuspension%3E%0A++%3CpermittedLoginRetries%3E0%3C%2FpermittedLoginRetries%3E%0A%3C%2Forg.syncope.types.AccountPolicySpec%3E"/>
<USchema name="surname" type="String"
- mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
+ mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<USchema name="firstname" type="String"
- mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
+ mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"/>
<USchema name="email" type="String"
- mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"
- validatorClass="org.syncope.core.persistence.validation.attrvalue.EmailAddressValidator"/>
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"
+ validatorClass="org.syncope.core.persistence.validation.attrvalue.EmailAddressValidator"/>
<UDerSchema name="fullname" expression="firstname + '.' + surname"/>
<MSchema name="subscriptionDate" type="Date"
- mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
- conversionPattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ"/>
+ mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
+ conversionPattern="yyyy-MM-dd'T'HH:mm:ss.SSSZ"/>
<!-- Authentication and authorization -->
<Entitlement name="SCHEMA_CREATE"/>
@@ -115,8 +115,8 @@ under the License.
<Entitlement name="LOG_SET_LEVEL"/>
<Entitlement name="LOG_DELETE"/>
<Entitlement name="AUDIT_LIST"/>
- <Entitlement name="AUDIT_SET_LEVEL"/>
- <Entitlement name="AUDIT_DELETE"/>
+ <Entitlement name="AUDIT_ENABLE"/>
+ <Entitlement name="AUDIT_DISABLE"/>
<ACT_GE_PROPERTY NAME_="schema.version" VALUE_="5.9" REV_="1"/>
<ACT_GE_PROPERTY NAME_="schema.history" VALUE_="create(5.9)" REV_="1"/>
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/LoggerTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/LoggerTestITCase.java?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/LoggerTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/LoggerTestITCase.java Thu Mar 22 10:47:33 2012
@@ -24,32 +24,38 @@ import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.syncope.client.to.LoggerTO;
+import org.syncope.types.AuditElements;
+import org.syncope.types.AuditLoggerName;
import org.syncope.types.SyncopeLoggerLevel;
public class LoggerTestITCase extends AbstractTest {
@Test
- public void list() {
- List<LoggerTO> loggers = Arrays.asList(restTemplate
- .getForObject(BASE_URL + "logger/log/list", LoggerTO[].class));
+ public void listLogs() {
+ List<LoggerTO> loggers =
+ Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/log/list", LoggerTO[].class));
assertNotNull(loggers);
assertFalse(loggers.isEmpty());
for (LoggerTO logger : loggers) {
assertNotNull(logger);
}
+ }
- loggers = Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/audit/list", LoggerTO[].class));
- assertNotNull(loggers);
- assertFalse(loggers.isEmpty());
- for (LoggerTO logger : loggers) {
- assertNotNull(logger);
+ @Test
+ public void listAudits() {
+ List<AuditLoggerName> audits =
+ Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/audit/list", AuditLoggerName[].class));
+ assertNotNull(audits);
+ assertFalse(audits.isEmpty());
+ for (AuditLoggerName audit : audits) {
+ assertNotNull(audit);
}
}
@Test
public void setLevel() {
- List<LoggerTO> loggers = Arrays.asList(restTemplate
- .getForObject(BASE_URL + "logger/log/list", LoggerTO[].class));
+ List<LoggerTO> loggers =
+ Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/log/list", LoggerTO[].class));
assertNotNull(loggers);
int startSize = loggers.size();
@@ -62,4 +68,27 @@ public class LoggerTestITCase extends Ab
assertNotNull(loggers);
assertEquals(startSize + 1, loggers.size());
}
+
+ @Test
+ public void enableDisableAudit() {
+ AuditLoggerName auditLoggerName = new AuditLoggerName(AuditElements.Category.report,
+ AuditElements.ReportSubCategory.listExecutions, AuditElements.Result.failure);
+
+ List<AuditLoggerName> audits =
+ Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/audit/list", AuditLoggerName[].class));
+ assertNotNull(audits);
+ assertFalse(audits.contains(auditLoggerName));
+
+ restTemplate.put(BASE_URL + "logger/audit/enable", auditLoggerName);
+
+ audits = Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/audit/list", AuditLoggerName[].class));
+ assertNotNull(audits);
+ assertTrue(audits.contains(auditLoggerName));
+
+ restTemplate.put(BASE_URL + "logger/audit/disable", auditLoggerName);
+
+ audits = Arrays.asList(restTemplate.getForObject(BASE_URL + "logger/audit/list", AuditLoggerName[].class));
+ assertNotNull(audits);
+ assertFalse(audits.contains(auditLoggerName));
+ }
}
Modified: incubator/syncope/trunk/core/src/test/resources/content.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/resources/content.xml?rev=1303723&r1=1303722&r2=1303723&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/resources/content.xml (original)
+++ incubator/syncope/trunk/core/src/test/resources/content.xml Thu Mar 22 10:47:33 2012
@@ -562,8 +562,8 @@ under the License.
<Entitlement name="LOG_SET_LEVEL"/>
<Entitlement name="LOG_DELETE"/>
<Entitlement name="AUDIT_LIST"/>
- <Entitlement name="AUDIT_SET_LEVEL"/>
- <Entitlement name="AUDIT_DELETE"/>
+ <Entitlement name="AUDIT_ENABLE"/>
+ <Entitlement name="AUDIT_DISABLE"/>
<Entitlement name="ROLE_1"/>
<Entitlement name="ROLE_2"/>
<Entitlement name="ROLE_3"/>