Project

General

Profile

« Previous | Next » 

Revision 5b850621

Added by Andreas Kohlbecker almost 10 years ago

supplemental method for testing permissions

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.store;
11 11

  
12
import java.io.Serializable;
12 13
import java.lang.reflect.InvocationTargetException;
13 14
import java.lang.reflect.Method;
14 15
import java.lang.reflect.Type;
......
338 339
		return getPermissionEvaluator().hasPermission(context.getAuthentication(), targetDomainObject, permission);
339 340
	}
340 341

  
342
	/**
343
	 * @see org.springframework.security.access.PermissionEvaluator#hasPermission(org.springframework.security.core.Authentication, java.lang.Object, java.lang.Object)
344
     *
345
	 * @param targetDomainObject
346
	 * @param permission 
347
	 * @return
348
	 */
349
	public static boolean currentAuthentiationHasPermission(Class<? extends CdmBase> targetType, EnumSet<CRUD> permission){
350
		SecurityContext context = SecurityContextHolder.getContext();
351
		return getPermissionEvaluator().hasPermission(context.getAuthentication(), null, targetType.getName(), permission);
352
	}
353
	
341 354
	/*
342 355
	 * LANGUAGE
343 356
	 */

Also available in: Unified diff