forked from synopsys-arc-oss/ownership-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-28881] - Allow blocking ItemGroup inheritance
- Loading branch information
1 parent
8d1fd0e
commit 3589ce8
Showing
9 changed files
with
217 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
src/main/java/org/jenkinsci/plugins/ownership/config/InheritanceOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2016 Oleg Nenashev | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package org.jenkinsci.plugins.ownership.config; | ||
|
||
import com.synopsys.arc.jenkins.plugins.ownership.OwnershipPlugin; | ||
import com.synopsys.arc.jenkins.plugins.ownership.OwnershipPluginConfiguration; | ||
import com.synopsys.arc.jenkins.plugins.ownership.jobs.JobOwnerHelper; | ||
import hudson.Extension; | ||
import hudson.model.Describable; | ||
import hudson.model.Descriptor; | ||
import hudson.model.ItemGroup; | ||
import org.jenkinsci.plugins.ownership.model.folders.FolderOwnershipHelper; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
/** | ||
* Stores inheritance options for {@link OwnershipPlugin}. | ||
* This section is attached as an advanced section to {@link OwnershipPluginConfiguration}. | ||
* These options has been created | ||
* @author Oleg Nenashev | ||
* @since TODO | ||
*/ | ||
public class InheritanceOptions implements Describable<InheritanceOptions> { | ||
|
||
public static final InheritanceOptions DEFAULT = new InheritanceOptions(false); | ||
|
||
private final boolean blockInheritanceFromItemGroups; | ||
|
||
@DataBoundConstructor | ||
public InheritanceOptions(boolean blockInheritanceFromItemGroups) { | ||
this.blockInheritanceFromItemGroups = blockInheritanceFromItemGroups; | ||
} | ||
|
||
/** | ||
* Blocks ownership inheritance from {@link ItemGroup}s. | ||
* This inheritance is used in {@link JobOwnerHelper} and {@link FolderOwnershipHelper} | ||
* in order to retrieve the info from parent folders. | ||
* Such inheritance may impact the performance of Jenkins instance, hence it is possible to disable it. | ||
* @return {@code true} if ownership inheritance should be blocked. | ||
*/ | ||
public boolean isBlockInheritanceFromItemGroups() { | ||
return blockInheritanceFromItemGroups; | ||
} | ||
|
||
@Extension | ||
public static final DescriptorImpl DESCRIPTOR = new DescriptorImpl(); | ||
|
||
@Override | ||
public DescriptorImpl getDescriptor() { | ||
return DESCRIPTOR; | ||
} | ||
|
||
public static class DescriptorImpl extends Descriptor<InheritanceOptions> { | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "N/A"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/resources/org/jenkinsci/plugins/ownership/config/InheritanceOptions/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
* The MIT License | ||
* | ||
* Copyright 2015 Oleg Nenashev | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
--> | ||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" | ||
xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> | ||
<f:advanced title="${%Ownership Inheritance Options}"> | ||
<f:entry title="" description=""> | ||
<table width="100%"> | ||
<f:entry field="blockInheritanceFromItemGroups"> | ||
<f:checkbox title="${%Block inheritance from item groups}"/> | ||
</f:entry> | ||
</table> | ||
</f:entry> | ||
</f:advanced> | ||
</j:jelly> |
13 changes: 13 additions & 0 deletions
13
...nsci/plugins/ownership/config/InheritanceOptions/help-blockInheritanceFromItemGroups.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div> | ||
<p> | ||
Blocks ownership inheritance from item groups like | ||
<a href="https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Folders+Plugin">Folders</a> or | ||
<a href="https://wiki.jenkins-ci.org/display/JENKINS/Multi-Branch+Project+Plugin">Multi-branch projects</a>. | ||
</p> | ||
<p> | ||
By default the plugin inherits ownership info from upper items. | ||
Such inheritance may impact the performance of the Jenkins instance (especially | ||
<a href="https://wiki.jenkins-ci.org/display/JENKINS/Ownership-Based+security">Ownership-based security</a>), | ||
hence it is possible to disable it. | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters