mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
Fix filling forms when user.roles is null/undefied (can fill all fields)
This commit is contained in:
@ -1511,15 +1511,18 @@ define([
|
||||
if (me.appOptions.canFillForms) {
|
||||
var oform = me.api.asc_GetOForm(),
|
||||
role = new AscCommon.CRestrictionSettings();
|
||||
if (oform && me.appOptions.user.roles && me.appOptions.user.roles.length>0 && oform.asc_canFillRole(me.appOptions.user.roles[0])) {
|
||||
role.put_OFormRole(this.appOptions.user.roles[0]);
|
||||
if (oform && me.appOptions.user.roles) {
|
||||
if (me.appOptions.user.roles.length>0 && oform.asc_canFillRole(me.appOptions.user.roles[0])) {
|
||||
role.put_OFormRole(this.appOptions.user.roles[0]);
|
||||
me.showFillingForms(true);
|
||||
} else {
|
||||
role.put_OFormNoRole(true);
|
||||
me.view.btnFillStatus && me.view.btnFillStatus.isVisible() && Common.UI.TooltipManager.addTips({
|
||||
'showFillStatus': { name: 'de-help-tip-fill-status', text: me.helpTextFillStatus, target: '#id-btn-status', placement: 'bottom-left', showButton: false, automove: true, maxwidth: 300 }
|
||||
});
|
||||
}
|
||||
} else // can fill all fields
|
||||
me.showFillingForms(true);
|
||||
} else {
|
||||
role.put_OFormNoRole(true);
|
||||
me.view.btnFillStatus && me.view.btnFillStatus.isVisible() && Common.UI.TooltipManager.addTips({
|
||||
'showFillStatus': { name: 'de-help-tip-fill-status', text: me.helpTextFillStatus, target: '#id-btn-status', placement: 'bottom-left', showButton: false, automove: true, maxwidth: 300 }
|
||||
});
|
||||
}
|
||||
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms, role);
|
||||
}
|
||||
|
||||
@ -2068,10 +2071,12 @@ define([
|
||||
}
|
||||
var oform = this.api.asc_GetOForm(),
|
||||
role = new AscCommon.CRestrictionSettings();
|
||||
if (oform && this.appOptions.user.roles && this.appOptions.user.roles.length>0 && oform.asc_canFillRole(this.appOptions.user.roles[0])) {
|
||||
role.put_OFormRole(this.appOptions.user.roles[0]);
|
||||
} else {
|
||||
role.put_OFormNoRole(true);
|
||||
if (oform && this.appOptions.user.roles) {
|
||||
if (this.appOptions.user.roles.length>0 && oform.asc_canFillRole(this.appOptions.user.roles[0])) {
|
||||
role.put_OFormRole(this.appOptions.user.roles[0]);
|
||||
} else {
|
||||
role.put_OFormNoRole(true);
|
||||
}
|
||||
}
|
||||
this.api.asc_setRestriction(state || !this.appOptions.canFillForms ? Asc.c_oAscRestrictionType.View : Asc.c_oAscRestrictionType.OnlyForms, role);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user