Skip to content

Commit d716a79

Browse files
committed
Merge pull request #344 from drew-gross/pointer-perms
Pointer perms
2 parents 892ea8c + 7da64ab commit d716a79

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"Parse Config",
77
"API Console",
88
"Class Level Permissions Editor",
9+
"Pointer Permissions Editor",
910
"Send Push Notifications",
1011
"Logs Viewer"
1112
],

src/dashboard/Data/Browser/Browser.react.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,6 @@ export default class Browser extends DashboardView {
451451
}
452452
}
453453

454-
onChangeCLP(perms) {
455-
let p = this.props.schema.dispatch(ActionTypes.SET_CLP, {
456-
className: this.props.params.className,
457-
clp: perms,
458-
});
459-
p.then(() => this.handleFetchedSchema());
460-
return p;
461-
}
462-
463454
selectRow(id, checked) {
464455
this.setState(({ selection }) => {
465456
if (id === '*') {
@@ -574,7 +565,14 @@ export default class Browser extends DashboardView {
574565
onDeleteRows={this.showDeleteRows.bind(this)}
575566
onDropClass={this.showDropClass.bind(this)}
576567
onExport={this.showExport.bind(this)}
577-
onChangeCLP={this.onChangeCLP.bind(this)}
568+
onChangeCLP={clp => {
569+
let p = this.props.schema.dispatch(ActionTypes.SET_CLP, {
570+
className: this.props.params.className,
571+
clp,
572+
});
573+
p.then(() => this.handleFetchedSchema());
574+
return p;
575+
}}
578576
onRefresh={this.refresh.bind(this)}
579577

580578
columns={columns}

src/dashboard/Data/Browser/SecurityDialog.react.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ import PermissionsDialog from 'components/PermissionsDialog/PermissionsDialog.re
1212
import React from 'react';
1313
import styles from 'dashboard/Data/Browser/Browser.scss';
1414

15-
const PARSE_SERVER_SUPPORTS_POINTER_PERMISSIONS = false;
16-
17-
function validateEntry(pointers, text) {
18-
if (PARSE_SERVER_SUPPORTS_POINTER_PERMISSIONS) { //Eventually we will branch on whether or not the server supports pointer permissions
15+
function validateEntry(pointers, text, parseServerSupportsPointerPermissions) {
16+
if (parseServerSupportsPointerPermissions) {
1917
if (pointers.indexOf(text) > -1) {
2018
return Parse.Promise.as({ pointer: text });
2119
}
@@ -49,16 +47,17 @@ export default class SecurityDialog extends React.Component {
4947

5048
render() {
5149
let dialog = null;
50+
let parseServerSupportsPointerPermissions = this.context.currentApp.serverInfo.features.schemas.editClassLevelPermissions;
5251
if (this.props.perms && this.state.open) {
5352
dialog = (
5453
<PermissionsDialog
5554
title='Edit Class Level Permissions'
56-
enablePointerPermissions={PARSE_SERVER_SUPPORTS_POINTER_PERMISSIONS /* not supported by Parse Server yet */}
55+
enablePointerPermissions={parseServerSupportsPointerPermissions}
5756
advanced={true}
5857
confirmText='Save CLP'
5958
details={<a href='https://parse.com/docs/ios/guide#security-class-level-permissions'>Learn more about CLPs and app security</a>}
6059
permissions={this.props.perms}
61-
validateEntry={validateEntry.bind(null, this.props.userPointers)}
60+
validateEntry={entry => validateEntry(this.props.userPointers, entry, parseServerSupportsPointerPermissions)}
6261
onCancel={() => {
6362
this.setState({ open: false });
6463
}}

0 commit comments

Comments
 (0)