mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00
18 lines
No EOL
483 B
JavaScript
18 lines
No EOL
483 B
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
|
|
const CanViewPost = ({user, post, children}) => {
|
|
if (Users.can.viewPost(this.props.user, this.props.document)) {
|
|
return this.props.children;
|
|
} else if (!this.props.user){
|
|
return <p>Please log in.</p>;
|
|
} else {
|
|
return <p>Sorry, you do not have permissions to post at this time</p>;
|
|
}
|
|
};
|
|
|
|
CanViewPost.propTypes = {
|
|
user: React.PropTypes.object,
|
|
post: React.PropTypes.object
|
|
}
|
|
|
|
module.exports = CanViewPost; |