Revision: 691
http://openutils.svn.sourceforge.net/openutils/?rev=691&view=rev
Author: fcarone
Date: 2008-02-25 01:25:03 -0800 (Mon, 25 Feb 2008)
Log Message:
-----------
Only use enabled rules
Modified Paths:
--------------
trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java
Modified: trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java 2008-02-25 09:23:12 UTC (rev 690)
+++ trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java 2008-02-25 09:25:03 UTC (rev 691)
@@ -1,5 +1,17 @@
/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
+ * Copyright Openmind http://www.openmindonline.it
+ *
+ * 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.
*/
package it.openutils.hibernate.security.filter.utils;
@@ -47,6 +59,11 @@
String attribute = ((ConfigAttribute) iterator.next()).getAttribute();
for (SecurityRule rule : rules)
{
+ if (!rule.isEnabled())
+ {
+ log.debug("Skipping disabled rule {}", rule);
+ continue;
+ }
for (PermissionEnum permission : rule.getPermissions())
{
if (StringUtils.equals(permission.getValue(), attribute))
@@ -73,6 +90,10 @@
{
for (SecurityRule rule : rules)
{
+ if (!rule.isEnabled())
+ {
+ continue;
+ }
String objProperty = BeanUtils.getSimpleProperty(argument, rule.getProperty());
switch (rule.getModifier())
{
@@ -89,7 +110,7 @@
log.debug("Matching rule found: {}", rule);
return true;
}
- break;
+ break;
default:
throw new RuntimeException("Modifier " + rule.getModifier() + " is not recognized");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|