-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_access_permissions.go
334 lines (295 loc) · 12 KB
/
model_access_permissions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/*
* --------------------------------------------------------------------------------------------------------------------
* <copyright company="Aspose">
* Copyright (c) 2018 Aspose.Slides for Cloud
* </copyright>
* <summary>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* </summary>
* --------------------------------------------------------------------------------------------------------------------
*/
package asposeslidescloud
import (
"encoding/json"
)
// A set of properties specifying which access permissions should be granted when the document is opened with user access.
type IAccessPermissions interface {
// The user may print the document (possibly not at the highest quality level, depending on whether bit HighQualityPrint is also set).
GetPrintDocument() bool
SetPrintDocument(newValue bool)
// The user may modify the contents of the document by operations other than those controlled by bits AddOrModifyFields, FillExistingFields, AssembleDocument.
GetModifyContent() bool
SetModifyContent(newValue bool)
// The user may copy or otherwise extract text and graphics from the document by operations other than that controlled by bit ExtractTextAndGraphics.
GetCopyTextAndGraphics() bool
SetCopyTextAndGraphics(newValue bool)
// The user may add or modify text annotations, fill in interactive form fields, and, if bit ModifyContent is also set, create or modify interactive form fields (including signature fields).
GetAddOrModifyFields() bool
SetAddOrModifyFields(newValue bool)
// The user may fill in existing interactive form fields (including signature fields), even if bit AddOrModifyFields is clear.
GetFillExistingFields() bool
SetFillExistingFields(newValue bool)
// The user may extract text and graphics in support of accessibility to users with disabilities or for other purposes.
GetExtractTextAndGraphics() bool
SetExtractTextAndGraphics(newValue bool)
// The user may assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if bit ModifyContent is clear.
GetAssembleDocument() bool
SetAssembleDocument(newValue bool)
// The user may print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this bit is clear (and bit PrintDocument is set), printing is limited to a low-level representation of the appearance, possibly of degraded quality.
GetHighQualityPrint() bool
SetHighQualityPrint(newValue bool)
}
type AccessPermissions struct {
// The user may print the document (possibly not at the highest quality level, depending on whether bit HighQualityPrint is also set).
PrintDocument bool `json:"PrintDocument"`
// The user may modify the contents of the document by operations other than those controlled by bits AddOrModifyFields, FillExistingFields, AssembleDocument.
ModifyContent bool `json:"ModifyContent"`
// The user may copy or otherwise extract text and graphics from the document by operations other than that controlled by bit ExtractTextAndGraphics.
CopyTextAndGraphics bool `json:"CopyTextAndGraphics"`
// The user may add or modify text annotations, fill in interactive form fields, and, if bit ModifyContent is also set, create or modify interactive form fields (including signature fields).
AddOrModifyFields bool `json:"AddOrModifyFields"`
// The user may fill in existing interactive form fields (including signature fields), even if bit AddOrModifyFields is clear.
FillExistingFields bool `json:"FillExistingFields"`
// The user may extract text and graphics in support of accessibility to users with disabilities or for other purposes.
ExtractTextAndGraphics bool `json:"ExtractTextAndGraphics"`
// The user may assemble the document (insert, rotate, or delete pages and create bookmarks or thumbnail images), even if bit ModifyContent is clear.
AssembleDocument bool `json:"AssembleDocument"`
// The user may print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this bit is clear (and bit PrintDocument is set), printing is limited to a low-level representation of the appearance, possibly of degraded quality.
HighQualityPrint bool `json:"HighQualityPrint"`
}
func NewAccessPermissions() *AccessPermissions {
instance := new(AccessPermissions)
return instance
}
func (this *AccessPermissions) GetPrintDocument() bool {
return this.PrintDocument
}
func (this *AccessPermissions) SetPrintDocument(newValue bool) {
this.PrintDocument = newValue
}
func (this *AccessPermissions) GetModifyContent() bool {
return this.ModifyContent
}
func (this *AccessPermissions) SetModifyContent(newValue bool) {
this.ModifyContent = newValue
}
func (this *AccessPermissions) GetCopyTextAndGraphics() bool {
return this.CopyTextAndGraphics
}
func (this *AccessPermissions) SetCopyTextAndGraphics(newValue bool) {
this.CopyTextAndGraphics = newValue
}
func (this *AccessPermissions) GetAddOrModifyFields() bool {
return this.AddOrModifyFields
}
func (this *AccessPermissions) SetAddOrModifyFields(newValue bool) {
this.AddOrModifyFields = newValue
}
func (this *AccessPermissions) GetFillExistingFields() bool {
return this.FillExistingFields
}
func (this *AccessPermissions) SetFillExistingFields(newValue bool) {
this.FillExistingFields = newValue
}
func (this *AccessPermissions) GetExtractTextAndGraphics() bool {
return this.ExtractTextAndGraphics
}
func (this *AccessPermissions) SetExtractTextAndGraphics(newValue bool) {
this.ExtractTextAndGraphics = newValue
}
func (this *AccessPermissions) GetAssembleDocument() bool {
return this.AssembleDocument
}
func (this *AccessPermissions) SetAssembleDocument(newValue bool) {
this.AssembleDocument = newValue
}
func (this *AccessPermissions) GetHighQualityPrint() bool {
return this.HighQualityPrint
}
func (this *AccessPermissions) SetHighQualityPrint(newValue bool) {
this.HighQualityPrint = newValue
}
func (this *AccessPermissions) UnmarshalJSON(b []byte) error {
var objMap map[string]*json.RawMessage
err := json.Unmarshal(b, &objMap)
if err != nil {
return err
}
if valPrintDocument, ok := objMap["printDocument"]; ok {
if valPrintDocument != nil {
var valueForPrintDocument bool
err = json.Unmarshal(*valPrintDocument, &valueForPrintDocument)
if err != nil {
return err
}
this.PrintDocument = valueForPrintDocument
}
}
if valPrintDocumentCap, ok := objMap["PrintDocument"]; ok {
if valPrintDocumentCap != nil {
var valueForPrintDocument bool
err = json.Unmarshal(*valPrintDocumentCap, &valueForPrintDocument)
if err != nil {
return err
}
this.PrintDocument = valueForPrintDocument
}
}
if valModifyContent, ok := objMap["modifyContent"]; ok {
if valModifyContent != nil {
var valueForModifyContent bool
err = json.Unmarshal(*valModifyContent, &valueForModifyContent)
if err != nil {
return err
}
this.ModifyContent = valueForModifyContent
}
}
if valModifyContentCap, ok := objMap["ModifyContent"]; ok {
if valModifyContentCap != nil {
var valueForModifyContent bool
err = json.Unmarshal(*valModifyContentCap, &valueForModifyContent)
if err != nil {
return err
}
this.ModifyContent = valueForModifyContent
}
}
if valCopyTextAndGraphics, ok := objMap["copyTextAndGraphics"]; ok {
if valCopyTextAndGraphics != nil {
var valueForCopyTextAndGraphics bool
err = json.Unmarshal(*valCopyTextAndGraphics, &valueForCopyTextAndGraphics)
if err != nil {
return err
}
this.CopyTextAndGraphics = valueForCopyTextAndGraphics
}
}
if valCopyTextAndGraphicsCap, ok := objMap["CopyTextAndGraphics"]; ok {
if valCopyTextAndGraphicsCap != nil {
var valueForCopyTextAndGraphics bool
err = json.Unmarshal(*valCopyTextAndGraphicsCap, &valueForCopyTextAndGraphics)
if err != nil {
return err
}
this.CopyTextAndGraphics = valueForCopyTextAndGraphics
}
}
if valAddOrModifyFields, ok := objMap["addOrModifyFields"]; ok {
if valAddOrModifyFields != nil {
var valueForAddOrModifyFields bool
err = json.Unmarshal(*valAddOrModifyFields, &valueForAddOrModifyFields)
if err != nil {
return err
}
this.AddOrModifyFields = valueForAddOrModifyFields
}
}
if valAddOrModifyFieldsCap, ok := objMap["AddOrModifyFields"]; ok {
if valAddOrModifyFieldsCap != nil {
var valueForAddOrModifyFields bool
err = json.Unmarshal(*valAddOrModifyFieldsCap, &valueForAddOrModifyFields)
if err != nil {
return err
}
this.AddOrModifyFields = valueForAddOrModifyFields
}
}
if valFillExistingFields, ok := objMap["fillExistingFields"]; ok {
if valFillExistingFields != nil {
var valueForFillExistingFields bool
err = json.Unmarshal(*valFillExistingFields, &valueForFillExistingFields)
if err != nil {
return err
}
this.FillExistingFields = valueForFillExistingFields
}
}
if valFillExistingFieldsCap, ok := objMap["FillExistingFields"]; ok {
if valFillExistingFieldsCap != nil {
var valueForFillExistingFields bool
err = json.Unmarshal(*valFillExistingFieldsCap, &valueForFillExistingFields)
if err != nil {
return err
}
this.FillExistingFields = valueForFillExistingFields
}
}
if valExtractTextAndGraphics, ok := objMap["extractTextAndGraphics"]; ok {
if valExtractTextAndGraphics != nil {
var valueForExtractTextAndGraphics bool
err = json.Unmarshal(*valExtractTextAndGraphics, &valueForExtractTextAndGraphics)
if err != nil {
return err
}
this.ExtractTextAndGraphics = valueForExtractTextAndGraphics
}
}
if valExtractTextAndGraphicsCap, ok := objMap["ExtractTextAndGraphics"]; ok {
if valExtractTextAndGraphicsCap != nil {
var valueForExtractTextAndGraphics bool
err = json.Unmarshal(*valExtractTextAndGraphicsCap, &valueForExtractTextAndGraphics)
if err != nil {
return err
}
this.ExtractTextAndGraphics = valueForExtractTextAndGraphics
}
}
if valAssembleDocument, ok := objMap["assembleDocument"]; ok {
if valAssembleDocument != nil {
var valueForAssembleDocument bool
err = json.Unmarshal(*valAssembleDocument, &valueForAssembleDocument)
if err != nil {
return err
}
this.AssembleDocument = valueForAssembleDocument
}
}
if valAssembleDocumentCap, ok := objMap["AssembleDocument"]; ok {
if valAssembleDocumentCap != nil {
var valueForAssembleDocument bool
err = json.Unmarshal(*valAssembleDocumentCap, &valueForAssembleDocument)
if err != nil {
return err
}
this.AssembleDocument = valueForAssembleDocument
}
}
if valHighQualityPrint, ok := objMap["highQualityPrint"]; ok {
if valHighQualityPrint != nil {
var valueForHighQualityPrint bool
err = json.Unmarshal(*valHighQualityPrint, &valueForHighQualityPrint)
if err != nil {
return err
}
this.HighQualityPrint = valueForHighQualityPrint
}
}
if valHighQualityPrintCap, ok := objMap["HighQualityPrint"]; ok {
if valHighQualityPrintCap != nil {
var valueForHighQualityPrint bool
err = json.Unmarshal(*valHighQualityPrintCap, &valueForHighQualityPrint)
if err != nil {
return err
}
this.HighQualityPrint = valueForHighQualityPrint
}
}
return nil
}