Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@

<properties>
<changelist>999999-SNAPSHOT</changelist>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<jenkins.baseline>2.555</jenkins.baseline>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for setting-subpage

<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<checkstyle.version>13.0.0</checkstyle.version>
<hpi.compatibleSinceVersion>640</hpi.compatibleSinceVersion>
Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>5054.v620b_5d2b_d5e6</version>
<version>6453.v115ff6f496dd</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,87 +22,48 @@
- THE SOFTWARE.
-->
<?jelly escape-by-default='true'?>
<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" xmlns:local="local">
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<j:set var="header">
<l:view>
<l:app-bar title="${%Macros}"/>
<p class="jenkins-page-description">
Macros extend access rights analysis and are used in the role field.
</p>
<p class="jenkins-!-margin-bottom-3" style="color:var(--text-color-secondary);font-size:0.875rem;">
Format:
<code>@macroName[:id][(param1, param2)]</code>
— e.g. <code>@BuildableJob</code>, <code>@BuildableJob:1</code>,
<code>@Folder(folderName)</code>
</p>
</l:view>
</j:set>
<l:settings-subpage title="${%Macros}" permissions="${it.strategy.SYSTEM_READ_AND_SOME_ROLES_ADMIN}" noDefer="true"
includeBreadcrumb="true" header="${header}">
<link rel="stylesheet" href="${rootURL}/plugin/role-strategy/css/role-strategy.css" type="text/css"/>

<d:taglib uri="local">
<!--
-
- Parameters:
- tableId - table id
- extensions - List of macro extensions
-->
<d:tag name="roleMacroTable">
<j:invoke var="items" method="${attrs.getmethod}" on="${it}"/>
<table id="${attrs.tableId}" class="jenkins-table role-strategy-table jenkins-table--auto-width">
<thead>
<tr name="Caption">
<th rowspan="2" class="rsp-table__header-column">
${%Name}
</th>
<th colspan="3" class="rsp-table__header-column rsp-table--header-th first last">
${%Applicable Role Types}
</th>
<th rowspan="2" class="rsp-table__header-column">
${%Description}
</th>
</tr>
<!--Second header row-->
<tr name="Caption">
<th class="rsp-table__header-column rsp-table--header-th">GLOBAL</th>
<th class="rsp-table__header-column rsp-table--header-th">ITEM</th>
<th class="rsp-table__header-column rsp-table--header-th">AGENT</th>
</tr>
</thead>
<tbody>
<j:forEach var="macroExt" items="${items}">
<tr name="test" class="permission-row">
<td>${macroExt.getName()}</td>
<td>${macroExt.IsApplicable(it.globalRoleType)}</td>
<td>${macroExt.IsApplicable(it.projectRoleType)}</td>
<td>${macroExt.IsApplicable(it.slaveRoleType)}</td>
<td><j:out value="${macroExt.getDescription()}"/></td>
</tr>
</j:forEach>
</tbody>
</table>
</d:tag>
</d:taglib>

<l:layout title="${%Role-Strategy Macros Info}" permissions="${it.strategy.SYSTEM_READ_AND_SOME_ROLES_ADMIN}" norefresh="true">
<l:breadcrumb title="Macros"/>
<st:include page="sidepanel.jelly"/>

<l:main-panel>
<link rel="stylesheet" href="${rootURL}/plugin/role-strategy/css/role-strategy.css" type="text/css" />

<h1>
${%Role-Strategy Macros Info}
</h1>
<p>Macros allow to extend the analysis of user access rights (see @RoleMacroExtension).
If a user's sid meets criteria in Roles and Assignments, then analysis will be propagated to the extension,
which makes decisions according to instance and parameters.
</p>
<h2>${%Macro usage}</h2>
<div>
Macro format: @<b>macroName</b>[:<b>id</b>][(parameter1, parameter2, ...)]>
<ul>
<li>macroName - name of the macro (see available macros in the table below)</li>
<li>id - identifier of the macro. Technical parameter, which allows to use the same macro for multiple patterns</li>
<li>parameter - additional parameters. At the current state, they don't support variables or TokenMacros</li>
</ul>

