code: public boolean checkRegexPattern(final Optional<Subject> subjectOption,
                                       final Optional<Pattern> patternOption)
      {
          final boolean[] roleOk = {false};
          subjectOption.ifPresent(subject -> patternOption.ifPresent(pattern -> {
              final List<? extends Permission> permissions = subject.getPermissions();
              if (permissions != null)
              {
                  for (Iterator<? extends Permission> iterator = permissions.iterator(); !roleOk[0] && iterator.hasNext(); )
                  {
                      final Permission permission = iterator.next();
                      roleOk[0] = pattern.matcher(permission.getValue()).matches();
                  }
              }
          }));
  
          return roleOk[0];
      }
docs: Check the pattern for a match against the {@link Permission}s of the user.
  
  @param subjectOption an option for the subject
  @param patternOption an option for the pattern
  @return true iff the pattern matches at least one of the subject's permissions