I think there's helper functions for this I want to say
https://github.com/search?q=org%3Ajenkinsci+StandardListBoxModel&type=code https://github.com/jenkinsci/huaweicloud-mastermonitor-plugin/blob/b96e0fb3649dfbd69e0f0a2184c4d66c232af57c/src/main/java/com/huawei/devcloud/global_configuration/DevCloudGlobalConfiguration.java#L117 might help out a bit? On Mon, Sep 27, 2021 at 4:21 PM Tim Van Holder <[email protected]> wrote: > Hi, > > I'm looking at bumping my plugin from Jenkins 249.1 to 289.1 (plus > plugin-parent from 4.19 to 4.27 and the BOM from 2.249.x/887.vae9c8ac09ff7 > to 2.289.x/950.v396cb834de1). > > This all works fine, except I get a warning about deprecated code. > > I have a helper method to populate a list box (a <c:select/>) with string > credentials (NuGet API keys). > These will be used on configuration for build steps (both via the classic > job UI, and via the snippet generator for use in pipelines). > > @NonNull > static ListBoxModel getStringCredentialsList(@CheckForNull Jenkins context, > boolean allowEmpty) { > AbstractIdCredentialsListBoxModel<StandardListBoxModel, > StandardCredentials> model = new StandardListBoxModel(); > if (allowEmpty) { > model = model.includeEmptyValue(); > } > if (context == null || !context.hasPermission(CredentialsProvider.VIEW)) { > return model; > } > model = model.includeMatchingAs(ACL.SYSTEM, context, > StringCredentials.class, Collections.emptyList(), > CredentialsMatchers.always()); > return model; > } > > > While ACL.SYSTEM says to use ACL.SYSTEM2 instead, that is of a different > type, and there are no overloads on the list box model that accept it. > > So I have two questions: > 1) Was this the correct way of doing this to begin with, or should I have > been getting a user-specific credential list? > 2) What is the new way of doing this, using the Spring Security types? I > don't see any use of the spring security packages, so I guess the > credentials plugin just hasn't been updated yet? > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--BpJWaeY-4Ghf4coF6RuTMJjpnLJXSWcCkSxh1wf%2BygaA%40mail.gmail.com > <https://groups.google.com/d/msgid/jenkinsci-dev/CAKMi--BpJWaeY-4Ghf4coF6RuTMJjpnLJXSWcCkSxh1wf%2BygaA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_DuuWqhhnWU2DOc22dpM0ofQALgaT3p9h5mGxzdH8CzXkAQ%40mail.gmail.com.
