@@ -235,7 +235,7 @@ func (rbp *Blueprint) GetCustomizationsFromBlueprintRequest() (*blueprint.Custom
235
235
}
236
236
237
237
if rbpc .Openscap .PolicyId != nil {
238
- oscap .PolicyID = * rbpc .Openscap .PolicyId
238
+ oscap .PolicyID = rbpc .Openscap .PolicyId . String ()
239
239
}
240
240
241
241
if rbpc .Openscap .Datastream != nil {
@@ -288,23 +288,27 @@ func (rbp *Blueprint) GetCustomizationsFromBlueprintRequest() (*blueprint.Custom
288
288
dirCustomization .Mode = * d .Mode
289
289
}
290
290
if d .User != nil {
291
- dirCustomization .User = * d .User
292
- if uid , ok := dirCustomization .User .(float64 ); ok {
293
- // check if uid can be converted to int64
294
- if uid != float64 (int64 (uid )) {
295
- return nil , fmt .Errorf ("invalid user %f: must be an integer" , uid )
291
+ user0 , err := d .User .AsDirectoryUser0 ()
292
+ if err == nil {
293
+ dirCustomization .User = user0
294
+ } else {
295
+ user1 , err := d .User .AsDirectoryUser1 ()
296
+ if err != nil {
297
+ return nil , fmt .Errorf ("invalid user: %w" , err )
296
298
}
297
- dirCustomization .User = int64 ( uid )
299
+ dirCustomization .User = user1
298
300
}
299
301
}
300
302
if d .Group != nil {
301
- dirCustomization .Group = * d .Group
302
- if gid , ok := dirCustomization .Group .(float64 ); ok {
303
- // check if gid can be converted to int64
304
- if gid != float64 (int64 (gid )) {
305
- return nil , fmt .Errorf ("invalid group %f: must be an integer" , gid )
303
+ group0 , err := d .Group .AsDirectoryGroup0 ()
304
+ if err == nil {
305
+ dirCustomization .Group = group0
306
+ } else {
307
+ group1 , err := d .Group .AsDirectoryGroup1 ()
308
+ if err != nil {
309
+ return nil , fmt .Errorf ("invalid group: %w" , err )
306
310
}
307
- dirCustomization .Group = int64 ( gid )
311
+ dirCustomization .Group = group1
308
312
}
309
313
}
310
314
if d .EnsureParents != nil {
@@ -335,23 +339,29 @@ func (rbp *Blueprint) GetCustomizationsFromBlueprintRequest() (*blueprint.Custom
335
339
fileCustomization .Mode = * f .Mode
336
340
}
337
341
if f .User != nil {
338
- fileCustomization .User = * f .User
339
- if uid , ok := fileCustomization .User .(float64 ); ok {
340
- // check if uid can be converted to int64
341
- if uid != float64 (int64 (uid )) {
342
- return nil , fmt .Errorf ("invalid user %f: must be an integer" , uid )
342
+ user0 , err := f .User .AsBlueprintFileUser0 ()
343
+ if err == nil {
344
+ fileCustomization .User = user0
345
+ } else {
346
+ user1 , err := f .User .AsBlueprintFileUser1 ()
347
+ if err != nil {
348
+ return nil , fmt .Errorf ("invalid user: %w" , err )
343
349
}
344
- fileCustomization .User = int64 ( uid )
350
+ fileCustomization .User = user1
345
351
}
346
352
}
347
353
if f .Group != nil {
348
- fileCustomization .Group = * f .Group
349
- if gid , ok := fileCustomization .Group .(float64 ); ok {
350
- // check if gid can be converted to int64
351
- if gid != float64 (int64 (gid )) {
352
- return nil , fmt .Errorf ("invalid group %f: must be an integer" , gid )
354
+ group0 , err := f .Group .AsBlueprintFileGroup0 ()
355
+ if err == nil {
356
+ fileCustomization .Group = group0
357
+ } else {
358
+ group1 , err := f .Group .AsBlueprintFileGroup1 ()
359
+ if err != nil {
360
+ return nil , fmt .Errorf ("invalid group: %w" , err )
361
+ }
362
+ if group1 != 0 {
363
+ fileCustomization .Group = group1
353
364
}
354
- fileCustomization .Group = int64 (gid )
355
365
}
356
366
}
357
367
fileCustomizations = append (fileCustomizations , fileCustomization )
@@ -655,23 +665,27 @@ func (request *ComposeRequest) GetBlueprintFromCustomizations() (blueprint.Bluep
655
665
dirCustomization .Mode = * d .Mode
656
666
}
657
667
if d .User != nil {
658
- dirCustomization .User = * d .User
659
- if uid , ok := dirCustomization .User .(float64 ); ok {
660
- // check if uid can be converted to int64
661
- if uid != float64 (int64 (uid )) {
662
- return bp , fmt .Errorf ("invalid user %f: must be an integer" , uid )
668
+ user0 , err := d .User .AsDirectoryUser0 ()
669
+ if err == nil {
670
+ dirCustomization .User = user0
671
+ } else {
672
+ user1 , err := d .User .AsDirectoryUser1 ()
673
+ if err != nil {
674
+ return bp , fmt .Errorf ("invalid user: %w" , err )
663
675
}
664
- dirCustomization .User = int64 ( uid )
676
+ dirCustomization .User = user1
665
677
}
666
678
}
667
679
if d .Group != nil {
668
- dirCustomization .Group = * d .Group
669
- if gid , ok := dirCustomization .Group .(float64 ); ok {
670
- // check if gid can be converted to int64
671
- if gid != float64 (int64 (gid )) {
672
- return bp , fmt .Errorf ("invalid group %f: must be an integer" , gid )
680
+ group0 , err := d .Group .AsDirectoryGroup0 ()
681
+ if err == nil {
682
+ dirCustomization .Group = group0
683
+ } else {
684
+ group1 , err := d .Group .AsDirectoryGroup1 ()
685
+ if err != nil {
686
+ return bp , fmt .Errorf ("invalid group: %w" , err )
673
687
}
674
- dirCustomization .Group = int64 ( gid )
688
+ dirCustomization .Group = group1
675
689
}
676
690
}
677
691
if d .EnsureParents != nil {
@@ -702,23 +716,27 @@ func (request *ComposeRequest) GetBlueprintFromCustomizations() (blueprint.Bluep
702
716
fileCustomization .Mode = * f .Mode
703
717
}
704
718
if f .User != nil {
705
- fileCustomization .User = * f .User
706
- if uid , ok := fileCustomization .User .(float64 ); ok {
707
- // check if uid can be converted to int64
708
- if uid != float64 (int64 (uid )) {
709
- return bp , fmt .Errorf ("invalid user %f: must be an integer" , uid )
719
+ user0 , err := f .User .AsFileUser0 ()
720
+ if err == nil {
721
+ fileCustomization .User = user0
722
+ } else {
723
+ user1 , err := f .User .AsFileUser1 ()
724
+ if err != nil {
725
+ return bp , fmt .Errorf ("invalid user: %w" , err )
710
726
}
711
- fileCustomization .User = int64 ( uid )
727
+ fileCustomization .User = user1
712
728
}
713
729
}
714
730
if f .Group != nil {
715
- fileCustomization .Group = * f .Group
716
- if gid , ok := fileCustomization .Group .(float64 ); ok {
717
- // check if gid can be converted to int64
718
- if gid != float64 (int64 (gid )) {
719
- return bp , fmt .Errorf ("invalid group %f: must be an integer" , gid )
731
+ group0 , err := f .Group .AsFileGroup0 ()
732
+ if err == nil {
733
+ fileCustomization .Group = group0
734
+ } else {
735
+ group1 , err := f .Group .AsFileGroup1 ()
736
+ if err != nil {
737
+ return bp , fmt .Errorf ("invalid group: %w" , err )
720
738
}
721
- fileCustomization .Group = int64 ( gid )
739
+ fileCustomization .Group = group1
722
740
}
723
741
}
724
742
fileCustomizations = append (fileCustomizations , fileCustomization )
@@ -770,7 +788,7 @@ func (request *ComposeRequest) GetBlueprintFromCustomizations() (blueprint.Bluep
770
788
}
771
789
772
790
if request .Customizations .Openscap .PolicyId != nil {
773
- openSCAPCustomization .PolicyID = * request .Customizations .Openscap .PolicyId
791
+ openSCAPCustomization .PolicyID = request .Customizations .Openscap .PolicyId . String ()
774
792
}
775
793
776
794
if request .Customizations .Openscap .Tailoring != nil && request .Customizations .Openscap .JsonTailoring != nil {
0 commit comments