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 2023-12-12 08:04:25 -05:00 committed by GitHub
parent 57e0d6bcb5
commit b232c64d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 1 deletions

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

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"
},

View File

@ -18142,6 +18142,9 @@
"displayName": {
"type": "string"
},
"global": {
"type": "boolean"
},
"group": {
"type": "string"
},

View File

@ -9073,6 +9073,9 @@
"displayName": {
"type": "string"
},
"global": {
"type": "boolean"
},
"group": {
"type": "string"
},