accesscontrol swagger: Add global field to RoleDTO type (#79351)

* `accesscontrol` swagger: Add `global` field to `RoleDTO` type
The field is currently added in the MarshalJSON function so it isn't reflected in the spec
This PR sets the "static" version of the RoleDTO, that has the global field, as the swagger model

* Revert the marshalling logic
This commit is contained in:
Julien Duchesne authored and GitHub committed 2023-12-12 08:04:25 -05:00
1 parent 57e0d6bcb5
commit b232c64d9a
4 files changed
+21 -1

No files matched your search

+7
View File
@@ -62,6 +62,7 @@ func (r Role) MarshalJSON() ([]byte, error) {
})
}
// swagger:ignore
type RoleDTO struct {
Version int64 `json:"version"`
UID string `xorm:"uid" json:"uid"`
@@ -135,6 +136,12 @@ func (r *RoleDTO) IsExternalService() bool {
return strings.HasPrefix(r.Name, ExternalServiceRolePrefix) || strings.HasPrefix(r.UID, ExternalServiceRoleUIDPrefix)
}
// swagger:model RoleDTO
type RoleDTOStatic struct {
RoleDTO
Global bool `json:"global" xorm:"-"`
}
func (r RoleDTO) MarshalJSON() ([]byte, error) {
type Alias RoleDTO
+8 -1
View File
@@ -4214,7 +4214,11 @@
"type": "boolean"
},
"id": {
"description": "Deprecated: use Uid instead",
"description": "Deprecated: use UID instead",
"type": "integer",
"format": "int64"
},
"orgId": {
"type": "integer",
"format": "int64"
},
@@ -6333,6 +6337,9 @@
"displayName": {
"type": "string"
},
"global": {
"type": "boolean"
},
"group": {
"type": "string"
},
+3
View File
@@ -18142,6 +18142,9 @@
"displayName": {
"type": "string"
},
"global": {
"type": "boolean"
},
"group": {
"type": "string"
},
+3
View File
@@ -9073,6 +9073,9 @@
"displayName": {
"type": "string"
},
"global": {
"type": "boolean"
},
"group": {
"type": "string"
},