refactor: Policies Architecture (#1016)
* add policy serialize method * Add policies to collection responses * wip * test: remove .only * refactor: Return policies with team and document requests * store policies on the client * refactor: drive admin UI from policies
This commit is contained in:
13
server/presenters/policy.js
Normal file
13
server/presenters/policy.js
Normal file
@ -0,0 +1,13 @@
|
||||
// @flow
|
||||
import { User } from '../models';
|
||||
|
||||
type Policy = { id: string, abilities: { [key: string]: boolean } };
|
||||
|
||||
export default function present(user: User, objects: Object[]): Policy[] {
|
||||
const { serialize } = require('../policies');
|
||||
|
||||
return objects.map(object => ({
|
||||
id: object.id,
|
||||
abilities: serialize(user, object),
|
||||
}));
|
||||
}
|
Reference in New Issue
Block a user