@@ -85,7 +85,12 @@ export class FDocumentPermission {
8585 * @returns {Promise<void> } Resolves after the permission command finishes.
8686 */
8787 async setEditable ( editable = true ) : Promise < void > {
88- await this . setPoint ( UnitAction . Edit , editable ) ;
88+ await this . _commandService . executeCommand ( SetDocumentPermissionCommand . id , {
89+ unitId : this . _unitId ,
90+ objectId : this . _unitId ,
91+ action : UnitAction . Edit ,
92+ value : editable ,
93+ } ) ;
8994 }
9095
9196 /**
@@ -99,15 +104,25 @@ export class FDocumentPermission {
99104 * ```
100105 */
101106 async setReadOnly ( ) : Promise < void > {
102- await this . setEditable ( false ) ;
107+ await this . _commandService . executeCommand ( SetDocumentPermissionCommand . id , {
108+ unitId : this . _unitId ,
109+ objectId : this . _unitId ,
110+ action : UnitAction . Edit ,
111+ value : false ,
112+ } ) ;
103113 }
104114
105115 /**
106116 * Returns whether the whole Document is currently editable.
107117 * @returns {boolean } Whether Document editing is allowed.
108118 */
109119 canEdit ( ) : boolean {
110- return this . getPoint ( UnitAction . Edit ) ;
120+ return getDocumentPermissionValue (
121+ this . _permissionService ,
122+ this . _unitId ,
123+ this . _unitId ,
124+ UnitAction . Edit
125+ ) ;
111126 }
112127}
113128
@@ -161,7 +176,12 @@ export class FDocumentObjectPermission {
161176 * ```
162177 */
163178 async setReadOnly ( ) : Promise < void > {
164- await this . setEditable ( false ) ;
179+ await this . _commandService . executeCommand ( SetDocumentPermissionCommand . id , {
180+ unitId : this . _unitId ,
181+ objectId : this . _objectId ,
182+ action : UnitAction . Edit ,
183+ value : false ,
184+ } ) ;
165185 }
166186
167187 /**
0 commit comments