diff --git a/package-lock.json b/package-lock.json index d05ba58..ad7aa17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@influenceth/sdk", - "version": "2.3.3", + "version": "2.3.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@influenceth/sdk", - "version": "2.3.3", + "version": "2.3.5", "license": "SEE LICENSE IN LICENSE", "dependencies": { "@influenceth/astro": "^0.2.6", diff --git a/package.json b/package.json index 0969f3e..4c98b90 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@influenceth/sdk", - "version": "2.3.3", + "version": "2.3.5", "description": "Influence SDK", "type": "module", "module": "./build/index.js", diff --git a/src/lib/permission.js b/src/lib/permission.js index 4e0e7d1..8c9e15d 100644 --- a/src/lib/permission.js +++ b/src/lib/permission.js @@ -164,15 +164,20 @@ const getPermissionPolicy = (entity, rawPermId, crew, blockTime = null) => { permPolicy.crewStatus = ''; if (crew) { if (entity.Control?.controller?.id === crew.id) permPolicy.crewStatus = 'controller'; + else if ((crew._siblingCrewIds || []).includes(entity.Control?.controller?.id)) permPolicy.crewStatus = 'controller'; + // if not exclusive, policy is "granted" just by being public or on allowlist else if (!TYPES[permId].isExclusive && permPolicy.policyType === POLICY_IDS.PUBLIC) permPolicy.crewStatus = 'granted'; else if (!TYPES[permId].isExclusive && permPolicy.allowlist.find((c) => c.id === crew.id)) permPolicy.crewStatus = 'granted'; else if (!TYPES[permId].isExclusive && crew?.Crew?.delegatedTo && permPolicy.accountAllowlist.find((a) => Address.areEqual(a, crew?.Crew?.delegatedTo))) permPolicy.crewStatus = 'granted'; + // else, granted if have explicit agreement else if (permPolicy.agreements?.find((a) => a.permitted?.id === crew.id)) permPolicy.crewStatus = 'granted'; + // for exclusive perms, also worth noting when being excluded else if (TYPES[permId].isExclusive && permPolicy.agreements?.length > 0) permPolicy.crewStatus = 'under contract'; else if (POLICY_TYPES[permPolicy.policyType]?.agreementKey) permPolicy.crewStatus = 'available'; + else permPolicy.crewStatus = 'restricted'; }