Package it.hotel.aspects

Source Code of it.hotel.aspects.SecurityObjectInterceptor

/*
Copyright (C) European Community 2008 - Licensed under the EUPL V.1.0 (http://ec.europa.eu/idabc/en/document/6523)
*/

package it.hotel.aspects;

import it.hotel.model.hotel.IStructureObject;

import org.aopalliance.intercept.MethodInvocation;

/**
* Advice che filtra l'oggetto restituito dai metodi
* configurati. Viene effettuato un filtraggio
* in base all'hotel associato all'utente.
*
* @author ricky
*
*/
public class SecurityObjectInterceptor extends AbstractSecurityInterceptor {

 
  /**
   * @param
   * @throws
   * @return
   */
  public Object invoke(MethodInvocation invocation) throws Throwable {
    Object rval = null;
    rval = invocation.proceed();   
    if(!"admin".equals(getRoleName()) && rval != null){     
      IStructureObject element = (IStructureObject)rval;
      boolean permitted = element.isFromStructure(getUserHotelId());
      if(!permitted) {
        rval = null;
      }
    }
    return rval;
  }


}
TOP

Related Classes of it.hotel.aspects.SecurityObjectInterceptor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.