1 26 package org.riotfamily.riot.security.policy; 27 28 import org.apache.commons.logging.Log; 29 import org.apache.commons.logging.LogFactory; 30 import org.riotfamily.riot.security.auth.RiotUser; 31 32 38 public class LoggingPolicy implements AuthorizationPolicy { 39 40 private static final Log log = LogFactory.getLog(LoggingPolicy.class); 41 42 private int order = Integer.MIN_VALUE; 43 44 public int getOrder() { 45 return this.order; 46 } 47 48 public void setOrder(int order) { 49 this.order = order; 50 } 51 52 public int checkPermission(RiotUser user, String action, Object object) { 53 if (log.isDebugEnabled()) { 54 StringBuffer message = new StringBuffer (); 55 message.append("user: [").append(user.getUserId()).append("], "); 56 message.append("action: [").append(action).append("], "); 57 message.append("object: "); 58 if (object != null) { 59 message.append(object.getClass().getName()); 60 } 61 message.append("[").append(object).append("]"); 62 63 log.debug(message.toString()); 64 } 65 return ACCESS_ABSTAIN; 66 } 67 68 } 69 | Popular Tags |