adds ability to disable anonymous users
This commit is contained in:
@@ -20,6 +20,7 @@ function Config(applicationId, mount) {
|
||||
this.restAPIKey = cacheInfo.restAPIKey;
|
||||
this.fileKey = cacheInfo.fileKey;
|
||||
this.facebookAppIds = cacheInfo.facebookAppIds;
|
||||
this.enableAnonymousUsers = cacheInfo.enableAnonymousUsers;
|
||||
|
||||
this.database = DatabaseAdapter.getDatabaseConnection(applicationId);
|
||||
this.filesController = cacheInfo.filesController;
|
||||
|
||||
@@ -150,8 +150,8 @@ RestWrite.prototype.validateAuthData = function() {
|
||||
var facebookData = this.data.authData.facebook;
|
||||
var anonData = this.data.authData.anonymous;
|
||||
|
||||
if (anonData === null ||
|
||||
(anonData && anonData.id)) {
|
||||
if (this.config.enableAnonymousUsers === true && (anonData === null ||
|
||||
(anonData && anonData.id))) {
|
||||
return this.handleAnonymousAuthData();
|
||||
} else if (facebookData === null ||
|
||||
(facebookData && facebookData.id && facebookData.access_token)) {
|
||||
|
||||
@@ -104,7 +104,8 @@ function ParseServer(args) {
|
||||
restAPIKey: args.restAPIKey || '',
|
||||
fileKey: args.fileKey || 'invalid-file-key',
|
||||
facebookAppIds: args.facebookAppIds || [],
|
||||
filesController: filesController
|
||||
filesController: filesController,
|
||||
enableAnonymousUsers: args.enableAnonymousUsers || true
|
||||
};
|
||||
|
||||
// To maintain compatibility. TODO: Remove in v2.1
|
||||
|
||||
Reference in New Issue
Block a user