Class CredentialsSelectHelper
- java.lang.Object
-
- hudson.model.Descriptor<CredentialsSelectHelper>
-
- com.cloudbees.plugins.credentials.CredentialsSelectHelper
-
- All Implemented Interfaces:
Describable<CredentialsSelectHelper>
,Saveable
,OnMaster
@Extension public class CredentialsSelectHelper extends Descriptor<CredentialsSelectHelper> implements Describable<CredentialsSelectHelper>
A descriptor used to assist the c:select tag with allowing in-place addition of credentials.- Author:
- Stephen Connolly
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
-
Field Summary
Fields Modifier and Type Field Description static Permission
CREATE
Expose theCredentialsProvider.CREATE
permission for Jelly.-
Fields inherited from class hudson.model.Descriptor
clazz
-
-
Constructor Summary
Constructors Constructor Description CredentialsSelectHelper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CredentialsSelectHelper
getDescriptor()
String
getDisplayName()
static Map<String,CredentialsProvider>
getProvidersByName()
Returns a map of theCredentialsProvider
instances keyed by their name.CredentialsSelectHelper.WrappedContextResolver
getResolver(String className)
Stapler binding for the resolver URL segment.static Map<String,CredentialsSelectHelper.ContextResolver>
getResolversByName()
Returns a map of theCredentialsSelectHelper.ContextResolver
instances keyed by their name.List<CredentialsSelectHelper.StoreItem>
getStoreItems(ModelObject context, boolean includeUser)
Returns theCredentialsSelectHelper.StoreItem
instances for the current Stapler request.boolean
hasCreatePermission(ModelObject context, boolean includeUser)
Checks if the current user has permission to create a credential.ModelObject
resolveContext(Object context)
Fixes up the context in case we are called from a page where the context is not a ModelObject.static CredentialsStore
resolveForCLI(String storeId)
Resolves aCredentialsStore
instance for CLI commands.-
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, configure, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Field Detail
-
CREATE
public static final Permission CREATE
Expose theCredentialsProvider.CREATE
permission for Jelly.
-
-
Method Detail
-
getDescriptor
public CredentialsSelectHelper getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<CredentialsSelectHelper>
-
getDisplayName
@NonNull public String getDisplayName()
- Overrides:
getDisplayName
in classDescriptor<CredentialsSelectHelper>
-
resolveContext
@CheckForNull @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public ModelObject resolveContext(Object context)
Fixes up the context in case we are called from a page where the context is not a ModelObject.- Parameters:
context
- the initial guess of the context.- Returns:
- the resolved context.
- Since:
- 2.0.7
-
getStoreItems
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<CredentialsSelectHelper.StoreItem> getStoreItems(ModelObject context, boolean includeUser)
Returns theCredentialsSelectHelper.StoreItem
instances for the current Stapler request.- Parameters:
context
- the context in which to retrieve the store items.includeUser
-true
to also include any User scoped stores.- Returns:
- the
CredentialsSelectHelper.StoreItem
instances for the current Stapler request. - Since:
- 2.0.5
-
hasCreatePermission
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean hasCreatePermission(ModelObject context, boolean includeUser)
Checks if the current user has permission to create a credential.- Parameters:
context
- the context.includeUser
- whether they can use their own credentials store.- Returns:
true
if they can create a permission.- Since:
- FIXME
-
getResolver
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public CredentialsSelectHelper.WrappedContextResolver getResolver(String className)
Stapler binding for the resolver URL segment.- Parameters:
className
- the class name of the resolver.- Returns:
- the wrapped resolver.
- Since:
- 2.0
-
resolveForCLI
@CLIResolver public static CredentialsStore resolveForCLI(String storeId) throws org.kohsuke.args4j.CmdLineException
Resolves aCredentialsStore
instance for CLI commands.- Parameters:
storeId
- the store identifier.- Returns:
- the
CredentialsStore
instance. - Throws:
org.kohsuke.args4j.CmdLineException
- if the store cannot be resolved.- Since:
- 2.1.1
-
getResolversByName
public static Map<String,CredentialsSelectHelper.ContextResolver> getResolversByName()
Returns a map of theCredentialsSelectHelper.ContextResolver
instances keyed by their name. A resolver may have more than one entry if there are inferred unique short nicknames.- Returns:
- a map of the
CredentialsSelectHelper.ContextResolver
instances keyed by their name - Since:
- 2.1.1
-
getProvidersByName
public static Map<String,CredentialsProvider> getProvidersByName()
Returns a map of theCredentialsProvider
instances keyed by their name. A provider may have more than one entry if there are inferred unique short nicknames.- Returns:
- a map of the
CredentialsProvider
instances keyed by their name - Since:
- 2.1.1
-
-