mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 12:36:39 -04:00
28 lines
No EOL
620 B
JavaScript
28 lines
No EOL
620 B
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
|
|
const CanCreatePost = (props, context) => {
|
|
|
|
const currentUser = context.currentUser;
|
|
|
|
const children = props.children;
|
|
const AccountsForm = Telescope.components.AccountsForm;
|
|
|
|
if (!currentUser){
|
|
return (
|
|
<div>
|
|
<h3>Please Log In</h3>
|
|
<AccountsForm/>
|
|
</div>
|
|
)
|
|
} else if (Users.can.post(currentUser)) {
|
|
return children;
|
|
} else {
|
|
return <p>Sorry, you do not have permissions to post at this time</p>;
|
|
}
|
|
};
|
|
|
|
CanCreatePost.contextTypes = {
|
|
currentUser: React.PropTypes.object
|
|
};
|
|
|
|
module.exports = CanCreatePost; |