This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/server/policies/apiKey.js
Tom Moor 83f32be6f7 Add missing authorization on views endpoints
Updated ApiKeys authorization to match elsewhere
2018-02-18 10:56:56 -08:00

15 lines
256 B
JavaScript

// @flow
import policy from './policy';
import { ApiKey, User } from '../models';
const { allow } = policy;
allow(User, 'create', ApiKey);
allow(
User,
['read', 'update', 'delete'],
ApiKey,
(user, apiKey) => user && user.id === apiKey.userId
);