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