import { Feed } from '../feed/feed' ; import { UserIdentity } from '../keystore' ; import { Query } from '../query/query' ; import { FactRecord , FactReference } from '../storage' ; import { Authorization } from './authorization' ; import { Forbidden } from './authorization-engine' ; export class AuthorizationNoOp implements Authorization { constructor ( private feed ) { } getUserFact ( userIdentity ) { throw new Forbidden ( ) ; } query ( userIdentity , start , query ) { return this . feed . query ( start , query ) ; } load ( userIdentity , references ) { return this . feed . load ( references ) ; } async save ( userIdentity , facts ) { const envelopes = await this . feed . save ( facts . map ( fact => ( { fact , signatures : [ ] } ) ) ) ; return envelopes . map ( envelope => envelope . fact ) ; } }