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/team.js
Tom Moor b9e0668d7d Bulk export (#684)
* First pass (working) collection export to zip

* Add export confirmation screen

* 👕

* Refactor

* Job for team export, move to tmp file, settings UI

* Export all collections job

* 👕

* Add specs

* Clarify UI
2018-06-20 21:33:21 -07:00

15 lines
416 B
JavaScript

// @flow
import policy from './policy';
import { Team, User } from '../models';
import { AdminRequiredError } from '../errors';
const { allow } = policy;
allow(User, 'read', Team, (user, team) => team && user.teamId === team.id);
allow(User, ['update', 'export'], Team, (user, team) => {
if (!team || user.teamId !== team.id) return false;
if (user.isAdmin) return true;
throw new AdminRequiredError();
});