17,8 → 17,7 |
package net.brutex.xservices.security; |
|
|
import org.apache.logging.log4j.LogManager; |
import org.apache.logging.log4j.Logger; |
import lombok.extern.slf4j.Slf4j; |
import org.apache.shiro.authz.Permission; |
import org.apache.shiro.util.AntPathMatcher; |
|
26,14 → 25,13 |
* @author Brian Rosenberger, bru(at)brutex.de |
* |
*/ |
@Slf4j |
public class DirectoryPermission implements Permission { |
|
private final Logger logger = LogManager.getLogger(); |
|
private final String path; |
|
public DirectoryPermission(String antlikepath) { |
logger.debug(String.format("Creating permission for path '%s'", antlikepath)); |
log.debug(String.format("Creating permission for path '{}'", antlikepath)); |
path = antlikepath; |
} |
|
43,13 → 41,13 |
|
/* is of same type */ |
if(! (p instanceof DirectoryPermission)) { |
logger.debug(String.format("Testing if permission of type '%s' implies permission of type '%s'. Result was '%s'" , this.getClass(), p.getClass(), result)); |
log.debug(String.format("Testing if permission of type '{}' implies permission of type '{}'. Result was '{}'" , this.getClass(), p.getClass(), result)); |
return result; |
} |
|
/* comparing to non null directory */ |
if( ((DirectoryPermission)p).getPath() == null) { |
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'" , this.getPath(), result)); |
log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to 'null'. Result was '{}'" , this.getPath(), result)); |
return result; |
} |
|
57,7 → 55,7 |
if( (new AntPathMatcher()).matches(path, ((DirectoryPermission)p).getPath()) ) { |
result = true; |
} |
logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to '%s'. Result was '%s'" , this.getPath(), ((DirectoryPermission) p).getPath(), result)); |
log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to '{}'. Result was '{}'" , this.getPath(), ((DirectoryPermission) p).getPath(), result)); |
|
return result; |
} |