-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Adds support for readOnly masterKey #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b6bc8d0
to
3c13c58
Compare
@@ -77,7 +77,7 @@ module.exports = function(config, options) { | |||
// Serve the configuration. | |||
app.get('/parse-dashboard-config.json', function(req, res) { | |||
let response = { | |||
apps: config.apps, | |||
apps: [...config.apps], // make a copy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat trick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome and we'll use it for sure.
As usual, I have a bunch of nits that you can take or leave ;). it's just how I read.
Parse-Dashboard/app.js
Outdated
|
||
if (successfulAuth) { | ||
if (appsUserHasAccess) { | ||
// Restric access to apps defined in user dictionary | ||
// If they didn't supply any app id, user will access all apps | ||
response.apps = response.apps.filter(function (app) { | ||
return appsUserHasAccess.find(appUserHasAccess => { | ||
return app.appId == appUserHasAccess.appId | ||
const isSame = app.appId == appUserHasAccess.appId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer === :). i know its not yours....
Parse-Dashboard/Authentication.js
Outdated
@@ -81,6 +81,7 @@ function initialize(app, options) { | |||
function authenticate(userToTest, usernameOnly) { | |||
var appsUserHasAccessTo = null; | |||
var matchingUsername = null; | |||
var isReadOnly = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch all these to let
? your call :)....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep good call
Parse-Dashboard/Authentication.js
Outdated
@@ -96,12 +97,14 @@ function authenticate(userToTest, usernameOnly) { | |||
matchingUsername = user.user; | |||
// User restricted apps | |||
appsUserHasAccessTo = user.apps || null; | |||
isReadOnly = user.readOnly; | |||
} | |||
|
|||
return isAuthenticated; | |||
}) ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ewww, remove the ? true: false
? as completely redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeap
Parse-Dashboard/Authentication.js
Outdated
} | ||
|
||
return isAuthenticated; | ||
}) ? true : false; | ||
}) ? true : false ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because of the && && it was returning an object instead of true / false, and was breaking some tests.
README.md
Outdated
|
||
### Making an app read-only for all users | ||
|
||
Start your parse server with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parse-server for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also could put readOnlyMasterKey
masterKey
insteaxc of masterKey....i.e. mark as code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. doc is clear.
* Adds support for readOnly masterKey * nits * Adds tests for readOnly * Updates documentation * nit * nits
No description provided.