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 2014/10/23 17:59:21 UTC
[4/5] git commit: [SYNCOPE-564] Now any authenticated user can read
the defined security questions
[SYNCOPE-564] Now any authenticated user can read the defined security questions
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7c714f31
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7c714f31
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7c714f31
Branch: refs/heads/1_2_X
Commit: 7c714f31c2367a899454b21b121377da5a5874cb
Parents: 9455e7f
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu Oct 23 17:58:56 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu Oct 23 17:58:56 2014 +0200
----------------------------------------------------------------------
.../syncope/console/pages/EditUserModalPage.java | 4 ----
.../apache/syncope/console/pages/UserModalPage.java | 2 ++
.../console/pages/panels/AttributesPanel.java | 15 ++++++++-------
console/src/main/resources/authorizations.xml | 8 --------
.../rest/controller/SecurityQuestionController.java | 4 ++--
core/src/main/resources/content.xml | 2 --
.../core/persistence/dao/EntitlementTest.java | 2 +-
core/src/test/resources/content.xml | 2 --
8 files changed, 13 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
index e31fdcc..d08a4cb 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
@@ -28,7 +28,6 @@ import org.apache.syncope.console.commons.status.StatusBean;
import org.apache.syncope.console.pages.panels.AccountInformationPanel;
import org.apache.syncope.console.pages.panels.MembershipsPanel;
import org.apache.syncope.console.pages.panels.ResourcesPanel;
-import org.apache.syncope.console.pages.panels.SecurityQuestionPanel;
import org.apache.syncope.console.pages.panels.StatusPanel;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -75,9 +74,6 @@ public class EditUserModalPage extends UserModalPage {
form.addOrReplace(new MembershipsPanel("memberships", userTO, mode, statusPanel, getPageReference()));
}
-
- // Security question / answer
- form.addOrReplace(new SecurityQuestionPanel("securityQuestion", userTO));
}
@SuppressWarnings("rawtypes")
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
index e605360..14930cf 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
@@ -25,6 +25,7 @@ import org.apache.syncope.console.pages.panels.AttributesPanel;
import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
import org.apache.syncope.console.pages.panels.MembershipsPanel;
import org.apache.syncope.console.pages.panels.ResourcesPanel;
+import org.apache.syncope.console.pages.panels.SecurityQuestionPanel;
import org.apache.syncope.console.pages.panels.UserDetailsPanel;
import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
@@ -112,6 +113,7 @@ public abstract class UserModalPage extends BaseModalPage {
form.add(new Label("pwdChangeInfo", ""));
form.add(new Label("securityQuestion", ""));
+ form.addOrReplace(new SecurityQuestionPanel("securityQuestion", userTO));
form.add(new Label("accountinformation", ""));
//--------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
index 2ed7042..9fc33d7 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
@@ -210,19 +210,20 @@ public class AttributesPanel extends Panel {
private void setLayoutConfiguration(final Mode mode, final AttributableType type) {
switch (type) {
- case USER:
- default:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_USER.getParameter() : LayoutType.ADMIN_USER.getParameter());
- break;
case ROLE:
confAttributeTO = confRestClient.read(mode == Mode.ADMIN
? LayoutType.ADMIN_ROLE.getParameter() : LayoutType.SELF_ROLE.getParameter());
break;
+
case MEMBERSHIP:
confAttributeTO = confRestClient.read(mode == Mode.ADMIN
? LayoutType.ADMIN_MEMBERSHIP.getParameter() : LayoutType.SELF_MEMBERSHIP.getParameter());
break;
+
+ case USER:
+ default:
+ confAttributeTO = confRestClient.read(mode == Mode.ADMIN
+ ? LayoutType.ADMIN_USER.getParameter() : LayoutType.SELF_USER.getParameter());
}
}
@@ -337,8 +338,8 @@ public class AttributesPanel extends Panel {
case Binary:
panel = new BinaryFieldPanel("panel", schemaTO.getName(), new Model<String>(),
schemas.containsKey(schemaTO.getName())
- ? schemas.get(schemaTO.getName()).getMimeType()
- : null);
+ ? schemas.get(schemaTO.getName()).getMimeType()
+ : null);
if (required) {
panel.addRequiredLabel();
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/console/src/main/resources/authorizations.xml
----------------------------------------------------------------------
diff --git a/console/src/main/resources/authorizations.xml b/console/src/main/resources/authorizations.xml
index 33746f7..69e9b0c 100644
--- a/console/src/main/resources/authorizations.xml
+++ b/console/src/main/resources/authorizations.xml
@@ -257,18 +257,10 @@ under the License.
</page>
<page id="SecurityQuestion">
- <action id="list">
- <entitlement>SECURITY_QUESTION_LIST</entitlement>
- </action>
-
<action id="create">
<entitlement>SECURITY_QUESTION_CREATE</entitlement>
</action>
- <action id="read">
- <entitlement>SECURITY_QUESTION_READ</entitlement>
- </action>
-
<action id="update">
<entitlement>SECURITY_QUESTION_UPDATE</entitlement>
</action>
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/core/src/main/java/org/apache/syncope/core/rest/controller/SecurityQuestionController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/SecurityQuestionController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/SecurityQuestionController.java
index f7aa5f4..ed87da6 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/SecurityQuestionController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/SecurityQuestionController.java
@@ -45,7 +45,7 @@ public class SecurityQuestionController extends AbstractTransactionalController<
@Autowired
private SecurityQuestionDataBinder binder;
- @PreAuthorize("hasRole('SECURITY_QUESTION_LIST')")
+ @PreAuthorize("isAuthenticated()")
public List<SecurityQuestionTO> list() {
List<SecurityQuestionTO> result = new ArrayList<SecurityQuestionTO>();
for (SecurityQuestion securityQuestion : securityQuestionDAO.findAll()) {
@@ -55,7 +55,7 @@ public class SecurityQuestionController extends AbstractTransactionalController<
return result;
}
- @PreAuthorize("hasRole('SECURITY_QUESTION_READ')")
+ @PreAuthorize("isAuthenticated()")
public SecurityQuestionTO read(final Long securityQuestionId) {
SecurityQuestion securityQuestion = securityQuestionDAO.find(securityQuestionId);
if (securityQuestion == null) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/core/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/content.xml b/core/src/main/resources/content.xml
index 3b7cda9..af45517 100644
--- a/core/src/main/resources/content.xml
+++ b/core/src/main/resources/content.xml
@@ -162,8 +162,6 @@ under the License.
<Entitlement name="AUDIT_LIST"/>
<Entitlement name="AUDIT_ENABLE"/>
<Entitlement name="AUDIT_DISABLE"/>
- <Entitlement name="SECURITY_QUESTION_LIST"/>
- <Entitlement name="SECURITY_QUESTION_READ"/>
<Entitlement name="SECURITY_QUESTION_CREATE"/>
<Entitlement name="SECURITY_QUESTION_UPDATE"/>
<Entitlement name="SECURITY_QUESTION_DELETE"/>
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java b/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
index b4f2c36..e55960a 100644
--- a/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
+++ b/core/src/test/java/org/apache/syncope/core/persistence/dao/EntitlementTest.java
@@ -41,7 +41,7 @@ public class EntitlementTest extends AbstractDAOTest {
@Test
public void findAll() {
List<Entitlement> list = entitlementDAO.findAll();
- assertEquals("did not get expected number of entitlements ", 88, list.size());
+ assertEquals("did not get expected number of entitlements ", 86, list.size());
}
@Test
http://git-wip-us.apache.org/repos/asf/syncope/blob/7c714f31/core/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/content.xml b/core/src/test/resources/content.xml
index addd400..b57c5cd 100644
--- a/core/src/test/resources/content.xml
+++ b/core/src/test/resources/content.xml
@@ -1087,8 +1087,6 @@ under the License.
<Entitlement name="AUDIT_LIST"/>
<Entitlement name="AUDIT_ENABLE"/>
<Entitlement name="AUDIT_DISABLE"/>
- <Entitlement name="SECURITY_QUESTION_LIST"/>
- <Entitlement name="SECURITY_QUESTION_READ"/>
<Entitlement name="SECURITY_QUESTION_CREATE"/>
<Entitlement name="SECURITY_QUESTION_UPDATE"/>
<Entitlement name="SECURITY_QUESTION_DELETE"/>