-
Notifications
You must be signed in to change notification settings - Fork 0
/
permission.go
378 lines (376 loc) · 16 KB
/
permission.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
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
package models
import (
i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time"
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)
// Permission
type Permission struct {
Entity
// A format of yyyy-MM-ddTHH:mm:ssZ of DateTimeOffset indicates the expiration time of the permission. DateTime.MinValue indicates there's no expiration set for this permission. Optional.
expirationDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time
// The grantedTo property
grantedTo IdentitySetable
// The grantedToIdentities property
grantedToIdentities []IdentitySetable
// For link type permissions, the details of the users to whom permission was granted. Read-only.
grantedToIdentitiesV2 []SharePointIdentitySetable
// For user type permissions, the details of the users and applications for this permission. Read-only.
grantedToV2 SharePointIdentitySetable
// Indicates whether the password is set for this permission. This property only appears in the response. Optional. Read-only. For OneDrive Personal only..
hasPassword *bool
// Provides a reference to the ancestor of the current permission, if it's inherited from an ancestor. Read-only.
inheritedFrom ItemReferenceable
// Details of any associated sharing invitation for this permission. Read-only.
invitation SharingInvitationable
// Provides the link details of the current permission, if it's a link type permission. Read-only.
link SharingLinkable
// The type of permission, for example, read. See below for the full list of roles. Read-only.
roles []string
// A unique token that can be used to access this shared item via the shares API. Read-only.
shareId *string
}
// NewPermission instantiates a new permission and sets the default values.
func NewPermission()(*Permission) {
m := &Permission{
Entity: *NewEntity(),
}
return m
}
// CreatePermissionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
func CreatePermissionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewPermission(), nil
}
// GetExpirationDateTime gets the expirationDateTime property value. A format of yyyy-MM-ddTHH:mm:ssZ of DateTimeOffset indicates the expiration time of the permission. DateTime.MinValue indicates there's no expiration set for this permission. Optional.
func (m *Permission) GetExpirationDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) {
return m.expirationDateTime
}
// GetFieldDeserializers the deserialization information for the current model
func (m *Permission) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := m.Entity.GetFieldDeserializers()
res["expirationDateTime"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetTimeValue()
if err != nil {
return err
}
if val != nil {
m.SetExpirationDateTime(val)
}
return nil
}
res["grantedTo"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateIdentitySetFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetGrantedTo(val.(IdentitySetable))
}
return nil
}
res["grantedToIdentities"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreateIdentitySetFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]IdentitySetable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(IdentitySetable)
}
}
m.SetGrantedToIdentities(res)
}
return nil
}
res["grantedToIdentitiesV2"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(CreateSharePointIdentitySetFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]SharePointIdentitySetable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(SharePointIdentitySetable)
}
}
m.SetGrantedToIdentitiesV2(res)
}
return nil
}
res["grantedToV2"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateSharePointIdentitySetFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetGrantedToV2(val.(SharePointIdentitySetable))
}
return nil
}
res["hasPassword"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetBoolValue()
if err != nil {
return err
}
if val != nil {
m.SetHasPassword(val)
}
return nil
}
res["inheritedFrom"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateItemReferenceFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetInheritedFrom(val.(ItemReferenceable))
}
return nil
}
res["invitation"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateSharingInvitationFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetInvitation(val.(SharingInvitationable))
}
return nil
}
res["link"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(CreateSharingLinkFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetLink(val.(SharingLinkable))
}
return nil
}
res["roles"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfPrimitiveValues("string")
if err != nil {
return err
}
if val != nil {
res := make([]string, len(val))
for i, v := range val {
if v != nil {
res[i] = *(v.(*string))
}
}
m.SetRoles(res)
}
return nil
}
res["shareId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetShareId(val)
}
return nil
}
return res
}
// GetGrantedTo gets the grantedTo property value. The grantedTo property
func (m *Permission) GetGrantedTo()(IdentitySetable) {
return m.grantedTo
}
// GetGrantedToIdentities gets the grantedToIdentities property value. The grantedToIdentities property
func (m *Permission) GetGrantedToIdentities()([]IdentitySetable) {
return m.grantedToIdentities
}
// GetGrantedToIdentitiesV2 gets the grantedToIdentitiesV2 property value. For link type permissions, the details of the users to whom permission was granted. Read-only.
func (m *Permission) GetGrantedToIdentitiesV2()([]SharePointIdentitySetable) {
return m.grantedToIdentitiesV2
}
// GetGrantedToV2 gets the grantedToV2 property value. For user type permissions, the details of the users and applications for this permission. Read-only.
func (m *Permission) GetGrantedToV2()(SharePointIdentitySetable) {
return m.grantedToV2
}
// GetHasPassword gets the hasPassword property value. Indicates whether the password is set for this permission. This property only appears in the response. Optional. Read-only. For OneDrive Personal only..
func (m *Permission) GetHasPassword()(*bool) {
return m.hasPassword
}
// GetInheritedFrom gets the inheritedFrom property value. Provides a reference to the ancestor of the current permission, if it's inherited from an ancestor. Read-only.
func (m *Permission) GetInheritedFrom()(ItemReferenceable) {
return m.inheritedFrom
}
// GetInvitation gets the invitation property value. Details of any associated sharing invitation for this permission. Read-only.
func (m *Permission) GetInvitation()(SharingInvitationable) {
return m.invitation
}
// GetLink gets the link property value. Provides the link details of the current permission, if it's a link type permission. Read-only.
func (m *Permission) GetLink()(SharingLinkable) {
return m.link
}
// GetRoles gets the roles property value. The type of permission, for example, read. See below for the full list of roles. Read-only.
func (m *Permission) GetRoles()([]string) {
return m.roles
}
// GetShareId gets the shareId property value. A unique token that can be used to access this shared item via the shares API. Read-only.
func (m *Permission) GetShareId()(*string) {
return m.shareId
}
// Serialize serializes information the current object
func (m *Permission) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
err := m.Entity.Serialize(writer)
if err != nil {
return err
}
{
err = writer.WriteTimeValue("expirationDateTime", m.GetExpirationDateTime())
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("grantedTo", m.GetGrantedTo())
if err != nil {
return err
}
}
if m.GetGrantedToIdentities() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetGrantedToIdentities()))
for i, v := range m.GetGrantedToIdentities() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err = writer.WriteCollectionOfObjectValues("grantedToIdentities", cast)
if err != nil {
return err
}
}
if m.GetGrantedToIdentitiesV2() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetGrantedToIdentitiesV2()))
for i, v := range m.GetGrantedToIdentitiesV2() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err = writer.WriteCollectionOfObjectValues("grantedToIdentitiesV2", cast)
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("grantedToV2", m.GetGrantedToV2())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("hasPassword", m.GetHasPassword())
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("inheritedFrom", m.GetInheritedFrom())
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("invitation", m.GetInvitation())
if err != nil {
return err
}
}
{
err = writer.WriteObjectValue("link", m.GetLink())
if err != nil {
return err
}
}
if m.GetRoles() != nil {
err = writer.WriteCollectionOfStringValues("roles", m.GetRoles())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("shareId", m.GetShareId())
if err != nil {
return err
}
}
return nil
}
// SetExpirationDateTime sets the expirationDateTime property value. A format of yyyy-MM-ddTHH:mm:ssZ of DateTimeOffset indicates the expiration time of the permission. DateTime.MinValue indicates there's no expiration set for this permission. Optional.
func (m *Permission) SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {
m.expirationDateTime = value
}
// SetGrantedTo sets the grantedTo property value. The grantedTo property
func (m *Permission) SetGrantedTo(value IdentitySetable)() {
m.grantedTo = value
}
// SetGrantedToIdentities sets the grantedToIdentities property value. The grantedToIdentities property
func (m *Permission) SetGrantedToIdentities(value []IdentitySetable)() {
m.grantedToIdentities = value
}
// SetGrantedToIdentitiesV2 sets the grantedToIdentitiesV2 property value. For link type permissions, the details of the users to whom permission was granted. Read-only.
func (m *Permission) SetGrantedToIdentitiesV2(value []SharePointIdentitySetable)() {
m.grantedToIdentitiesV2 = value
}
// SetGrantedToV2 sets the grantedToV2 property value. For user type permissions, the details of the users and applications for this permission. Read-only.
func (m *Permission) SetGrantedToV2(value SharePointIdentitySetable)() {
m.grantedToV2 = value
}
// SetHasPassword sets the hasPassword property value. Indicates whether the password is set for this permission. This property only appears in the response. Optional. Read-only. For OneDrive Personal only..
func (m *Permission) SetHasPassword(value *bool)() {
m.hasPassword = value
}
// SetInheritedFrom sets the inheritedFrom property value. Provides a reference to the ancestor of the current permission, if it's inherited from an ancestor. Read-only.
func (m *Permission) SetInheritedFrom(value ItemReferenceable)() {
m.inheritedFrom = value
}
// SetInvitation sets the invitation property value. Details of any associated sharing invitation for this permission. Read-only.
func (m *Permission) SetInvitation(value SharingInvitationable)() {
m.invitation = value
}
// SetLink sets the link property value. Provides the link details of the current permission, if it's a link type permission. Read-only.
func (m *Permission) SetLink(value SharingLinkable)() {
m.link = value
}
// SetRoles sets the roles property value. The type of permission, for example, read. See below for the full list of roles. Read-only.
func (m *Permission) SetRoles(value []string)() {
m.roles = value
}
// SetShareId sets the shareId property value. A unique token that can be used to access this shared item via the shares API. Read-only.
func (m *Permission) SetShareId(value *string)() {
m.shareId = value
}
// Permissionable
type Permissionable interface {
Entityable
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetExpirationDateTime()(*i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
GetGrantedTo()(IdentitySetable)
GetGrantedToIdentities()([]IdentitySetable)
GetGrantedToIdentitiesV2()([]SharePointIdentitySetable)
GetGrantedToV2()(SharePointIdentitySetable)
GetHasPassword()(*bool)
GetInheritedFrom()(ItemReferenceable)
GetInvitation()(SharingInvitationable)
GetLink()(SharingLinkable)
GetRoles()([]string)
GetShareId()(*string)
SetExpirationDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)()
SetGrantedTo(value IdentitySetable)()
SetGrantedToIdentities(value []IdentitySetable)()
SetGrantedToIdentitiesV2(value []SharePointIdentitySetable)()
SetGrantedToV2(value SharePointIdentitySetable)()
SetHasPassword(value *bool)()
SetInheritedFrom(value ItemReferenceable)()
SetInvitation(value SharingInvitationable)()
SetLink(value SharingLinkable)()
SetRoles(value []string)()
SetShareId(value *string)()
}