public static boolean hasAnyRoles(String roleNames) {
        boolean hasAnyRole = false;
        Subject subject = getSubject();
        if (subject != null && roleNames != null && roleNames.length() > 0) {
            // Iterate through roles and check to see if the user has one of the
            // roles
            for (String role : roleNames.split(NAMES_DELIMETER)) {
                if (subject.hasRole(role.trim())) {
                    hasAnyRole = true;
                    break;
                }
            }
        }
        return hasAnyRole;
    }
public static boolean hasAnyRoles ( String roleNames ) { boolean hasAnyRole = false ; Subject subject = getSubject ( ) ; if ( subject != null && roleNames != null && roleNames . length ( ) > 0 ) { for ( String role : roleNames . split ( NAMES_DELIMETER ) ) { if ( subject . hasRole ( role . trim ( ) ) ) { hasAnyRole = true ; break ; } } } return hasAnyRole ; }
验证当前用户是否属于以下任意一个角色。

@param roleNames 角色列表
@return 属于:true,否则false