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

Edit service access control #47

Merged
merged 2 commits into from
Nov 14, 2024

Conversation

FilipMasar
Copy link

@FilipMasar FilipMasar commented Sep 19, 2024

Fixes #17

What was done?

ocean-node support was done here OceanProtocolEnterprise/ocean-node#12 and here oceanprotocol/ocean-node#698

@FilipMasar FilipMasar requested a review from a team as a code owner September 19, 2024 11:02
@FilipMasar FilipMasar changed the title Edit service access control Edit service access control - DO NOT MERGE YET Sep 19, 2024
@@ -160,6 +163,12 @@ export default function AddService({
newFiles = filesEncrypted
}

const credentials = generateCredentials(
undefined,

Choose a reason for hiding this comment

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

Usually optional parameters should be last

Copy link
Author

Choose a reason for hiding this comment

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

I am thinking what to do about it, but perhaps it's best to just keep it like that. It is used like that even in the code that I haven't changed e.g. here https://github.com/OceanProtocolEnterprise/market/blob/main/src/components/Publish/_utils.ts#L242
LMK what you think

@FilipMasar FilipMasar changed the title Edit service access control - DO NOT MERGE YET Edit service access control Nov 8, 2024
@@ -169,6 +178,7 @@ export default function AddService({
datatokenAddress,
serviceEndpoint: values.providerUrl.url,
timeout: mapTimeoutStringToSeconds(values.timeout),
credentials,
...(values.access === 'compute' && {

Choose a reason for hiding this comment

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

should we use enums, to not have string encoded?

const updatedService: Service = {
...service,
name: values.name,
description: values.description,
type: values.access,
timeout: mapTimeoutStringToSeconds(values.timeout),
files: updatedFiles, // TODO: check if this works
files: updatedFiles, // TODO: check if this works,
credentials,
...(values.access === 'compute' && {

Choose a reason for hiding this comment

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

same here. enums?

const updatedService: Service = {
...service,
name: values.name,
description: values.description,
timeout: mapTimeoutStringToSeconds(values.timeout),
files: updatedFiles, // TODO: check if this works
files: updatedFiles, // TODO: check if this works,
credentials: updatedCredentials,
...(values.access === 'compute' && {

Choose a reason for hiding this comment

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

same

@@ -105,6 +107,14 @@ export const getServiceInitialValues = (
timeout: secondsToString(service.timeout),
usesConsumerParameters: service.consumerParameters?.length > 0,
consumerParameters: parseConsumerParameters(service.consumerParameters),
allow:
service.credentials?.allow?.find(
(credential) => credential.type === 'address'

Choose a reason for hiding this comment

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

maybe enum?

Copy link

@AdriGeorge AdriGeorge left a comment

Choose a reason for hiding this comment

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

lgtm

@FilipMasar
Copy link
Author

@AdriGeorge its a good idea to use enums as you pointed out in your comments. But I think it is out of scope of this PR. If I start changing it, it would effect many other files.

@FilipMasar FilipMasar merged commit 4055495 into ocean-node Nov 14, 2024
@FilipMasar FilipMasar deleted the feature/edit-service-access-control branch November 14, 2024 12:04
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