-
Notifications
You must be signed in to change notification settings - Fork 251
Initial credentials implementation of experimental views #981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
09f6fda
1f84aa8
47b00c1
ee4d6a3
8a2adf6
2c98d36
005eaa0
f20d954
8bbb2b5
82a8a93
9c99862
e4651ea
ea98c49
13f3c91
03d5134
c479d81
f3d0c40
a001cab
dcf1b20
420d268
6402e53
b4128fe
59b2b3f
8bc1746
1993796
646f435
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,10 @@ | |
| @Restricted(NoExternalUse.class) | ||
| public class ManageCredentialsConfiguration extends ManagementLink { | ||
|
|
||
| public String getCategoryName() { | ||
| return "SECURITY"; | ||
| @NonNull | ||
| @Override | ||
| public Category getCategory() { | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cleanup while I was here |
||
| return Category.SECURITY; | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,10 +29,13 @@ | |
| import edu.umd.cs.findbugs.annotations.CheckForNull; | ||
| import edu.umd.cs.findbugs.annotations.NonNull; | ||
| import hudson.Extension; | ||
| import hudson.ExtensionList; | ||
| import hudson.model.Action; | ||
| import hudson.model.Actionable; | ||
| import hudson.model.Api; | ||
| import hudson.model.Item; | ||
| import hudson.model.ItemGroup; | ||
| import hudson.model.ManagementLink; | ||
| import hudson.model.ModelObject; | ||
| import hudson.model.RootAction; | ||
| import hudson.model.TopLevelItem; | ||
|
|
@@ -59,6 +62,7 @@ | |
| import jenkins.model.TransientActionFactory; | ||
| import org.jenkins.ui.icon.IconSpec; | ||
| import org.kohsuke.accmod.Restricted; | ||
| import org.kohsuke.accmod.restrictions.DoNotUse; | ||
| import org.kohsuke.accmod.restrictions.NoExternalUse; | ||
| import org.kohsuke.stapler.StaplerRequest2; | ||
| import org.kohsuke.stapler.StaplerResponse2; | ||
|
|
@@ -239,24 +243,36 @@ | |
| return false; | ||
| } | ||
|
|
||
| @Restricted(DoNotUse.class) // for jelly | ||
| public ManagementLink getManagementLink() { | ||
| return ExtensionList.lookupSingleton(ManageCredentialsConfiguration.class); | ||
| } | ||
|
|
||
| /** | ||
| * Administrator's view credentials from 'Manage Jenkins'. | ||
| * @param accessControlled an access controlled object. | ||
| * @return whether the action should be visible or not if the user is an administrator. | ||
| */ | ||
| private boolean isVisibleForAdministrator(AccessControlled accessControlled) { | ||
| return accessControlled instanceof Jenkins && accessControlled.hasPermission(Jenkins.ADMINISTER); | ||
| } | ||
|
|
||
| /** | ||
| * Expose a Jenkins {@link Api}. | ||
| * | ||
| * @return the {@link Api}. | ||
| */ | ||
| public Api getApi() { | ||
| return new Api(this); | ||
| } | ||
|
|
||
| public Actionable getObject() { | ||
|
||
| if (context instanceof Actionable actionable) { | ||
| return actionable; | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the credential entries. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,26 +25,21 @@ | |
| --> | ||
| <j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" | ||
| xmlns:f="/lib/form" xmlns:t="/lib/hudson"> | ||
| <l:layout title="${it.displayName}" permission="${app.ADMINISTER}"> | ||
| <st:include it="${app}" page="sidepanel"/> | ||
| <l:main-panel> | ||
| <h1>${it.displayName}</h1> | ||
| <p /> | ||
| <div class="behavior-loading">${%LOADING}</div> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no longer needed as system pages do this by default (noDefer to skip which is needed on |
||
| <f:form action="configure" method="post" name="config"> | ||
| <j:set var="instance" value="${it}"/> | ||
| <j:set var="descriptor" value="${it.descriptor}"/> | ||
| <j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigByDescriptor(it.FILTER)}"> | ||
| <j:set var="instance" value="${descriptor}"/> | ||
| <f:rowSet name="${descriptor.jsonSafeClassName}"> | ||
| <st:include from="${descriptor}" page="${descriptor.globalConfigPage}"/> | ||
| </f:rowSet> | ||
| </j:forEach> | ||
| <f:bottomButtonBar> | ||
| <f:submit value="${%Save}"/> | ||
| <f:apply/> | ||
| </f:bottomButtonBar> | ||
| </f:form> | ||
| </l:main-panel> | ||
| </l:layout> | ||
| <l:settings-subpage permission="${app.ADMINISTER}"> | ||
| <f:form action="configure" method="post" name="config"> | ||
| <j:set var="instance" value="${it}"/> | ||
| <j:set var="descriptor" value="${it.descriptor}"/> | ||
| <j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigByDescriptor(it.FILTER)}"> | ||
| <j:set var="instance" value="${descriptor}"/> | ||
| <f:rowSet name="${descriptor.jsonSafeClassName}"> | ||
| <st:include from="${descriptor}" page="${descriptor.globalConfigPage}"/> | ||
| </f:rowSet> | ||
| </j:forEach> | ||
| <f:bottomButtonBar> | ||
| <f:submit value="${%Save}"/> | ||
| <f:apply/> | ||
| </f:bottomButtonBar> | ||
| </f:form> | ||
| </l:settings-subpage> | ||
|
|
||
| </j:jelly> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
requires
noDeferfrom jenkinsci/jenkins#11333