<p>Macro string examples:</p>
<ul>
<li>@BuildableJob - Primitive macro invocation. Such invocation can be used only once in each roles category.</li>
<li>@BuildableJob:1 - Macro with id</li>
<li>@ParameterizedMacro(param1) - Invokes macro with one parameter</li>
<li>@ParameterizedMacro:2(param1,param2) - Invokes macro with two parameters. Id prevents naming conflicts</li>
</ul>
</div>
<h2>${%Available Macros}</h2>
<p>The listed macros can be used in the "Role" field of the "Manage Roles" page.</p>
<local:roleMacroTable getmethod="getRoleMacroExtensions"/>
</l:main-panel>
</l:layout>
<j:invoke var="macros" method="getRoleMacroExtensions" on="${it}"/>

<div class="rsp-cards">
<j:forEach var="macroExt" items="${macros}">
<div class="rsp-card rsp-card--read-only" data-macro-name="${macroExt.getName()}">
<div class="rsp-card__header">
<span class="rsp-card__name">@${macroExt.getName()}</span>
<j:if test="${macroExt.IsApplicable(it.globalRoleType)}">
<span class="rsp-card__template-badge">Global</span>
</j:if>
<j:if test="${macroExt.IsApplicable(it.projectRoleType)}">
<span class="rsp-card__template-badge">Item</span>
</j:if>
<j:if test="${macroExt.IsApplicable(it.slaveRoleType)}">
<span class="rsp-card__template-badge">Agent</span>
</j:if>
<span class="rsp-card__summary">
<j:out value="${macroExt.getDescription()}"/>
</span>
</div>
</div>
</j:forEach>
</div>

</l:settings-subpage>
</j:jelly>
94 changes: 87 additions & 7 deletions src/main/webapp/css/role-strategy.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,86 @@
* THE SOFTWARE.
*/

/* ============================================
Cards
============================================ */

.rsp-cards {
display: flex;
flex-direction: column;
}

.rsp-card {
border: var(--jenkins-border);
border-radius: var(--form-input-border-radius);
background: var(--card-background);
overflow: hidden;
}

/* Connected borders: adjacent cards share an edge, flat between them. */
.rsp-card + .rsp-card {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top: none;
}

.rsp-card:has(+ .rsp-card) {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}

/* ============================================
Card Header
============================================ */

.rsp-card__header {
display: flex;
flex-wrap: nowrap;
align-items: center;
gap: 0.75rem;
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
min-width: 0;
transition: background var(--standard-transition);
}

.rsp-card__header:hover {
background: var(--item-background--hover);
}

.rsp-card__header:active {
background: var(--item-background--active);
}

.rsp-card__name {
font-weight: var(--font-bold-weight);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 1;
min-width: 0;
color: var(--text-color);
}

.rsp-card__template-badge {
font-size: 0.75rem;
padding: 0.125rem 0.375rem;
border-radius: 0.25rem;
background: var(--item-background--hover);
color: var(--text-color-secondary);
white-space: nowrap;
flex-shrink: 0;
}

.rsp-card__summary {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
color: var(--text-color-secondary);
font-size: 0.875rem;
}

/* Legacy styles */
.role-strategy-table {
border-spacing: 2px;
}
Expand Down Expand Up @@ -131,8 +211,8 @@ label.attach-previous {
}

.jenkins-checkbox {
vertical-align: middle;
margin: 3px 0px;
vertical-align: middle;
margin: 3px 0px;
}

@keyframes highlightentry {
Expand All @@ -147,12 +227,12 @@ label.attach-previous {
}

.jenkins-alert {
margin-top: 10px;
margin-top: 10px;
}

.rsp-entry-not-found {
text-decoration: line-through;
color: grey;
text-decoration: line-through;
color: grey;
}

.rsp-table__icon-alert {
Expand Down Expand Up @@ -185,7 +265,7 @@ button.migrate {
}

.patternAnchor:hover {
text-decoration: var(--link-text-decoration--hover);
text-decoration: var(--link-text-decoration--hover);
}

.row-filter, .user-filter, .role-filter {
Expand All @@ -202,4 +282,4 @@ button.migrate {

.rsp-navigation__entries .jenkins-select {
max-width: 5rem;
}
}
Loading