2016-05-14 16:56:17 +05:30
|
|
|
import React from 'react';
|
|
|
|
|
2016-05-28 03:54:22 +05:30
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
|
|
|
|
2016-05-14 16:56:17 +05:30
|
|
|
import icons from 'components/ui/icons.scss';
|
|
|
|
import { PanelBodyHeader } from 'components/ui/Panel';
|
|
|
|
import BaseAuthBody from 'components/auth/BaseAuthBody';
|
|
|
|
|
|
|
|
import styles from './permissions.scss';
|
|
|
|
import messages from './Permissions.intl.json';
|
|
|
|
|
|
|
|
export default class PermissionsBody extends BaseAuthBody {
|
|
|
|
static displayName = 'PermissionsBody';
|
|
|
|
static panelId = 'permissions';
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {user} = this.context;
|
|
|
|
const scopes = this.context.auth.scopes;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{this.renderErrors()}
|
|
|
|
|
|
|
|
<PanelBodyHeader>
|
|
|
|
<div className={styles.authInfo}>
|
|
|
|
<div className={styles.authInfoAvatar}>
|
|
|
|
{user.avatar
|
|
|
|
? <img src={user.avatar} />
|
|
|
|
: <span className={icons.user} />
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<div className={styles.authInfoTitle}>
|
|
|
|
<Message {...messages.youAuthorizedAs} />
|
|
|
|
</div>
|
|
|
|
<div className={styles.authInfoEmail}>
|
2016-08-27 16:16:22 +05:30
|
|
|
{user.username}
|
2016-05-14 16:56:17 +05:30
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</PanelBodyHeader>
|
|
|
|
<div className={styles.permissionsContainer}>
|
|
|
|
<div className={styles.permissionsTitle}>
|
|
|
|
<Message {...messages.theAppNeedsAccess1} /><br />
|
|
|
|
<Message {...messages.theAppNeedsAccess2} />
|
|
|
|
</div>
|
|
|
|
<ul className={styles.permissionsList}>
|
2017-10-17 23:20:34 +05:30
|
|
|
{scopes.map((scope) => {
|
|
|
|
const key = `scope_${scope}`;
|
|
|
|
const message = messages[key];
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li key={key}>
|
|
|
|
{message ? <Message {...message} /> : scope.replace(/^\w|_/g, (match) =>
|
|
|
|
match.replace('_', ' ').toUpperCase()
|
|
|
|
)}
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
})}
|
2016-05-14 16:56:17 +05:30
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|