Skip to content

Commit

Permalink
[Forms] Send user's role in the fill-forms mode
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaRadzhabova committed Dec 23, 2024
1 parent 48852d1 commit 8583294
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
14 changes: 12 additions & 2 deletions apps/documenteditor/forms/app/controller/ApplicationController.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,12 @@ define([
me.api.Redo(false);
});

this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
var role;
if (this.appOptions.user.roles && this.appOptions.user.roles.length>0) {
role = new AscCommon.CRestrictionSettings();
role.put_OFormRole(this.appOptions.user.roles[0]);
}
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms, role);
this.api.asc_SetFastCollaborative(true);
this.api.asc_setAutoSaveGap(1);
this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None);
Expand Down Expand Up @@ -2034,7 +2039,12 @@ define([
this.view && this.view.btnClear && this.view.btnClear.setDisabled(state);
this.view && this.view.btnUndo && this.view.btnUndo.setDisabled(state || !this.api.asc_getCanUndo());
this.view && this.view.btnRedo && this.view.btnRedo.setDisabled(state || !this.api.asc_getCanRedo());
this.api.asc_setRestriction(state || !this.appOptions.canFillForms ? Asc.c_oAscRestrictionType.View : Asc.c_oAscRestrictionType.OnlyForms);
var role;
if (this.appOptions.user.roles && this.appOptions.user.roles.length>0) {
role = new AscCommon.CRestrictionSettings();
role.put_OFormRole(this.appOptions.user.roles[0]);
}
this.api.asc_setRestriction(state || !this.appOptions.canFillForms ? Asc.c_oAscRestrictionType.View : Asc.c_oAscRestrictionType.OnlyForms, role);
},

onApiServerDisconnect: function(enableDownload) {
Expand Down
9 changes: 8 additions & 1 deletion apps/documenteditor/main/app/controller/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,14 @@ define([
this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit);
this.api.asc_setCanSendChanges(this.appOptions.canSaveToFile);
this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments);
this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms);
if (this.appOptions.isRestrictedEdit && this.appOptions.canFillForms) {
var role;
if (this.appOptions.isPDFForm && this.appOptions.user.roles && this.appOptions.user.roles.length>0) {
role = new AscCommon.CRestrictionSettings();
role.put_OFormRole(this.appOptions.user.roles[0]);
}
this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms, role);
}
this.api.asc_LoadDocument();
},

Expand Down

0 comments on commit 8583294

Please sign in to comment.