Subversion Repositories XServices

Rev

Rev 198 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 198 Rev 199
Line 15... Line 15...
15
*/
15
*/
Line 16... Line 16...
16
 
16
 
Line 17... Line -...
17
package net.brutex.xservices.security;
-
 
18
 
17
package net.brutex.xservices.security;
19
 
18
 
20
import org.apache.logging.log4j.LogManager;
19
 
Line 21... Line 20...
21
import org.apache.logging.log4j.Logger;
20
import lombok.extern.slf4j.Slf4j;
22
import org.apache.shiro.authz.Permission;
21
import org.apache.shiro.authz.Permission;
23
import org.apache.shiro.util.AntPathMatcher;
22
import org.apache.shiro.util.AntPathMatcher;
24
 
23
 
-
 
24
/**
25
/**
25
 * @author Brian Rosenberger, bru(at)brutex.de
Line 26... Line -...
26
 * @author Brian Rosenberger, bru(at)brutex.de
-
 
27
 *
-
 
28
 */
26
 *
Line 29... Line 27...
29
public class DirectoryPermission implements Permission {
27
 */
30
 
28
@Slf4j
31
	private final Logger logger = LogManager.getLogger();
29
public class DirectoryPermission implements Permission {
32
 
30
 
Line 33... Line 31...
33
	private final String path;
31
	private final String path;
34
 
32
 
35
	public DirectoryPermission(String antlikepath) {
33
	public DirectoryPermission(String antlikepath) {
Line 36... Line 34...
36
		logger.debug(String.format("Creating permission for path '%s'", antlikepath));
34
		log.debug(String.format("Creating permission for path '{}'", antlikepath));
37
		path = antlikepath;
35
		path = antlikepath;
38
	}
36
	}
39
	
37
	
40
	@Override
38
	@Override
Line 41... Line 39...
41
	public boolean implies(Permission p) {
39
	public boolean implies(Permission p) {
42
		boolean result = false;
40
		boolean result = false;
43
		
41
		
44
		/* is of same type */
42
		/* is of same type */
45
		if(! (p instanceof DirectoryPermission)) {			
43
		if(! (p instanceof DirectoryPermission)) {			
Line 46... Line 44...
46
			logger.debug(String.format("Testing if permission of type '%s' implies permission of type '%s'. Result was '%s'"  , this.getClass(), p.getClass(), result));
44
			log.debug(String.format("Testing if permission of type '{}' implies permission of type '{}'. Result was '{}'"  , this.getClass(), p.getClass(), result));
47
			return result;
45
			return result;
48
		}
46
		}
49
		
47
		
50
		/* comparing to non null directory */
48
		/* comparing to non null directory */
Line 51... Line 49...
51
		if( ((DirectoryPermission)p).getPath() == null) {
49
		if( ((DirectoryPermission)p).getPath() == null) {
52
			logger.debug(String.format("Testing if DirectoryPermission '%s' implies permission to 'null'. Result was '%s'"  , this.getPath(), result));
50
			log.debug(String.format("Testing if DirectoryPermission '{}' implies permission to 'null'. Result was '{}'"  , this.getPath(), result));
Line 53... Line 51...
53
			return result;
51
			return result;