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.
outline/server/policies/apiKey.js

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