Index: topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoable.java diff -u topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoable.java:1.3 topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoable.java:1.4 --- topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoable.java:1.3 Tue Dec 4 16:42:50 2007 +++ topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoable.java Fri Dec 7 16:24:36 2007 @@ -24,9 +24,9 @@ * Created: 10 févr. 2006 * * @author Arnaud Thimel -* @version $Revision: 1.3 $ +* @version $Revision: 1.4 $ * -* Mise a jour: $Date: 2007-12-04 16:42:50 $ +* Mise a jour: $Date: 2007-12-07 16:24:36 $ * par : $Author: ruchaud $ */ @@ -140,18 +140,13 @@ String topiaId = entity.getTopiaId(); Class klass = null; +// log.info(topiaId); try { klass = TopiaId.getClassName(topiaId); } catch (TopiaNotFoundException e) { throw new SecurityException("Invalid topiaId", e); } - // Actions - if(TopiaSecurityUtil.isImplement(klass, TaasNoSecurityLoad.class)) { - //LOAD - actions &= UPDATE + DELETE + CREATE; - } - // Permissions List permissions = null; try { @@ -163,7 +158,7 @@ transaction.closeContext(); } catch (TopiaException e) { - throw new SecurityException("Error in getRequestPermission", e); + throw new SecurityException("Error in getRequestPermission for " + klass.getName(), e); } if(permissions == null) { @@ -172,28 +167,24 @@ permissions.add(new TaasPermission(authorization)); } - if(actions != 0) { - Subject subject = Subject.getSubject(AccessController.getContext()); - if (subject != null) { - boolean authorized = false; - for (Permission permission : permissions) { - try { - AccessController.checkPermission(permission); - authorized = true; - break; - } catch (SecurityException se) { - authorized = false; - } - } - - if(!authorized) { - throw new SecurityException("Access denied to object \"" + topiaId + "\" for \"" + subject + "\""); + Subject subject = Subject.getSubject(AccessController.getContext()); + if (subject != null) { + boolean authorized = false; + for (Permission permission : permissions) { + try { + AccessController.checkPermission(permission); + authorized = true; + break; + } catch (SecurityException se) { + authorized = false; } } - } else { - if(log.isWarnEnabled()) { - log.warn("Use doAs() and login first"); + + if(!authorized) { + throw new SecurityException("Access denied to object \"" + topiaId + "\" for \"" + subject + "\""); } + } else { + throw new SecurityException("Use doAs() and login first"); } } } Index: topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoableNoLoad.java diff -u /dev/null topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoableNoLoad.java:1.1 --- /dev/null Fri Dec 7 16:24:42 2007 +++ topia-service/src/java/org/codelutin/topia/taas/event/TaasEntityVetoableNoLoad.java Fri Dec 7 16:24:36 2007 @@ -0,0 +1,56 @@ +/* *##% +* Copyright (C) 2002, 2003, 2004, 2005 Code Lutin, +* Cédric Pineau, Benjamin Poussin, +* +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*##%*/ + +/* * +* TopiaSecurityVetoableListener.java +* +* Created: 10 févr. 2006 +* +* @author Arnaud Thimel +* @version $Revision: 1.1 $ +* +* Mise a jour: $Date: 2007-12-07 16:24:36 $ +* par : $Author: ruchaud $ +*/ + +package org.codelutin.topia.taas.event; + +import org.codelutin.topia.event.TopiaEntityEvent; +import org.codelutin.topia.taas.TaasService; + +/** + * Listenner permettant de vérifier les autorisations pour la création ou la + * suppression d'une entité. + * @author ruchaud + */ +public class TaasEntityVetoableNoLoad extends TaasEntityVetoable { + + public TaasEntityVetoableNoLoad(TaasService taasService) { + super(taasService); + } + + /* + * (non-Javadoc) + * @see org.codelutin.topia.event.TopiaVetoableEntityLoadListener#loadEntity(org.codelutin.topia.event.TopiaVetoableEntityLoadEvent) + */ + public void load(TopiaEntityEvent event) { +// log.info("######################################################"); + } +}