mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #951 from oceanprotocol/issue-950-fix-allow-deny
Issue 950 fix allow deny
This commit is contained in:
commit
5f1feb4d53
@ -7,7 +7,7 @@ export type CredentialAction = 'allow' | 'deny'
|
||||
|
||||
export interface Credential {
|
||||
type: CredentialType
|
||||
value: string[]
|
||||
values: string[]
|
||||
}
|
||||
|
||||
export interface Credentials {
|
||||
|
@ -340,7 +340,7 @@ export class Assets extends Instantiable {
|
||||
const allowList = ddo.credentials.allow.find(
|
||||
(credentail) => credentail.type === credentialType
|
||||
)
|
||||
if (allowList && !allowList.value.includes(value)) {
|
||||
if (allowList && !allowList.values.includes(value)) {
|
||||
status = 2
|
||||
message = 'Access is denied, your wallet address is not found on allow list'
|
||||
result = false
|
||||
@ -350,7 +350,7 @@ export class Assets extends Instantiable {
|
||||
const denyList = ddo.credentials.deny.find(
|
||||
(credentail) => credentail.type === credentialType
|
||||
)
|
||||
if (denyList && denyList.value.includes(value)) {
|
||||
if (denyList && denyList.values.includes(value)) {
|
||||
status = 3
|
||||
message = 'Access is denied, your wallet address is found on deny list'
|
||||
result = false
|
||||
|
@ -24,7 +24,7 @@ export function checkCredentialExist(
|
||||
const allowList = credentials.allow.find(
|
||||
(credential) => credential.type === credentialType
|
||||
)
|
||||
isExist = allowList && allowList.value.length > 0
|
||||
isExist = allowList && allowList.values.length > 0
|
||||
}
|
||||
return isExist
|
||||
} else {
|
||||
@ -32,7 +32,7 @@ export function checkCredentialExist(
|
||||
const dennyList = credentials.deny.find(
|
||||
(credential) => credential.type === credentialType
|
||||
)
|
||||
isExist = dennyList && dennyList.value.length > 0
|
||||
isExist = dennyList && dennyList.values.length > 0
|
||||
}
|
||||
return isExist
|
||||
}
|
||||
@ -97,7 +97,7 @@ export function updateCredentialDetail(
|
||||
if (exists) {
|
||||
ddo.credentials.allow.find((credential) => {
|
||||
if (credential.type === credentialType) {
|
||||
credential.value = list
|
||||
credential.values = list
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -107,7 +107,7 @@ export function updateCredentialDetail(
|
||||
if (exists) {
|
||||
ddo.credentials.deny.find((credential) => {
|
||||
if (credential.type === credentialType) {
|
||||
credential.value = list
|
||||
credential.values = list
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ export function addCredentialDetail(
|
||||
) {
|
||||
const newCredentialDetail: Credential = {
|
||||
type: credentialType,
|
||||
value: list
|
||||
values: list
|
||||
}
|
||||
if (credentialAction === 'allow') {
|
||||
if (ddo.credentials && ddo.credentials.allow) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user