public class SpecificUsersAuthorizationStrategy extends AuthorizeProjectStrategy
Modifier and Type | Class and Description |
---|---|
static class |
SpecificUsersAuthorizationStrategy.DescriptorImpl
Our descriptor.
|
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
SpecificUsersAuthorizationStrategy(String userid) |
SpecificUsersAuthorizationStrategy(String userid,
boolean useApitoken,
String apitoken,
String password) |
Modifier and Type | Method and Description |
---|---|
Authentication |
authenticate(Job<?,?> project,
Queue.Item item)
Run builds as a specified user.
|
protected static SpecificUsersAuthorizationStrategy |
getCurrentStrategy(Job<?,?> project)
Return
SpecificUsersAuthorizationStrategy configured in a project. |
SpecificUsersAuthorizationStrategy.DescriptorImpl |
getDescriptor() |
String |
getUserid() |
boolean |
hasAuthorizationConfigurePermission(AccessControlled context)
Tests if the authorization can be configured by the current user.
|
boolean |
hasJobConfigurePermission(AccessControlled context)
Tests if the job can be reconfigured by the current user when this strategy is the configured strategy.
|
protected static boolean |
isAuthenticationRequired(String userId) |
boolean |
isDontRestrictJobConfiguration() |
protected Object |
readResolve()
If we are being deserialized outside of loading the initial jobs (or reloading) then we need to cross check
the strategy permissions to defend against somebody trying to push a configuration relating to a user other
than themselves.
|
void |
setDontRestrictJobConfiguration(boolean dontRestrictPermission) |
all, authenticate, checkAuthorizationConfigurePermission, checkJobConfigurePermission
public SpecificUsersAuthorizationStrategy(String userid)
@DataBoundConstructor public SpecificUsersAuthorizationStrategy(String userid, boolean useApitoken, String apitoken, String password) throws AccessDeniedException
AccessDeniedException
public String getUserid()
public boolean isDontRestrictJobConfiguration()
hasJobConfigurePermission(AccessControlled)
@DataBoundSetter public void setDontRestrictJobConfiguration(boolean dontRestrictPermission)
dontRestrictPermission
- whether not to restrict job configurationhasJobConfigurePermission(AccessControlled)
protected static boolean isAuthenticationRequired(String userId)
public SpecificUsersAuthorizationStrategy.DescriptorImpl getDescriptor()
AuthorizeProjectStrategy
getDescriptor
in interface Describable<AuthorizeProjectStrategy>
getDescriptor
in class AuthorizeProjectStrategy
public Authentication authenticate(Job<?,?> project, Queue.Item item)
authenticate
in class AuthorizeProjectStrategy
project
- item
- AuthorizeProjectStrategy.authenticate(hudson.model.Job, hudson.model.Queue.Item)
public boolean hasJobConfigurePermission(AccessControlled context)
Jenkins.ADMINISTER
permission skips this check.hasJobConfigurePermission
in class AuthorizeProjectStrategy
context
- the context of the jobtrue
if and only if the current user is allowed to reconfigure the specified job.public boolean hasAuthorizationConfigurePermission(AccessControlled context)
Jenkins.ADMINISTER
permission skips this check.hasAuthorizationConfigurePermission
in class AuthorizeProjectStrategy
context
- the context of the jobtrue
if and only if the current user is allowed to configure this authorization.protected static SpecificUsersAuthorizationStrategy getCurrentStrategy(Job<?,?> project)
SpecificUsersAuthorizationStrategy
configured in a project.project
- protected Object readResolve() throws ObjectStreamException
readResolve
in class AuthorizeProjectStrategy
this
ObjectStreamException
- if the object cannot be deserialized.AuthorizeProjectProperty.setStrategyCritical()
Copyright © 2016–2021. All rights reserved.