Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
init() {
this.projectReady = Formio.makeStaticRequest(this.appConfig.appUrl).then((project: any) => {
_each(project.access, (access: any) => {
this.formAccess[access.type] = access.roles;
});
}, (err: any): any => {
this.formAccess = {};
return null;
});
// Get the access for this project.
this.accessReady = Formio.makeStaticRequest(this.appConfig.appUrl + '/access').then((access: any) => {
_each(access.forms, (form: any) => {
this.submissionAccess[form.name] = {};
form.submissionAccess.forEach((access: any) => {
this.submissionAccess[form.name][access.type] = access.roles;
});
});
this.roles = access.roles;
return access;
}, (err: any): any => {
this.roles = {};
return null;
});
this.userReady = Formio.currentUser().then((user: any) => {
this.setUser(user);
return user;
init() {
this.projectReady = Formio.makeStaticRequest(this.appConfig.appUrl).then((project: any) => {
_each(project.access, (access: any) => {
this.formAccess[access.type] = access.roles;
});
}, (err: any): any => {
this.formAccess = {};
return null;
});
// Get the access for this project.
this.accessReady = Formio.makeStaticRequest(this.appConfig.appUrl + '/access').then((access: any) => {
_each(access.forms, (form: any) => {
this.submissionAccess[form.name] = {};
form.submissionAccess.forEach((access: any) => {
this.submissionAccess[form.name][access.type] = access.roles;
});
FormioAuthService.prototype.init = function () {
var _this = this;
this.projectReady = Formio.makeStaticRequest(this.appConfig.appUrl).then(function (project) {
_each(project.access, function (access) {
_this.formAccess[access.type] = access.roles;
});
}, function (err) {
_this.formAccess = {};
return null;
});
// Get the access for this project.
this.accessReady = Formio.makeStaticRequest(this.appConfig.appUrl + '/access').then(function (access) {
_each(access.forms, function (form) {
_this.submissionAccess[form.name] = {};
form.submissionAccess.forEach(function (access) {
_this.submissionAccess[form.name][access.type] = access.roles;
});
});
_this.roles = access.roles;
return access;
}, function (err) {
_this.roles = {};
return null;
});
this.userReady = Formio.currentUser().then(function (user) {
_this.setUser(user);
return user;
});
FormioAuthService.prototype.init = function () {
var _this = this;
this.projectReady = Formio.makeStaticRequest(this.appConfig.appUrl).then(function (project) {
_each(project.access, function (access) {
_this.formAccess[access.type] = access.roles;
});
}, function (err) {
_this.formAccess = {};
return null;
});
// Get the access for this project.
this.accessReady = Formio.makeStaticRequest(this.appConfig.appUrl + '/access').then(function (access) {
_each(access.forms, function (form) {
_this.submissionAccess[form.name] = {};
form.submissionAccess.forEach(function (access) {
_this.submissionAccess[form.name][access.type] = access.roles;
});
});
_this.roles = access.roles;
formiojs.makeStaticRequest(appUrl + '/access')
.then(function(result) {
let submissionAccess = {};
Object.keys(result.forms).forEach(key => {
let form = result.forms[key];
submissionAccess[form.name] = {};
form.submissionAccess.forEach(access => {
submissionAccess[form.name][access.type] = access.roles;
});
});
dispatch(submissionAccessUser(submissionAccess, result.roles));
})
.catch(function(err) {
//console.log(err);
});
formiojs.makeStaticRequest(appUrl)
.then(function(project) {
let formAccess = {};
project.access.forEach(access => {
formAccess[access.type] = access.roles;
});
dispatch(formAccessUser(formAccess));
})
.catch(function(err) {
//console.log(err);
});
};
const getAccess = (dispatch, getState) => {
const { appUrl } = getState().formio.auth;
formiojs.makeStaticRequest(appUrl + '/access')
.then(function(result) {
let submissionAccess = {};
Object.keys(result.forms).forEach(key => {
let form = result.forms[key];
submissionAccess[form.name] = {};
form.submissionAccess.forEach(access => {
submissionAccess[form.name][access.type] = access.roles;
});
});
dispatch(submissionAccessUser(submissionAccess, result.roles));
})
.catch(function(err) {
//console.log(err);
});
formiojs.makeStaticRequest(appUrl)
.then(function(project) {