mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
20 lines
No EOL
483 B
JavaScript
20 lines
No EOL
483 B
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
|
|
const CanEditPost = ({user, post, children}) => {
|
|
if (Users.can.edit(user, post)) {
|
|
return children;
|
|
} else if (!user){
|
|
return <p>Please log in.</p>;
|
|
} else {
|
|
return <p>Sorry, you do not have permissions to edit this post at this time</p>;
|
|
}
|
|
};
|
|
|
|
CanEditPost.propTypes = {
|
|
user: React.PropTypes.object,
|
|
post: React.PropTypes.object
|
|
}
|
|
|
|
CanEditPost.displayName = "CanEditPost";
|
|
|
|
module.exports = CanEditPost; |