class SecurityHelper {

    public Set<GrantedAuthority> getUnrestrictedFunctions()
    {
        // TODO Getting HerdDao from applicationContext statically because if we try to wire HerdDao here it does not get constructed with proxy class that is
        // needed for @Cacheable methods to work.
        SecurityFunctionDao securityFunctionDao = ApplicationContextHolder.getApplicationContext().getBean(SecurityFunctionDao.class);

        Set<GrantedAuthority> authorities = new HashSet<>();

        // Add all unrestricted functional points.
        for (String function : securityFunctionDao.getUnrestrictedSecurityFunctions())
        {
            authorities.add(new SimpleGrantedAuthority(function));
        }

        return authorities;
    }

}