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
);