Vulcan/packages/vulcan-admin/lib/components/AdminLayout.jsx

28 lines
671 B
React
Raw Normal View History

2019-01-08 16:22:14 +01:00
/**
* @Author: Apollinaire Lecocq <apollinaire>
* @Date: 08-01-19
* @Last modified by: apollinaire
* @Last modified time: 10-01-19
2019-01-08 16:22:14 +01:00
*/
import React from 'react';
import {registerComponent, Components, withAccess, Dummy} from 'meteor/vulcan:core';
2019-01-09 11:29:25 +01:00
const RestrictToAdmins = withAccess({groups: ['admins']})(Dummy);
2019-01-08 16:22:14 +01:00
/**
* A simple component that renders the existing layout and checks wether the currentUser is an admin or not.
*/
2019-01-09 11:29:25 +01:00
function AdminLayout({children}) {
return (
<Components.Layout>
<RestrictToAdmins>{children}</RestrictToAdmins>
</Components.Layout>
);
2019-01-08 16:22:14 +01:00
}
registerComponent({
name: 'AdminLayout',
component: AdminLayout,
});