", tooltip, symbol, user);
}
static FormValidation validateGroup(String groupName, SecurityRealm sr, boolean ambiguous) {
@@ -72,20 +117,29 @@ static FormValidation validateGroup(String groupName, SecurityRealm sr, boolean
try {
sr.loadGroupByGroupname2(groupName, false);
if (ambiguous) {
- return FormValidation.warningWithMarkup(formatUserGroupValidationResponse(
- "user",
- escapedSid,
- "Group found; but permissions would also be granted to a user of this name"));
+ return FormValidation.respond(
+ FormValidation.Kind.WARNING,
+ formatUserGroupValidationResponse(
+ GROUP,
+ escapedSid,
+ "Group found; but permissions would also be granted to a user of this name",
+ true));
} else {
- return FormValidation.okWithMarkup(formatUserGroupValidationResponse("user", escapedSid, "Group"));
+ return FormValidation.respond(
+ FormValidation.Kind.OK, formatUserGroupValidationResponse(GROUP, escapedSid, "Group"));
}
} catch (UserMayOrMayNotExistException2 e) {
// undecidable, meaning the group may exist
if (ambiguous) {
- return FormValidation.warningWithMarkup(formatUserGroupValidationResponse(
- "user", escapedSid, "Permissions would also be granted to a user or group of this name"));
+ return FormValidation.respond(
+ FormValidation.Kind.WARNING,
+ formatUserGroupValidationResponse(
+ GROUP,
+ escapedSid,
+ "Permissions would also be granted to a user or group of this name",
+ true));
} else {
- return FormValidation.ok(groupName);
+ return FormValidation.ok(escapedSid);
}
} catch (UsernameNotFoundException e) {
// fall through next
@@ -104,29 +158,43 @@ static FormValidation validateUser(String userName, SecurityRealm sr, boolean am
if (userName.equals(u.getFullName())) {
// Sid and full name are identical, no need for tooltip
if (ambiguous) {
- return FormValidation.warningWithMarkup(formatUserGroupValidationResponse(
- "person",
- escapedSid,
- "User found; but permissions would also be granted to a group of this name"));
+ return FormValidation.respond(
+ FormValidation.Kind.WARNING,
+ formatUserGroupValidationResponse(
+ USER,
+ escapedSid,
+ "User found; but permissions would also be granted to a group of this name",
+ true));
} else {
- return FormValidation.okWithMarkup(formatUserGroupValidationResponse("person", escapedSid, "User"));
+ return FormValidation.respond(
+ FormValidation.Kind.OK, formatUserGroupValidationResponse(USER, escapedSid, "User"));
}
}
if (ambiguous) {
- return FormValidation.warningWithMarkup(formatUserGroupValidationResponse(
- "person",
- Util.escape(StringUtils.abbreviate(u.getFullName(), 50)),
- "User " + escapedSid
- + " found, but permissions would also be granted to a group of this name"));
+ return FormValidation.respond(
+ FormValidation.Kind.WARNING,
+ formatUserGroupValidationResponse(
+ USER,
+ Util.escape(StringUtils.abbreviate(u.getFullName(), 50)),
+ "User " + escapedSid
+ + " found; but permissions would also be granted to a group of this name",
+ true));
} else {
- return FormValidation.okWithMarkup(formatUserGroupValidationResponse(
- "person", Util.escape(StringUtils.abbreviate(u.getFullName(), 50)), "User " + escapedSid));
+ return FormValidation.respond(
+ FormValidation.Kind.OK,
+ formatUserGroupValidationResponse(
+ USER, Util.escape(StringUtils.abbreviate(u.getFullName(), 50)), "User " + escapedSid));
}
} catch (UserMayOrMayNotExistException2 e) {
// undecidable, meaning the user may exist
if (ambiguous) {
- return FormValidation.warningWithMarkup(formatUserGroupValidationResponse(
- "person", escapedSid, "Permissions would also be granted to a user or group of this name"));
+ return FormValidation.respond(
+ FormValidation.Kind.WARNING,
+ formatUserGroupValidationResponse(
+ EITHER,
+ escapedSid,
+ "Permissions would also be granted to a user or group of this name",
+ true));
} else {
return FormValidation.ok(userName);
}
diff --git a/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly b/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly
index 845c52d7..a054cdd3 100644
--- a/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly
+++ b/src/main/resources/hudson/security/GlobalMatrixAuthorizationStrategy/config.jelly
@@ -60,16 +60,16 @@ THE SOFTWARE.