-
Notifications
You must be signed in to change notification settings - Fork 2
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
Conversation
@@ -160,6 +163,12 @@ export default function AddService({ | |||
newFiles = filesEncrypted | |||
} | |||
|
|||
const credentials = generateCredentials( | |||
undefined, |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
@@ -169,6 +178,7 @@ export default function AddService({ | |||
datatokenAddress, | |||
serviceEndpoint: values.providerUrl.url, | |||
timeout: mapTimeoutStringToSeconds(values.timeout), | |||
credentials, | |||
...(values.access === 'compute' && { |
There was a problem hiding this comment.
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' && { |
There was a problem hiding this comment.
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' && { |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@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. |
Fixes #17
What was done?
ocean-node support was done here OceanProtocolEnterprise/ocean-node#12 and here oceanprotocol/ocean-node#698