Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no corresponding backend roles user can update model issue #909

Conversation

zane-neo
Copy link
Collaborator

Description

[Describe what this change achieves]

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

if (hasAccessControlChange(input) && !modelAccessControlHelper.isOwner(mlModelGroup.getOwner(), user)) {
throw new IllegalArgumentException("Only owner has valid privilege to perform update access control data");
if (hasAccessControlChange(input)) {
if (!modelAccessControlHelper.isOwner(mlModelGroup.getOwner(), user)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also consider admin?

ylwu-amzn
ylwu-amzn previously approved these changes May 24, 2023
…ccess identifier to model access mode

Signed-off-by: Zan Niu <[email protected]>
} else if ((ModelAccessIdentifier.PUBLIC == modelAccessIdentifier || ModelAccessIdentifier.PRIVATE == modelAccessIdentifier)
if (modelAccessMode == null) {
if (!Boolean.TRUE.equals(isAddAllBackendRoles) && CollectionUtils.isEmpty(input.getBackendRoles())) {
throw new IllegalArgumentException("User must specify at least one backend role or make the model public/private");
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do not specify any access fields, the default should be private actually, not throw exception

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think let user aware of this need more time, explicitly specify the model mode to private would be easy to understand and less confuse to user, let's make this explicit, if there's callout from user, we can change the behavior.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah should be fine then

@zane-neo zane-neo merged commit 4345954 into opensearch-project:model-access-control-dev May 24, 2023
b4sjoo pushed a commit to b4sjoo/ml-commons that referenced this pull request May 30, 2023
…earch-project#909)

* Fix no corresponding backend roles user can update model issue

Signed-off-by: Zan Niu <[email protected]>

* Remove private model check and merge this case into has backend role check

Signed-off-by: Zan Niu <[email protected]>

* Add admin check for access control change to make admin pass

Signed-off-by: Zan Niu <[email protected]>

* Change model access mode not mandatory in registering, rename model access identifier to model access mode

Signed-off-by: Zan Niu <[email protected]>

---------

Signed-off-by: Zan Niu <[email protected]>
b4sjoo pushed a commit to b4sjoo/ml-commons that referenced this pull request May 30, 2023
…earch-project#909)

* Fix no corresponding backend roles user can update model issue

Signed-off-by: Zan Niu <[email protected]>

* Remove private model check and merge this case into has backend role check

Signed-off-by: Zan Niu <[email protected]>

* Add admin check for access control change to make admin pass

Signed-off-by: Zan Niu <[email protected]>

* Change model access mode not mandatory in registering, rename model access identifier to model access mode

Signed-off-by: Zan Niu <[email protected]>

---------

Signed-off-by: Zan Niu <[email protected]>
Signed-off-by: Sicheng Song <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants