Skip to content

Commit c93005f

Browse files
ylwu-amznrbhavna
andauthored
fix:admin with no backend role on AOS unable to create restricted model group (#1188) (#1218)
Signed-off-by: Bhavana Ramaram <[email protected]> Co-authored-by: Bhavana Ramaram <[email protected]>
1 parent a60eebc commit c93005f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

plugin/src/main/java/org/opensearch/ml/model/MLModelGroupManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ private void validateRequestForAccessControl(MLRegisterModelGroupInput input, Us
167167
if (modelAccessControlHelper.isAdmin(user) && Boolean.TRUE.equals(isAddAllBackendRoles)) {
168168
throw new IllegalArgumentException("Admin users cannot add all backend roles to a model group.");
169169
}
170-
if (CollectionUtils.isEmpty(user.getBackendRoles())) {
170+
if (!modelAccessControlHelper.isAdmin(user) && CollectionUtils.isEmpty(user.getBackendRoles())) {
171171
throw new IllegalArgumentException("You must have at least one backend role to register a restricted model group.");
172172
}
173173
if (CollectionUtils.isEmpty(input.getBackendRoles()) && !Boolean.TRUE.equals(isAddAllBackendRoles)) {

0 commit comments

Comments
 (0)