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 {
|
export interface Credential {
|
||||||
type: CredentialType
|
type: CredentialType
|
||||||
value: string[]
|
values: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Credentials {
|
export interface Credentials {
|
||||||
|
@ -340,7 +340,7 @@ export class Assets extends Instantiable {
|
|||||||
const allowList = ddo.credentials.allow.find(
|
const allowList = ddo.credentials.allow.find(
|
||||||
(credentail) => credentail.type === credentialType
|
(credentail) => credentail.type === credentialType
|
||||||
)
|
)
|
||||||
if (allowList && !allowList.value.includes(value)) {
|
if (allowList && !allowList.values.includes(value)) {
|
||||||
status = 2
|
status = 2
|
||||||
message = 'Access is denied, your wallet address is not found on allow list'
|
message = 'Access is denied, your wallet address is not found on allow list'
|
||||||
result = false
|
result = false
|
||||||
@ -350,7 +350,7 @@ export class Assets extends Instantiable {
|
|||||||
const denyList = ddo.credentials.deny.find(
|
const denyList = ddo.credentials.deny.find(
|
||||||
(credentail) => credentail.type === credentialType
|
(credentail) => credentail.type === credentialType
|
||||||
)
|
)
|
||||||
if (denyList && denyList.value.includes(value)) {
|
if (denyList && denyList.values.includes(value)) {
|
||||||
status = 3
|
status = 3
|
||||||
message = 'Access is denied, your wallet address is found on deny list'
|
message = 'Access is denied, your wallet address is found on deny list'
|
||||||
result = false
|
result = false
|
||||||
|
@ -24,7 +24,7 @@ export function checkCredentialExist(
|
|||||||
const allowList = credentials.allow.find(
|
const allowList = credentials.allow.find(
|
||||||
(credential) => credential.type === credentialType
|
(credential) => credential.type === credentialType
|
||||||
)
|
)
|
||||||
isExist = allowList && allowList.value.length > 0
|
isExist = allowList && allowList.values.length > 0
|
||||||
}
|
}
|
||||||
return isExist
|
return isExist
|
||||||
} else {
|
} else {
|
||||||
@ -32,7 +32,7 @@ export function checkCredentialExist(
|
|||||||
const dennyList = credentials.deny.find(
|
const dennyList = credentials.deny.find(
|
||||||
(credential) => credential.type === credentialType
|
(credential) => credential.type === credentialType
|
||||||
)
|
)
|
||||||
isExist = dennyList && dennyList.value.length > 0
|
isExist = dennyList && dennyList.values.length > 0
|
||||||
}
|
}
|
||||||
return isExist
|
return isExist
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ export function updateCredentialDetail(
|
|||||||
if (exists) {
|
if (exists) {
|
||||||
ddo.credentials.allow.find((credential) => {
|
ddo.credentials.allow.find((credential) => {
|
||||||
if (credential.type === credentialType) {
|
if (credential.type === credentialType) {
|
||||||
credential.value = list
|
credential.values = list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -107,7 +107,7 @@ export function updateCredentialDetail(
|
|||||||
if (exists) {
|
if (exists) {
|
||||||
ddo.credentials.deny.find((credential) => {
|
ddo.credentials.deny.find((credential) => {
|
||||||
if (credential.type === credentialType) {
|
if (credential.type === credentialType) {
|
||||||
credential.value = list
|
credential.values = list
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@ -134,7 +134,7 @@ export function addCredentialDetail(
|
|||||||
) {
|
) {
|
||||||
const newCredentialDetail: Credential = {
|
const newCredentialDetail: Credential = {
|
||||||
type: credentialType,
|
type: credentialType,
|
||||||
value: list
|
values: list
|
||||||
}
|
}
|
||||||
if (credentialAction === 'allow') {
|
if (credentialAction === 'allow') {
|
||||||
if (ddo.credentials && ddo.credentials.allow) {
|
if (ddo.credentials && ddo.credentials.allow) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user