Ghost/ghost/admin/app/helpers/gh-user-can-admin.js
Thibaut Patel dc9c812d9c Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion
issue https://github.com/TryGhost/Team/issues/857

- The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role
- `isOwner` => `isOwnerOnly`
- `isAdmin` => `isAdminOnly`
- `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins)
2021-07-12 14:55:56 +02:00

15 lines
488 B
JavaScript

import {helper} from '@ember/component/helper';
// Handlebars Helper {{gh-user-can-admin}} group users by admin and owner using if, or group them author using unless
// Usage: call helper as with aparameter of session.user
// e.g - {{#if (gh-user-can-admin session.user)}} 'block content' {{/if}}
// @param session.user
export function ghUserCanAdmin(params) {
return !!(params[0].get('isAdmin'));
}
export default helper(function (params) {
return ghUserCanAdmin(params);
});