Skip to content

Commit 7255379

Browse files
authored
Add type prefix to duplicate user check for azure ad matrix (#473)
1 parent 4a0bc22 commit 7255379

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/main/resources/com/microsoft/jenkins/azuread/AzureAdMatrixAuthorizationStrategy/config.jelly

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ THE SOFTWARE.
191191
data-table-id="${id}"
192192
data-type="USER"
193193
data-type-label="${%user}"
194-
data-message-error="${%userError}"
194+
data-message-user-error="${%userError}"
195195
>${%Add user}</button>
196196
<button type="button" class="jenkins-button azure-ad-add-button" id="${id}GroupButton"
197197
data-table-id="${id}"
198198
data-type="GROUP"
199199
data-type-label="${%group}"
200-
data-message-error="${%groupError}"
200+
data-message-group-error="${%groupError}"
201201
>${%Add group}</button>
202202
</div>
203203
</j:when>
@@ -209,7 +209,8 @@ THE SOFTWARE.
209209
<button type="button" class="jenkins-button azure-ad-add-button" id="${id}button"
210210
data-table-id="${id}"
211211
data-message-empty="${%empty}"
212-
data-message-error="${%error}"
212+
data-message-user-error="${%userError}"
213+
data-message-group-error="${%groupError}"
213214
data-type-user-label="${%user}"
214215
data-type-group-label="${%user}"
215216
>${%Add}</button>

src/main/resources/com/microsoft/jenkins/azuread/Messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ AzureAdLogoutAction_DisplayName=Logged out
1414

1515
GlobalMatrixAuthorizationStrategy.PermissionImpliedBy=This permission is implied by {0}/{1}.
1616
GlobalMatrixAuthorizationStrategy.PermissionNotImpliedBy=This permission is <strong>not</strong> implied by Overall/Administer. It needs to be explicitly granted even to administrators.
17-
GlobalMatrixAuthorizationStrategy.DisplayName=Matrix-based security
17+
GlobalMatrixAuthorizationStrategy.DisplayName=Old AzureAD Matrix-based security (do not use)
1818

1919
AuthorizationMatrixNodeProperty_DisplayName=Enable node-based security
2020

src/main/resources/com/microsoft/jenkins/azuread/table.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ Behaviour.specify(".azure-ad-add-button", 'AzureAdMatrixAuthorizationStrategy',
4444
type = dataReference.getAttribute('data-type')
4545
}
4646

47-
if(findElementsBySelector(table,"TR").find(function(n){return n.getAttribute("name")=='['+name+']';})!=null) {
48-
alert(dataReference.getAttribute('data-message-error') + ": " + name);
47+
if (findElementsBySelector(table, "TR").find(function (n) {
48+
return n.getAttribute("name") === '[' + type + ':' + name + ']';
49+
}) != null) {
50+
alert(dataReference.getAttribute(`data-message-${type.toLowerCase()}-error`) + ": " + name);
4951
return;
5052
}
5153

0 commit comments

Comments
 (0)