[bugfix] Fix existing perm adoption (#3651)

* [bugfix] Fix existing perm adoption

* go fmt

* test, small log fix
This commit is contained in:
tobi 2025-01-18 17:55:27 +00:00 committed by GitHub
commit 634d4f408f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 225 additions and 18 deletions

View file

@ -104,3 +104,7 @@ func (d *DomainAllow) SetSubscriptionID(i string) {
func (d *DomainAllow) GetType() DomainPermissionType {
return DomainPermissionAllow
}
func (d *DomainAllow) IsOrphan() bool {
return d.SubscriptionID == ""
}

View file

@ -104,3 +104,7 @@ func (d *DomainBlock) SetSubscriptionID(i string) {
func (d *DomainBlock) GetType() DomainPermissionType {
return DomainPermissionBlock
}
func (d *DomainBlock) IsOrphan() bool {
return d.SubscriptionID == ""
}

View file

@ -43,6 +43,10 @@ type DomainPermission interface {
GetSubscriptionID() string
SetSubscriptionID(i string)
GetType() DomainPermissionType
// Return true if this DomainPermission
// does not have a subscription id set.
IsOrphan() bool
}
// Domain permission type.

View file

@ -104,3 +104,7 @@ func (d *DomainPermissionDraft) SetSubscriptionID(i string) {
func (d *DomainPermissionDraft) GetType() DomainPermissionType {
return d.PermissionType
}
func (d *DomainPermissionDraft) IsOrphan() bool {
return d.SubscriptionID == ""
}

View file

@ -90,3 +90,4 @@ func (d *DomainPermissionExclude) SetObfuscate(_ *bool) {}
func (d *DomainPermissionExclude) GetSubscriptionID() string { return "" }
func (d *DomainPermissionExclude) SetSubscriptionID(_ string) {}
func (d *DomainPermissionExclude) GetType() DomainPermissionType { return DomainPermissionUnknown }
func (d *DomainPermissionExclude) IsOrphan() bool { return true }