// Path: src/main/java/org/andidev/applicationname/entity/enums/Role.java
// public enum Role {
// 
//     ROLE_ROOT,
//     ROLE_DEVELOPER,
//     ROLE_ADMIN,
//     ROLE_USER,
//     ROLE_ANONYMOUS;
// 
//     public static Set<Role> getAllRolesExceptAnonymous() {
//         Set set = EnumSet.allOf(Role.class);
//         set.remove(ROLE_ANONYMOUS);
//         return set;
//     }
// 
// }


import java.util.Set;
import org.andidev.applicationname.entity.enums.Role;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContextHolder;
package org.andidev.applicationname.util;


public class SecurityUtils {

    public static boolean hasAuthority(String authority) {
        return hasRole(authority);
    }

    public static boolean hasAnyAuthority(String... authorities) {
        return hasAnyRole(authorities);
    }

    public static boolean hasRole(String role) {
        return getAuthorities().contains(role);
    }

    public static boolean hasRole(Role role) {
        return getAuthorities().contains(role.toString());
    }

    public static boolean hasAnyRole(String... roles) {
        Set<String> authorities = getAuthorities();
        for (String role : roles) {
            if (authorities.contains(role)) {
                return true;
            }
        }
        // No roles matches
        return false;
    }

    public static boolean hasAnyRole(Role... roles) {
        Set<String> authorities = getAuthorities();
// Path: src/main/java/org/andidev/applicationname/entity/enums/Role.java
// public enum Role {
// 
//     ROLE_ROOT,
//     ROLE_DEVELOPER,
//     ROLE_ADMIN,
//     ROLE_USER,
//     ROLE_ANONYMOUS;
// 
//     public static Set<Role> getAllRolesExceptAnonymous() {
//         Set set = EnumSet.allOf(Role.class);
//         set.remove(ROLE_ANONYMOUS);
//         return set;
//     }
// 
// }


// Path: src/main/java/org/andidev/applicationname/util/SecurityUtils.java
import java.util.Set;
import org.andidev.applicationname.entity.enums.Role;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.authentication.RememberMeAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.context.SecurityContextHolder;

package org.andidev.applicationname.util;


public class SecurityUtils {

    public static boolean hasAuthority(String authority) {
        return hasRole(authority);
    }

    public static boolean hasAnyAuthority(String... authorities) {
        return hasAnyRole(authorities);
    }

    public static boolean hasRole(String role) {
        return getAuthorities().contains(role);
    }

    public static boolean hasRole(Role role) {
        return getAuthorities().contains(role.toString());
    }

    public static boolean hasAnyRole(String... roles) {
        Set<String> authorities = getAuthorities();
        for (String role : roles) {
            if (authorities.contains(role)) {
                return true;
            }
        }
        // No roles matches
        return false;
    }

    public static boolean hasAnyRole(Role... roles) {
        Set<String> authorities = getAuthorities();
        for (Role role : roles) {