Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (lang.getObject('appState.user.contributor',false,this) !== userPermissions.contributor || lang.getObject('appState.user.editor',false,this) !== userPermissions.editor || lang.getObject('appState.user.publisher',false,this) !== userPermissions.publisher) {
UserActions.authenticateUser(userPermissions);
} else if (settings.forceAuthenticate) {
UserActions.authenticateUser(userPermissions);
}
if (!this.authorizedOwnersChecked && !$.isArray(authorizedOwners) || authorizedOwners.length === 0) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.unspecifiedConfigOwner);
} else if (!this.authorizedOwnersChecked && lang.getObject('appState.mode.isBuilder',false,this) && portalUser && authorizedOwners.indexOf(portalUser) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
} else if (!this.authorizedOwnersChecked && appOwner && authorizedOwners.indexOf(appOwner) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
}
}
$.each(errors, function() {
if (this.toString().search('You do not have access') > -1) {
AppActions.displayMainError(viewerText.errors.loading.notAuthorizedLayers);
}
_onError(this);
});
}
if (settings.guestContributor) {
userPermissions.contributor = true;
}
if (lang.getObject('appState.user.contributor',false,this) !== userPermissions.contributor || lang.getObject('appState.user.editor',false,this) !== userPermissions.editor || lang.getObject('appState.user.publisher',false,this) !== userPermissions.publisher) {
UserActions.authenticateUser(userPermissions);
} else if (settings.forceAuthenticate) {
UserActions.authenticateUser(userPermissions);
}
if (!this.authorizedOwnersChecked && !$.isArray(authorizedOwners) || authorizedOwners.length === 0) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.unspecifiedConfigOwner);
} else if (!this.authorizedOwnersChecked && lang.getObject('appState.mode.isBuilder',false,this) && portalUser && authorizedOwners.indexOf(portalUser) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
} else if (!this.authorizedOwnersChecked && appOwner && authorizedOwners.indexOf(appOwner) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
}
}
});
} else if (!res.values.settings && !builderText) {
const newUrl = new URI(window.location.href);
newUrl.addSearch('edit');
window.history.replaceState({},null,newUrl.href());
window.location.reload();
}
response.data = res;
checkUserLogin().then(getItem);
} else if (settings.item === 'webmap' && res.version) {
response.data = res;
checkUserLogin().then(getItem);
} else {
if (settings.item === 'app') {
AppActions.displayMainError(viewerText.errors.loading.appLoadingFail);
}
_onError(res);
deferred.reject(res);
}
},(err) => {
onError(err);
},(err) => {
AppActions.displayMainError(builderText.errors.scratchCreation.unknown);
_onError(err);
});
}
userPermissions.contributor = true;
}
if (settings.guestContributor) {
userPermissions.contributor = true;
}
if (lang.getObject('appState.user.contributor',false,this) !== userPermissions.contributor || lang.getObject('appState.user.editor',false,this) !== userPermissions.editor || lang.getObject('appState.user.publisher',false,this) !== userPermissions.publisher) {
UserActions.authenticateUser(userPermissions);
} else if (settings.forceAuthenticate) {
UserActions.authenticateUser(userPermissions);
}
if (!this.authorizedOwnersChecked && !$.isArray(authorizedOwners) || authorizedOwners.length === 0) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.unspecifiedConfigOwner);
} else if (!this.authorizedOwnersChecked && lang.getObject('appState.mode.isBuilder',false,this) && portalUser && authorizedOwners.indexOf(portalUser) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
} else if (!this.authorizedOwnersChecked && appOwner && authorizedOwners.indexOf(appOwner) === -1 && authorizedOwners.indexOf('*')) {
this.authorizedOwnersChecked = true;
AppActions.displayMainError(viewerText.errors.loading.invalidConfigOwner);
}
}
const onError = function(err) {
if (settings.item === 'app') {
if (err.toString().search('You do not have access') > -1) {
AppActions.displayMainError(viewerText.errors.loading.notAuthorizedApp);
} else if (err.toString().search('Item does not exist or is inaccessible') > -1) {
AppActions.displayMainError(viewerText.errors.loading.inaccessibleApp);
} else {
AppActions.displayMainError(viewerText.errors.loading.appLoadingFail);
}
}
_onError(err);
};
};
map.setClusterLayerQueryWhere = function (where) {
clusterLayer._where = where || '1=1';
MapActions.updateFeaturesInExtent([]);
map.refreshCrowdsourceLayer();
};
} else if (layer) {
_onError('Layer ' + this._settings.crowdsourceLayer.id + ' does not exist in map.');
}
} else if (window.app.mode.fromScratch) {
this.onLoad();
} else {
_onError('Crowdsource layer not found. Check layer ID and make sure you have permission to access the feature layer.');
AppActions.displayMainError(viewerText.errors.loading.crowdsourceLayerNotFound);
}
}
},(error) => {
this._errorWebmapId = this._settings.webmap;
if (error.toString().search('You do not have access') > -1) {
AppActions.displayMainError(viewerText.errors.loading.notAuthorizedMap);
}
_onError(error);
});
}