citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/util/UserContextUtil.java
public static boolean allowRoleInSecurityContext(final String role) {
		boolean result = false;
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null && context.getAuthentication() != null) {
			final Collection<? extends GrantedAuthority> authorities = context.getAuthentication().getAuthorities();

			for (final GrantedAuthority grantedAuthority : authorities) {
				if (role.equalsIgnoreCase(grantedAuthority.getAuthority())) {
					result = true;
				}
			}
		}
		return result;
	}
public static boolean allowRoleInSecurityContext(final String role) {
		boolean result = false;
		final SecurityContext context = SecurityContextHolder.getContext();
		if (context != null && context.getAuthentication() != null) {
			final Collection<? extends GrantedAuthority> authorities = context.getAuthentication().getAuthorities();

			for (final GrantedAuthority grantedAuthority : authorities) {
				if (role.equalsIgnoreCase(grantedAuthority.getAuthority())) {
					result = true;
				}
			}
		}
		return result;
	}
public static boolean allowRoleInSecurityContext ( final String role ) { boolean result = false ; final SecurityContext context = SecurityContextHolder . getContext ( ) ; if ( context != null && context . getAuthentication ( ) != null ) { final Collection < ? extends GrantedAuthority > authorities = context . getAuthentication ( ) . getAuthorities ( ) ; for ( final GrantedAuthority grantedAuthority : authorities ) { if ( role . equalsIgnoreCase ( grantedAuthority . getAuthority ( ) ) ) { result = true ; } } } return result ; }
Allow role in security context.

@param role
the role
@return true, if successful
Allow role in security context .