Class GrantRequest
java.lang.Object
io.jenkins.plugins.batchcontrol.model.GrantRequest
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public final class GrantRequest
extends Object
A request for a temporary (JIT) change permission (SPEC item 8, section 3).
Persisted as XStream XML at
requests/grant/<id>.xml.
Timestamps are persisted as epoch milliseconds (long) because the Jenkins XStream
class filter does not allow java.time.Instant; the accessors expose Instant.
Status transitions must only be performed by the policy services
(policy.GrantRequestService); other code must not call setStatus(io.jenkins.plugins.batchcontrol.model.RequestStatus).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne approver change entry of a grant request: (previous set, new set, changed by, at) (SPEC section 3, D-37). -
Method Summary
Modifier and TypeMethodDescriptionvoidOnly the policy services record approver changes.static GrantRequestcreate(GrantScope scope, ItemKind itemKind, List<GrantAction> actions, int durationMinutes, String reason, String requester, List<String> approvers, String createNamePattern) Creates a new PENDING grant request with a random UUID id (D-68) and its creation time fromBatchClock, recording the kind of the scope item (D-71).static GrantRequestcreate(GrantScope scope, List<GrantAction> actions, int durationMinutes, String reason, String requester, String approver) Single-approver form without a name restriction, kept for callers written before D-37.static GrantRequestcreate(GrantScope scope, List<GrantAction> actions, int durationMinutes, String reason, String requester, List<String> approvers, String createNamePattern) Ascreate(GrantScope, ItemKind, List, int, String, String, List, String)without an item kind.A defensive copy; the requested actions never change after creation.Compatibility view (D-37): the first designated approver, ornullwith none.The designated approver set (D-37), in designation order.D-40: the CREATE name restriction as written (/regex/or exact name), ornull.The user who closed the request: the approver who approved or rejected it, or the user who cancelled it (e2e-03 DEF-13);nullwhile undecided.intgetId()D-71: the kind of the scope item recorded at creation, ornullwhen none was recorded.getScope()booleanisDesignatedApprover(String userId) WhetheruserIdis a member of the designated set.booleanWhether the D-36 EXPIRING notification was already sent.voidsetApprovers(List<String> approvers) Only the policy services change the designated set.voidsetDecidedAt(Instant decidedAt) voidsetDecidedBy(String decidedBy) Only the policy services record the deciding approver.voidsetDecisionComment(String decisionComment) voidsetExpiringNotified(boolean expiringNotified) Only the policy services mark the D-36 EXPIRING notification as sent.voidsetStatus(RequestStatus status) Only the policy services may transition the status.
-
Method Details
-
create
public static GrantRequest create(GrantScope scope, ItemKind itemKind, List<GrantAction> actions, int durationMinutes, String reason, String requester, List<String> approvers, String createNamePattern) Creates a new PENDING grant request with a random UUID id (D-68) and its creation time fromBatchClock, recording the kind of the scope item (D-71). Duplicate actions are collapsed while preserving order. -
create
public static GrantRequest create(GrantScope scope, List<GrantAction> actions, int durationMinutes, String reason, String requester, List<String> approvers, String createNamePattern) Ascreate(GrantScope, ItemKind, List, int, String, String, List, String)without an item kind. Such a request cannot be approved (D-71); kept for store fixtures. -
create
public static GrantRequest create(GrantScope scope, List<GrantAction> actions, int durationMinutes, String reason, String requester, String approver) Single-approver form without a name restriction, kept for callers written before D-37. -
getId
-
getScope
-
getItemKind
D-71: the kind of the scope item recorded at creation, ornullwhen none was recorded. -
getActions
A defensive copy; the requested actions never change after creation. -
getDurationMinutes
public int getDurationMinutes() -
getReason
-
getRequester
-
getApprovers
The designated approver set (D-37), in designation order. -
getApprover
Compatibility view (D-37): the first designated approver, ornullwith none. -
isDesignatedApprover
WhetheruserIdis a member of the designated set. -
getDecidedBy
The user who closed the request: the approver who approved or rejected it, or the user who cancelled it (e2e-03 DEF-13);nullwhile undecided. -
getCreateNamePattern
D-40: the CREATE name restriction as written (/regex/or exact name), ornull. -
getApproverChanges
-
isExpiringNotified
public boolean isExpiringNotified()Whether the D-36 EXPIRING notification was already sent. -
getStatus
-
getCreatedAt
-
getDecidedAt
-
getDecisionComment
-
setStatus
Only the policy services may transition the status. -
setDecidedAt
-
setDecisionComment
-
setApprovers
Only the policy services change the designated set. -
setDecidedBy
Only the policy services record the deciding approver. -
addApproverChange
Only the policy services record approver changes. -
setExpiringNotified
public void setExpiringNotified(boolean expiringNotified) Only the policy services mark the D-36 EXPIRING notification as sent.
-