public final class ApprovalContext extends Object
DataBoundConstructor
, be sure to use withCurrentUser()
.
Also use withItem(hudson.model.Item)
or withKey(java.lang.String)
or withItemAsKey(hudson.model.Item)
whenever possible.Modifier and Type | Method and Description |
---|---|
static ApprovalContext |
create()
Creates a new context with no information.
|
Item |
getItem()
Gets any associated item which should be displayed to an administrator.
|
String |
getKey()
Gets the unique key, if any.
|
String |
getUser()
Gets the associated user ID, if any.
|
ApprovalContext |
withCurrentUser()
Creates a context with the user associated with the current thread.
|
ApprovalContext |
withItem(Item item)
Associates an item with this approval, used only for display purposes.
|
ApprovalContext |
withItemAsKey(Item item)
Associates an item with this approval for display, as well as setting a unique key
based on the
Item.getFullName() which would cancel any previous approvals for the same item. |
ApprovalContext |
withKey(String key)
Associates a unique key with this approval.
|
ApprovalContext |
withUser(String user)
Creates a context with a specified user ID.
|
public static ApprovalContext create()
public ApprovalContext withUser(@CheckForNull String user)
ACL.SYSTEM
is automatically ignored.)public ApprovalContext withCurrentUser()
ACL.SYSTEM
is automatically ignored, but the user might be Jenkins.ANONYMOUS
.)public ApprovalContext withItem(@CheckForNull Item item)
@CheckForNull public Item getItem()
public ApprovalContext withKey(@CheckForNull String key)
@CheckForNull public String getKey()
public ApprovalContext withItemAsKey(@CheckForNull Item item)
Item.getFullName()
which would cancel any previous approvals for the same item.
Note that this only makes sense in cases where it is guaranteed that at most one approvable script
is configured on a given item, so do not use this with (for example) build steps.Copyright © 2016–2023. All rights reserved.