2019-01-08 16:22:14 +01:00
|
|
|
/**
|
|
|
|
* @Author: Apollinaire Lecocq <apollinaire>
|
|
|
|
* @Date: 08-01-19
|
|
|
|
* @Last modified by: apollinaire
|
2019-01-10 14:28:23 +01:00
|
|
|
* @Last modified time: 10-01-19
|
2019-01-08 16:22:14 +01:00
|
|
|
*/
|
|
|
|
import React from 'react';
|
2019-01-10 14:28:23 +01:00
|
|
|
import {registerComponent, Components, withAccess, Dummy} from 'meteor/vulcan:core';
|
2019-01-09 11:29:25 +01:00
|
|
|
|
2019-01-10 14:28:23 +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,
|
|
|
|
});
|