Skip to content

BeechCMS


BeechCMS / @beechcms/core / IOAuthConsentRepository

Interface: IOAuthConsentRepository ​

Methods ​

findActive() ​

findActive(clientId, userId): Promise<ConsentRecord | null>

Returns the live consent for the pair, or null when absent or revoked.

Parameters ​

clientId ​

string

userId ​

string

Returns ​

Promise<ConsentRecord | null>


grant() ​

grant(id, clientId, userId, scopes, nowTimestamp): Promise<void>

Records consent for the pair, unioning scopes into any existing live grant and reviving a previously revoked row. Idempotent for an unchanged scope set.

Parameters ​

id ​

string

clientId ​

string

userId ​

string

scopes ​

readonly ("content:read" | "content:delete" | "schema:read" | "schema:write" | "content:write" | "media:read" | "media:write" | "automations:read" | "automations:write" | "users:read" | "users:write" | "settings:read" | "settings:write" | "analytics:read" | "agent:read" | "agent:approve")[]

nowTimestamp ​

number

Returns ​

Promise<void>


listForUser() ​

listForUser(userId): Promise<ConsentRecord[]>

Lists all live consents for a user, newest first.

Parameters ​

userId ​

string

Returns ​

Promise<ConsentRecord[]>


revoke() ​

revoke(clientId, userId, nowTimestamp): Promise<boolean>

Revokes the consent. False when there was nothing live to revoke.

Parameters ​

clientId ​

string

userId ​

string

nowTimestamp ​

number

Returns ​

Promise<boolean>