Index: topia-security/src/java/org/codelutin/topia/security/listener/VetoableEntityListener.java diff -u topia-security/src/java/org/codelutin/topia/security/listener/VetoableEntityListener.java:1.5 topia-security/src/java/org/codelutin/topia/security/listener/VetoableEntityListener.java:1.6 --- topia-security/src/java/org/codelutin/topia/security/listener/VetoableEntityListener.java:1.5 Thu Oct 5 07:49:44 2006 +++ topia-security/src/java/org/codelutin/topia/security/listener/VetoableEntityListener.java Mon Oct 16 14:15:46 2006 @@ -24,9 +24,9 @@ * Created: 10 févr. 2006 * * @author Arnaud Thimel -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ * -* Mise a jour: $Date: 2006/10/05 07:49:44 $ +* Mise a jour: $Date: 2006/10/16 14:15:46 $ * par : $Author: ruchaud $ */ @@ -35,7 +35,6 @@ import static org.codelutin.topia.security.util.TopiaSecurityUtil.CREATE; import static org.codelutin.topia.security.util.TopiaSecurityUtil.DELETE; import static org.codelutin.topia.security.util.TopiaSecurityUtil.LOAD; -import static org.codelutin.topia.security.util.TopiaSecurityUtil.checkPermission; import java.util.Arrays; import java.util.List; @@ -73,7 +72,7 @@ log.debug("[Security] create entity : " + event.getEntityClass()); } try { - checkPermission(event.getEntityClass(), CREATE); + securityManager.checkPermission(event.getEntityClass(), CREATE); } catch (TopiaException te) { throw new SecurityException("Access denied to entity creation", te); } @@ -87,7 +86,7 @@ log.debug("[Security] delete entity : " + event.getId()); } try { - checkPermission((String)event.getId(), DELETE); + securityManager.checkPermission((String)event.getId(), DELETE); } catch (TopiaException te) { throw new SecurityException("Access denied to entity deletion", te); } @@ -115,7 +114,7 @@ } try { - checkPermission((String)event.getId(), LOAD); + securityManager.checkPermission((String)event.getId(), LOAD); } catch (TopiaException te) { authorized = false; Index: topia-security/src/java/org/codelutin/topia/security/listener/PropertyWriteListener.java diff -u topia-security/src/java/org/codelutin/topia/security/listener/PropertyWriteListener.java:1.3 topia-security/src/java/org/codelutin/topia/security/listener/PropertyWriteListener.java:1.4 --- topia-security/src/java/org/codelutin/topia/security/listener/PropertyWriteListener.java:1.3 Tue Oct 10 16:16:20 2006 +++ topia-security/src/java/org/codelutin/topia/security/listener/PropertyWriteListener.java Mon Oct 16 14:15:46 2006 @@ -21,7 +21,6 @@ package org.codelutin.topia.security.listener; import static org.codelutin.topia.security.util.TopiaSecurityUtil.UPDATE; -import static org.codelutin.topia.security.util.TopiaSecurityUtil.checkPermission; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; @@ -31,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import org.codelutin.topia.TopiaException; import org.codelutin.topia.persistence.TopiaEntityAbstract; +import org.codelutin.topia.security.TopiaSecurityManagerImpl; /** * Listenner permettant de vérifier les autorisations pour le modification d'une @@ -41,6 +41,12 @@ private static Log log = LogFactory.getLog(PropertyWriteListener.class); + private TopiaSecurityManagerImpl securityManager; + + public PropertyWriteListener(TopiaSecurityManagerImpl securityManager) { + this.securityManager = securityManager; + } + /* * (non-Javadoc) * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent) @@ -49,7 +55,7 @@ Object source = event.getSource(); TopiaEntityAbstract entity = (TopiaEntityAbstract) source; try { - checkPermission(entity.getTopiaId(), UPDATE); + securityManager.checkPermission(entity.getTopiaId(), UPDATE); } catch (TopiaException te) { if (log.isWarnEnabled()) { log.warn("[Security] Write denied to : " + entity.getTopiaId(), te); Index: topia-security/src/java/org/codelutin/topia/security/listener/PropertyReadListener.java diff -u topia-security/src/java/org/codelutin/topia/security/listener/PropertyReadListener.java:1.4 topia-security/src/java/org/codelutin/topia/security/listener/PropertyReadListener.java:1.5 --- topia-security/src/java/org/codelutin/topia/security/listener/PropertyReadListener.java:1.4 Tue Oct 10 16:16:20 2006 +++ topia-security/src/java/org/codelutin/topia/security/listener/PropertyReadListener.java Mon Oct 16 14:15:46 2006 @@ -21,7 +21,6 @@ package org.codelutin.topia.security.listener; import static org.codelutin.topia.security.util.TopiaSecurityUtil.LOAD; -import static org.codelutin.topia.security.util.TopiaSecurityUtil.checkPermission; import java.beans.PropertyChangeEvent; import java.beans.PropertyVetoException; @@ -65,7 +64,7 @@ } } else { // Sinon try { - checkPermission(entity.getTopiaId(), LOAD); + securityManager.checkPermission(entity.getTopiaId(), LOAD); } catch (TopiaException te) { if (log.isWarnEnabled()) { log.warn("[Security] Read denied to : " + entity.getTopiaId(), te);