|
From: <fc...@us...> - 2008-03-06 09:26:44
|
Revision: 729
http://openutils.svn.sourceforge.net/openutils/?rev=729&view=rev
Author: fcarone
Date: 2008-03-06 01:26:46 -0800 (Thu, 06 Mar 2008)
Log Message:
-----------
[maven-release-plugin] copy for tag openutils-hibernate-security-0.0.7
Added Paths:
-----------
tags/openutils-hibernate-security-0.0.7/
tags/openutils-hibernate-security-0.0.7/pom.xml
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/StatusEnum.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/JavaBeanFilter.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleAccessDecisionVoter.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleAfterInvocationHandler.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleBaseHandler.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRulePredicate.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/services/SecurityRuleManager.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/services/impl/SecurityRuleManagerImpl.java
tags/openutils-hibernate-security-0.0.7/src/site/apt/
tags/openutils-hibernate-security-0.0.7/src/site/apt/index.apt
tags/openutils-hibernate-security-0.0.7/src/site/apt/rbac-acegi.apt
tags/openutils-hibernate-security-0.0.7/src/test/java/it/openutils/hibernate/security/filter/JavaBeanFilterTest.java
tags/openutils-hibernate-security-0.0.7/src/test/resources/SecurityIntegrationTest-load.xml
tags/openutils-hibernate-security-0.0.7/src/test/resources/spring-security.xml
Removed Paths:
-------------
tags/openutils-hibernate-security-0.0.7/pom.xml
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/JavaBeanFilter.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleAccessDecisionVoter.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleAfterInvocationHandler.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRuleBaseHandler.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/SecurityRulePredicate.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/utils/SecurityRuleUtils.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/services/SecurityRuleManager.java
tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/services/impl/SecurityRuleManagerImpl.java
tags/openutils-hibernate-security-0.0.7/src/site/apt/index.apt
tags/openutils-hibernate-security-0.0.7/src/test/java/it/openutils/hibernate/security/filter/JavaBeanFilterTest.java
tags/openutils-hibernate-security-0.0.7/src/test/resources/SecurityIntegrationTest-load.xml
tags/openutils-hibernate-security-0.0.7/src/test/resources/spring-security.xml
Copied: tags/openutils-hibernate-security-0.0.7 (from rev 673, trunk/openutils-hibernate-security)
Deleted: tags/openutils-hibernate-security-0.0.7/pom.xml
===================================================================
--- trunk/openutils-hibernate-security/pom.xml 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/pom.xml 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,223 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>openutils</artifactId>
- <groupId>net.sourceforge.openutils</groupId>
- <version>7</version>
- <relativePath>..</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-hibernate-security</artifactId>
- <name>openutils hibernate security</name>
- <version>0.0.4-SNAPSHOT</version>
- <description>Hibernate Security classes</description>
- <properties>
- <spring.version>2.5.1</spring.version>
- <aspectj.version>1.5.3</aspectj.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- <version>${spring.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <!-- already imported cglib-nodep by spring -->
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <dependency>
- <groupId>aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.1_3</version>
- </dependency>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- <version>2.2.3</version>
- </dependency>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-attrs</artifactId>
- <version>2.2.3</version>
- </dependency>
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-commons</artifactId>
- <version>2.2.3</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-usermanagement</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-usermanagement-dataobjects</artifactId>
- <version>2.0</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-bshd5</artifactId>
- <version>2.0.1</version>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-testing-junit</artifactId>
- <version>2.0.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.openutils</groupId>
- <artifactId>openutils-testing</artifactId>
- <version>2.0.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.4.1</version>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.5.ga</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-annotations</artifactId>
- <version>3.2.1.ga</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.2.1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <artifactId>xerces</artifactId>
- <groupId>xerces</groupId>
- </exclusion>
- <exclusion>
- <artifactId>xml-apis</artifactId>
- <groupId>xml-apis</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>org.acegisecurity</groupId>
- <artifactId>acegi-security</artifactId>
- <version>1.0.6</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <artifactId>spring-remoting</artifactId>
- <groupId>org.springframework</groupId>
- </exclusion>
- <exclusion>
- <artifactId>spring-jdbc</artifactId>
- <groupId>org.springframework</groupId>
- </exclusion>
- <exclusion>
- <artifactId>spring-support</artifactId>
- <groupId>org.springframework</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.7</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>dbunit</groupId>
- <artifactId>dbunit</artifactId>
- <version>2.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
Copied: tags/openutils-hibernate-security-0.0.7/pom.xml (from rev 728, trunk/openutils-hibernate-security/pom.xml)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/pom.xml (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/pom.xml 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,229 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>openutils</artifactId>
+ <groupId>net.sourceforge.openutils</groupId>
+ <version>7</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-hibernate-security</artifactId>
+ <name>openutils hibernate security</name>
+ <version>0.0.7</version>
+ <description>Hibernate Security classes</description>
+ <properties>
+ <spring.version>2.5.1</spring.version>
+ <aspectj.version>1.5.3</aspectj.version>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${spring.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${spring.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <version>${spring.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${spring.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <!-- already imported cglib-nodep by spring -->
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>${aspectj.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-attrs</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>2.2.3</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-usermanagement</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-usermanagement-dataobjects</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-bshd5</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-testing-junit</artifactId>
+ <version>2.0.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.sourceforge.openutils</groupId>
+ <artifactId>openutils-testing</artifactId>
+ <version>2.0.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <version>3.2.5.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.2.1.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>xerces</artifactId>
+ <groupId>xerces</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>xml-apis</artifactId>
+ <groupId>xml-apis</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.acegisecurity</groupId>
+ <artifactId>acegi-security</artifactId>
+ <version>1.0.6</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-remoting</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-jdbc</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>spring-support</artifactId>
+ <groupId>org.springframework</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.7</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>dbunit</groupId>
+ <artifactId>dbunit</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <scm>
+ <connection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.7</connection>
+ <developerConnection>scm:svn:https://openutils.svn.sourceforge.net/svnroot/openutils/tags/openutils-hibernate-security-0.0.7</developerConnection>
+ <url>http://openutils.svn.sourceforge.net/viewcvs.cgi/openutils/tags/openutils-hibernate-security-0.0.7</url>
+ </scm>
+</project>
\ No newline at end of file
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,154 +0,0 @@
-/*
- * 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.aop;
-
-import it.openutils.hibernate.security.dataobject.SecurityRule;
-import it.openutils.hibernate.security.services.SecurityRuleManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.acegisecurity.Authentication;
-import org.acegisecurity.GrantedAuthority;
-import org.acegisecurity.context.SecurityContextHolder;
-import org.apache.commons.lang.StringUtils;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.hibernate.Filter;
-import org.hibernate.criterion.Criterion;
-import org.hibernate.criterion.Restrictions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * @author fcarone
- * @version $Id$
- */
-@Aspect
-public class AOPSecurity
-{
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(AOPSecurity.class);
-
- private SecurityRuleManager securityRuleManager;
-
- private List<String> securedDAOs;
-
- private boolean enabled;
-
- /**
- * @param pjp The proceeding joinpoint
- * @param filter The entity we are going to filter
- * @param additionalCriteria The additional criteria list, cannot be null
- * @return The execution invocation result
- * @throws Throwable Any exception occurring in the invoked method
- */
- @Around("execution(* it.openutils.dao.hibernate.*.*(Object, .., java.util.List<org.hibernate.criterion.Criterion>)) && "
- + //
- " args(filter, .., additionalCriteria)")
- public Object applySecurityRules(ProceedingJoinPoint pjp, Object filter, List<Criterion> additionalCriteria)
- throws Throwable
- {
- if (!enabled)
- {
- log.debug("DAO security disabled, proceeding.");
- return pjp.proceed();
- }
-
- if (!securedDAOs.contains(pjp.getTarget().getClass().getCanonicalName()))
- {
- log.debug("The intercepted DAO {} is not secured, proceeding.", pjp.getTarget().toString());
- return pjp.proceed();
- }
-
- log.debug("applying security rules for {} with criteria {}", filter.toString(), additionalCriteria);
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (authentication == null)
- {
- throw new SecurityException("Authentication is not valid");
- }
- GrantedAuthority[] authorities = authentication.getAuthorities();
- List<String> roles = new ArrayList<String>();
- for (int i = 0; i < authorities.length; i++)
- {
- roles.add(authorities[i].getAuthority());
- }
-
- String entity = filter.getClass().getCanonicalName();
- List<SecurityRule> rules = securityRuleManager.getRulesForRoles(entity, roles);
-
- if (rules.isEmpty())
- {
- if (log.isWarnEnabled())
- {
- String grantedRoles = StringUtils.EMPTY;
- for (int i = 0; i < authorities.length; i++)
- {
- grantedRoles += authorities[i].getAuthority() + " ";
- }
- log.warn(
- "No rules found. Access is denied on " + entity + ", for user {} with roles {}",
- SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(),
- grantedRoles);
- }
- throw new SecurityException("Access denied");
- }
-
- Filter hibernateFilter = securityRuleManager.getEntityFilterFromRules(entity, rules);
-
- Criterion sqlCriterion = Restrictions.sqlRestriction(hibernateFilter
- .getFilterDefinition()
- .getDefaultFilterCondition());
-
- log.debug("Adding sql restriction: {}", sqlCriterion.toString());
- additionalCriteria.add(sqlCriterion);
-
- Object result = pjp.proceed();
- return result;
- }
-
- /**
- * Sets the securityRuleManager.
- * @param securityRuleManager the securityRuleManager to set
- */
- public void setSecurityRuleManager(SecurityRuleManager securityRuleManager)
- {
- this.securityRuleManager = securityRuleManager;
- }
-
- /**
- * Sets the securedDAOs.
- * @param securedDAOs the securedDAOs to set
- */
- public void setSecuredDAOs(List<String> securedDAOs)
- {
- this.securedDAOs = securedDAOs;
- }
-
- /**
- * Sets the enabled.
- * @param enabled the enabled to set
- */
- public void setEnabled(boolean enabled)
- {
- this.enabled = enabled;
- }
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java (from rev 687, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/aop/AOPSecurity.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,175 @@
+/*
+ * 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.aop;
+
+import it.openutils.hibernate.security.dataobject.SecurityRule;
+import it.openutils.hibernate.security.services.SecurityRuleManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.acegisecurity.Authentication;
+import org.acegisecurity.GrantedAuthority;
+import org.acegisecurity.context.SecurityContextHolder;
+import org.apache.commons.lang.StringUtils;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.hibernate.Filter;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Restrictions;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * @author fcarone
+ * @version $Id$
+ */
+@Aspect
+public class AOPSecurity
+{
+
+ /**
+ * Logger.
+ */
+ private Logger log = LoggerFactory.getLogger(AOPSecurity.class);
+
+ private boolean denyIfNoRulesFound = true;
+
+ private SecurityRuleManager securityRuleManager;
+
+ private List<String> securedDAOs;
+
+ private boolean enabled;
+
+ /**
+ * @param pjp The proceeding joinpoint
+ * @param filter The entity we are going to filter
+ * @param additionalCriteria The additional criteria list, cannot be null
+ * @return The execution invocation result
+ * @throws Throwable Any exception occurring in the invoked method
+ */
+ @Around("execution(* it.openutils.dao.hibernate.*.*(Object, .., java.util.List<org.hibernate.criterion.Criterion>)) && "
+ + //
+ " args(filter, .., additionalCriteria)")
+ public Object applySecurityRules(ProceedingJoinPoint pjp, Object filter, List<Criterion> additionalCriteria)
+ throws Throwable
+ {
+ if (!enabled)
+ {
+ log.debug("DAO security disabled, proceeding.");
+ return pjp.proceed();
+ }
+
+ if (!securedDAOs.contains(pjp.getTarget().getClass().getCanonicalName()))
+ {
+ log.debug("The intercepted DAO {} is not secured, proceeding.", pjp.getTarget().toString());
+ return pjp.proceed();
+ }
+
+ log.debug("applying security rules for {} with criteria {}", filter.toString(), additionalCriteria);
+ Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
+ if (authentication == null)
+ {
+ throw new SecurityException("Authentication is not valid");
+ }
+ GrantedAuthority[] authorities = authentication.getAuthorities();
+ List<String> roles = new ArrayList<String>();
+ for (int i = 0; i < authorities.length; i++)
+ {
+ roles.add(authorities[i].getAuthority());
+ }
+
+ String entity = filter.getClass().getCanonicalName();
+ List<SecurityRule> rules = securityRuleManager.getRulesForRoles(filter, roles);
+
+ if (rules.isEmpty())
+ {
+ if (log.isWarnEnabled())
+ {
+ String grantedRoles = StringUtils.EMPTY;
+ for (int i = 0; i < authorities.length; i++)
+ {
+ grantedRoles += authorities[i].getAuthority() + " ";
+ }
+ log.warn(
+ "No rules found for " + entity + ", user {} with roles {}",
+ SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString(),
+ grantedRoles);
+ }
+ if (denyIfNoRulesFound)
+ {
+ log.debug("denyIfNoRulesFound is true, denying access.");
+ throw new SecurityException("Access denied");
+ }
+ else
+ {
+ log.debug("denyIfNoRulesFound is false, allowing access.");
+ return pjp.proceed();
+ }
+ }
+
+ Filter hibernateFilter = securityRuleManager.getEntityFilterFromRules(entity, rules);
+
+ Criterion sqlCriterion = Restrictions.sqlRestriction(hibernateFilter
+ .getFilterDefinition()
+ .getDefaultFilterCondition());
+
+ log.debug("Adding sql restriction: {}", sqlCriterion.toString());
+ additionalCriteria.add(sqlCriterion);
+
+ Object result = pjp.proceed();
+ return result;
+ }
+
+ /**
+ * Sets the securityRuleManager.
+ * @param securityRuleManager the securityRuleManager to set
+ */
+ public void setSecurityRuleManager(SecurityRuleManager securityRuleManager)
+ {
+ this.securityRuleManager = securityRuleManager;
+ }
+
+ /**
+ * Sets the securedDAOs.
+ * @param securedDAOs the securedDAOs to set
+ */
+ public void setSecuredDAOs(List<String> securedDAOs)
+ {
+ this.securedDAOs = securedDAOs;
+ }
+
+ /**
+ * Sets the enabled.
+ * @param enabled the enabled to set
+ */
+ public void setEnabled(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+
+ /**
+ * Sets the denyIfNoRulesFound.
+ * @param denyIfNoRulesFound the denyIfNoRulesFound to set
+ */
+ public void setDenyIfNoRulesFound(boolean denyIfNoRulesFound)
+ {
+ this.denyIfNoRulesFound = denyIfNoRulesFound;
+ }
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
- */
-package it.openutils.hibernate.security.dao;
-
-import it.openutils.dao.hibernate.HibernateDAO;
-import it.openutils.hibernate.security.dataobject.SecurityRule;
-
-
-/**
- * @author fcarone
- * @version $Id$
- */
-public interface SecurityRuleDAO extends HibernateDAO<SecurityRule, Long>
-{
-
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java (from rev 693, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/SecurityRuleDAO.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,29 @@
+/*
+ * 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.dao;
+
+import it.openutils.dao.hibernate.HibernateDAO;
+import it.openutils.hibernate.security.dataobject.SecurityRule;
+
+
+/**
+ * @author fcarone
+ * @version $Id$
+ */
+public interface SecurityRuleDAO extends HibernateDAO<SecurityRule, Long>
+{
+
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
- */
-package it.openutils.hibernate.security.dao.impl;
-
-import it.openutils.dao.hibernate.HibernateDAOImpl;
-import it.openutils.hibernate.security.dao.SecurityRuleDAO;
-import it.openutils.hibernate.security.dataobject.SecurityRule;
-
-
-/**
- * @author fcarone
- * @version $Id$
- */
-public class SecurityRuleDAOImpl extends HibernateDAOImpl<SecurityRule, Long> implements SecurityRuleDAO
-{
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Class<SecurityRule> getReferenceClass()
- {
- return SecurityRule.class;
- }
-
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java (from rev 693, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dao/impl/SecurityRuleDAOImpl.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,39 @@
+/*
+ * 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.dao.impl;
+
+import it.openutils.dao.hibernate.HibernateDAOImpl;
+import it.openutils.hibernate.security.dao.SecurityRuleDAO;
+import it.openutils.hibernate.security.dataobject.SecurityRule;
+
+
+/**
+ * @author fcarone
+ * @version $Id$
+ */
+public class SecurityRuleDAOImpl extends HibernateDAOImpl<SecurityRule, Long> implements SecurityRuleDAO
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Class<SecurityRule> getReferenceClass()
+ {
+ return SecurityRule.class;
+ }
+
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
- */
-package it.openutils.hibernate.security.dataobject;
-
-/**
- * @author fcarone
- * @version $Id$
- */
-public enum ModifierEnum {
-
- /**
- * Equals
- */
- EQUALS("equals"),
-
- /**
- * Not
- */
- NOT("not");
-
- private String value;
-
- /**
- * @param value The literal value of the modifier
- */
- ModifierEnum(String value)
- {
- this.value = value;
- }
-
- public String getValue()
- {
- return value;
- }
-
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java (from rev 693, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/ModifierEnum.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,49 @@
+/*
+ * 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.dataobject;
+
+/**
+ * @author fcarone
+ * @version $Id$
+ */
+public enum ModifierEnum {
+
+ /**
+ * Equals
+ */
+ EQUALS("equals"),
+
+ /**
+ * Not
+ */
+ NOT("not");
+
+ private String value;
+
+ /**
+ * @param value The literal value of the modifier
+ */
+ ModifierEnum(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
- */
-package it.openutils.hibernate.security.dataobject;
-
-/**
- * @author fcarone
- * @version $Id$
- */
-public enum PermissionEnum {
-
- /**
- * Load, Create, Modify, Delete permissions
- */
- LOAD("LOAD"), CREATE("CREATE"), MODIFY("MODIFY"), DELETE("DELETE");
-
- private String value;
-
- /**
- * @param value The literal value for the needed enumeration object
- */
- PermissionEnum(String value)
- {
- this.value = value;
- }
-
-
- /**
- * Returns the value.
- * @return the value
- */
- public String getValue()
- {
- return value;
- }
-
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java (from rev 693, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/PermissionEnum.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,49 @@
+/*
+ * 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.dataobject;
+
+/**
+ * @author fcarone
+ * @version $Id$
+ */
+public enum PermissionEnum {
+
+ /**
+ * Load, Create, Modify, Delete permissions
+ */
+ LOAD("LOAD"), CREATE("CREATE"), MODIFY("MODIFY"), DELETE("DELETE");
+
+ private String value;
+
+ /**
+ * @param value The literal value for the needed enumeration object
+ */
+ PermissionEnum(String value)
+ {
+ this.value = value;
+ }
+
+
+ /**
+ * Returns the value.
+ * @return the value
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
- */
-package it.openutils.hibernate.security.dataobject;
-
-import java.io.Serializable;
-import java.util.List;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.Table;
-
-import org.hibernate.annotations.CollectionOfElements;
-import org.hibernate.annotations.Fetch;
-import org.hibernate.annotations.FetchMode;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
-
-/**
- * @author fcarone
- * @version $Id$ A security rule
- */
-@Entity
-@Table(name = "SECURITY_RULE")
-public class SecurityRule implements Serializable
-{
-
- /**
- * Generated serial version UID
- */
- private static final long serialVersionUID = -4820683448073404349L;
-
- @Id
- @GeneratedValue(strategy = GenerationType.AUTO)
- @Column(name = "ID_SECURITY_RULE")
- private Long id;
-
- @Column(name = "ROLE", length = 64, nullable = false)
- private String role;
-
- @Column(name = "ENTITY", length = 512, nullable = false)
- private String entity;
-
- @Column(name = "PROPERTY", length = 512, nullable = false)
- private String property;
-
- @Column(name = "VALUE", nullable = false)
- private String value;
-
- @Enumerated(EnumType.STRING)
- @Column(name = "MODIFIER", nullable = false)
- private ModifierEnum modifier;
-
- @CollectionOfElements(fetch = FetchType.EAGER)
- @JoinTable(name = "SECRULE_PERMISSION", joinColumns = {@JoinColumn(name = "ID_SECURITY_RULE") })
- @Column(name = "PERMISSION", nullable = false)
- @Enumerated(EnumType.STRING)
- @Fetch(FetchMode.SUBSELECT)
- private List<PermissionEnum> permissions;
-
- /**
- * Returns the role.
- * @return the role
- */
- public String getRole()
- {
- return role;
- }
-
- /**
- * Sets the role.
- * @param role the role to set
- */
- public void setRole(String role)
- {
- this.role = role;
- }
-
- /**
- * Returns the entity.
- * @return the entity
- */
- public String getEntity()
- {
- return entity;
- }
-
- /**
- * Sets the entity.
- * @param entity the entity to set
- */
- public void setEntity(String entity)
- {
- this.entity = entity;
- }
-
- /**
- * Returns the property.
- * @return the property
- */
- public String getProperty()
- {
- return property;
- }
-
- /**
- * Sets the property.
- * @param property the property to set
- */
- public void setProperty(String property)
- {
- this.property = property;
- }
-
- /**
- * Returns the value.
- * @return the value
- */
- public String getValue()
- {
- return value;
- }
-
- /**
- * Sets the value.
- * @param value the value to set
- */
- public void setValue(String value)
- {
- this.value = value;
- }
-
- /**
- * Returns the modifier.
- * @return the modifier
- */
- public ModifierEnum getModifier()
- {
- return modifier;
- }
-
- /**
- * Sets the modifier.
- * @param modifier the modifier to set
- */
- public void setModifier(ModifierEnum modifier)
- {
- this.modifier = modifier;
- }
-
- /**
- * Returns the permissions.
- * @return the permissions
- */
- public List<PermissionEnum> getPermissions()
- {
- return permissions;
- }
-
- /**
- * Sets the permissions.
- * @param permissions the permissions to set
- */
- public void setPermissions(List<PermissionEnum> permissions)
- {
- this.permissions = permissions;
- }
-
- /**
- * Returns the id.
- * @return the id
- */
- public Long getId()
- {
- return id;
- }
-
- /**
- * Sets the id.
- * @param id the id to set
- */
- public void setId(Long id)
- {
- this.id = id;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String toString()
- {
- return new ToStringBuilder(this)
- .append("id", this.id)
- .append("role", this.role)
- .append("entity", this.entity)
- .append("property", this.property)
- .append("value", this.value)
- .append("modifier", this.modifier)
- .append("permissions", this.permissions)
- .toString();
- }
-
-}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java (from rev 696, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/SecurityRule.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) Openmind. All rights reserved. http://www.openmindonline.it
+ */
+package it.openutils.hibernate.security.dataobject;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.Table;
+
+import org.hibernate.annotations.CollectionOfElements;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.Filter;
+import org.hibernate.annotations.FilterDef;
+import org.hibernate.annotations.FilterDefs;
+import org.hibernate.annotations.Filters;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * @author fcarone
+ * @version $Id$ A security rule
+ */
+@Entity
+@Table(name = "SECURITY_RULE")
+@FilterDefs({@FilterDef(name = "notDeletedRules", defaultCondition = "DELETED != '1'") })
+@Filters({@Filter(name = "notDeletedRules") })
+public class SecurityRule implements Serializable
+{
+
+ /**
+ * Generated serial version UID
+ */
+ private static final long serialVersionUID = -4820683448073404349L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.AUTO)
+ @Column(name = "ID_SECURITY_RULE")
+ private Long id;
+
+ @Column(name = "ROLE", length = 64, nullable = false)
+ private String role;
+
+ @Column(name = "ENTITY", length = 512, nullable = false)
+ private String entity;
+
+ @Column(name = "PROPERTY", length = 512, nullable = false)
+ private String property;
+
+ @Column(name = "VALUE", nullable = false)
+ private String value;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "MODIFIER", nullable = false)
+ private ModifierEnum modifier;
+
+ @CollectionOfElements(fetch = FetchType.EAGER)
+ @JoinTable(name = "SECRULE_PERMISSION", joinColumns = {@JoinColumn(name = "ID_SECURITY_RULE") })
+ @Column(name = "PERMISSION", nullable = false)
+ @Enumerated(EnumType.STRING)
+ @Fetch(FetchMode.SUBSELECT)
+ private List<PermissionEnum> permissions;
+
+ @Enumerated(EnumType.STRING)
+ @Column(name = "STATUS", nullable = false)
+ private StatusEnum status;
+
+ @Column(name = "DELETED", length = 1, nullable = false)
+ private Boolean deleted;
+
+ @CollectionOfElements(fetch = FetchType.EAGER)
+ @org.hibernate.annotations.MapKey(columns = @Column(name = "NAME"))
+ @JoinTable(name = "SECRULE_ENTITY", joinColumns = {@JoinColumn(name = "ID_SECURITY_RULE") })
+ @Column(name = "VALUE", length = 256)
+ @Fetch(FetchMode.SUBSELECT)
+ private Map<String, String> entities;
+
+ /**
+ * Returns the role.
+ * @return the role
+ */
+ public String getRole()
+ {
+ return role;
+ }
+
+ /**
+ * Sets the role.
+ * @param role the role to set
+ */
+ public void setRole(String role)
+ {
+ this.role = role;
+ }
+
+ /**
+ * Returns the entity.
+ * @return the entity
+ */
+ public String getEntity()
+ {
+ return entity;
+ }
+
+ /**
+ * Sets the entity.
+ * @param entity the entity to set
+ */
+ public void setEntity(String entity)
+ {
+ this.entity = entity;
+ }
+
+ /**
+ * Returns the property.
+ * @return the property
+ */
+ public String getProperty()
+ {
+ return property;
+ }
+
+ /**
+ * Sets the property.
+ * @param property the property to set
+ */
+ public void setProperty(String property)
+ {
+ this.property = property;
+ }
+
+ /**
+ * Returns the value.
+ * @return the value
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Sets the value.
+ * @param value the value to set
+ */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Returns the modifier.
+ * @return the modifier
+ */
+ public ModifierEnum getModifier()
+ {
+ return modifier;
+ }
+
+ /**
+ * Sets the modifier.
+ * @param modifier the modifier to set
+ */
+ public void setModifier(ModifierEnum modifier)
+ {
+ this.modifier = modifier;
+ }
+
+ /**
+ * Returns the permissions.
+ * @return the permissions
+ */
+ public List<PermissionEnum> getPermissions()
+ {
+ return permissions;
+ }
+
+ /**
+ * Sets the permissions.
+ * @param permissions the permissions to set
+ */
+ public void setPermissions(List<PermissionEnum> permissions)
+ {
+ this.permissions = permissions;
+ }
+
+ /**
+ * Returns the id.
+ * @return the id
+ */
+ public Long getId()
+ {
+ return id;
+ }
+
+ /**
+ * Sets the id.
+ * @param id the id to set
+ */
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString()
+ {
+ return new ToStringBuilder(this)
+ .append("id", this.id)
+ .append("role", this.role)
+ .append("entity", this.entity)
+ .append("property", this.property)
+ .append("value", this.value)
+ .append("modifier", this.modifier)
+ .append("permissions", this.permissions)
+ .toString();
+ }
+
+ /**
+ * Returns the status.
+ * @return the status
+ */
+ public StatusEnum getStatus()
+ {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ * @param status the status to set
+ */
+ public void setStatus(StatusEnum status)
+ {
+ this.status = status;
+ }
+
+ /**
+ * @return True if the rule is enabled
+ */
+ public boolean isEnabled()
+ {
+ if (status == null)
+ {
+ return false;
+ }
+ return status.equals(StatusEnum.ENABLED);
+ }
+
+ /**
+ * Returns the entities.
+ * @return the entities
+ */
+ public Map<String, String> getEntities()
+ {
+ return entities;
+ }
+
+ /**
+ * Sets the entities.
+ * @param entities the entities to set
+ */
+ public void setEntities(Map<String, String> entities)
+ {
+ this.entities = entities;
+ }
+
+
+ /**
+ * Returns the deleted.
+ * @return the deleted
+ */
+ public Boolean getDeleted()
+ {
+ return deleted;
+ }
+
+
+ /**
+ * Sets the deleted.
+ * @param deleted the deleted to set
+ */
+ public void setDeleted(Boolean deleted)
+ {
+ this.deleted = deleted;
+ }
+
+}
Copied: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/StatusEnum.java (from rev 688, trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/dataobject/StatusEnum.java)
===================================================================
--- tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/StatusEnum.java (rev 0)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/dataobject/StatusEnum.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -0,0 +1,46 @@
+/*
+ * 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.dataobject;
+
+
+/**
+ * @author fcarone
+ * @version $Id: $
+ */
+public enum StatusEnum {
+
+ /**
+ * Enabled
+ */
+ ENABLED("enabled"),
+
+ /**
+ * Disabled
+ */
+ DISABLED("disabled");
+
+ private String value;
+
+ private StatusEnum(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+}
Deleted: tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/JavaBeanFilter.java
===================================================================
--- trunk/openutils-hibernate-security/src/main/java/it/openutils/hibernate/security/filter/JavaBeanFilter.java 2008-02-21 09:17:34 UTC (rev 673)
+++ tags/openutils-hibernate-security-0.0.7/src/main/java/it/openutils/hibernate/security/filter/JavaBeanFilter.java 2008-03-06 09:26:46 UTC (rev 729)
@@ -1,258 +0,0 @@
-/*
- * 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;
-
-import it.openutils.hibernate.security.dataobject.PermissionEnum;
-import it.openutils.hibernate.security.dataobject.SecurityRule;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Table;
-
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.lang.StringUtils;
-import org.hibernate.Filter;
-import org.hibernate.HibernateException;
-import org.hibernate.engine.F...
[truncated message content] |