Class GrantRequiredFailure
- All Implemented Interfaces:
Serializable,org.kohsuke.stapler.HttpResponse
Failure.
The advice depends on the refused user, and is decided when the refusal is built (in the
refused user's own request): a user who may open the Grants screen and request windows
(BatchControl/RequestGrant, change control on) is pointed at the new-request form
prefilled for the item and action; anyone else is told whom to ask, because the Grants screen
would answer 403 to them. Throwable.getMessage() carries the same advice as plain text for the
CLI and scripts; in a browser generateResponse(org.kohsuke.stapler.StaplerRequest2, org.kohsuke.stapler.StaplerResponse2, java.lang.Object, java.lang.Throwable) renders index.jelly, which
links the form only for the first kind of user. HTTP 400 like the Failure it replaces;
it never changes state.
D-71: when no window can allow the change at all — Delete of an item group that is not a job (a folder, a multibranch project, an organization folder), or Create in a group that is not a regular folder — nobody is pointed at the form (the request would be refused at submission); the page and the message say that an administrator has to make the change.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgenerateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object node) voidgenerateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object node, Throwable throwable) "Delete", "Configure" or "Create", for the page.The kind of the item in words, for example "Folder" or "Multibranch Pipeline".Root-relative URL of the new-request form prefilled for the item and action (batch-control/grants/new?scopeFullName=<item>&actions=<ACTION>), ornullwhen no window can allow the change.booleanWhether the refused user may request the window and a window can allow the change (D-71), so the page links the form.booleanisDelete()Whether the refused change is a delete (the page then says "delete (or move) it").booleanisGroup()Whether the item contains other items, for the page's wording of a refused delete.booleanWhether the item is part of a job (no window can name it), for the page's wording.booleanD-71: whether a permission window can allow the change at all.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.kohsuke.stapler.HttpResponse
generateResponse
-
Constructor Details
-
GrantRequiredFailure
- Parameters:
item- the item the refused change is about; for a refused Create, the folder the new item was to be created in (the window would name that folder)action- the permission window that would allow itchange- the refused change in words, for example "deleting" or "creating an item in"
-
-
Method Details
-
getItemFullName
-
getActionLabel
"Delete", "Configure" or "Create", for the page. -
isCanRequest
public boolean isCanRequest()Whether the refused user may request the window and a window can allow the change (D-71), so the page links the form. -
isWindowApplies
public boolean isWindowApplies()D-71: whether a permission window can allow the change at all.falsefor Delete of an item group that is not a job and for Create in a group that is not a regular folder: only an administrator can make such a change. -
isDelete
public boolean isDelete()Whether the refused change is a delete (the page then says "delete (or move) it"). -
getItemKindName
The kind of the item in words, for example "Folder" or "Multibranch Pipeline". -
isPartOfJob
public boolean isPartOfJob()Whether the item is part of a job (no window can name it), for the page's wording. -
isGroup
public boolean isGroup()Whether the item contains other items, for the page's wording of a refused delete. -
getRequestUrl
Root-relative URL of the new-request form prefilled for the item and action (batch-control/grants/new?scopeFullName=<item>&actions=<ACTION>), ornullwhen no window can allow the change. The Grants screen resolves the name again as the viewer, so nothing here is echoed unchecked. -
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object node, @CheckForNull Throwable throwable) throws IOException, jakarta.servlet.ServletException - Overrides:
generateResponsein classFailure- Throws:
IOExceptionjakarta.servlet.ServletException
-
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object node) throws IOException, jakarta.servlet.ServletException - Specified by:
generateResponsein interfaceorg.kohsuke.stapler.HttpResponse- Overrides:
generateResponsein classFailure- Throws:
IOExceptionjakarta.servlet.ServletException
-