APIs: Fix pre-processing of getApiResources & update godoc for teams endpoints (#113536)

This commit is contained in:
Tom Ratcliffe
2025-11-10 12:59:40 +00:00
committed by GitHub
parent 746efb4c56
commit 9a542489a7
19 changed files with 269 additions and 51 deletions
+14 -6
View File
@@ -73,11 +73,17 @@ func (r Role) MarshalJSON() ([]byte, error) {
// swagger:ignore
type RoleDTO struct {
Version int64 `json:"version"`
UID string `xorm:"uid" json:"uid"`
Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description"`
// required:true
Version int64 `json:"version"`
// required:true
UID string `xorm:"uid" json:"uid"`
// required:true
Name string `json:"name"`
// required:true
DisplayName string `json:"displayName,omitempty"`
// required:true
Description string `json:"description"`
// required:true
Group string `xorm:"group_name" json:"group"`
Permissions []Permission `json:"permissions,omitempty"`
Delegatable *bool `json:"delegatable,omitempty"`
@@ -87,7 +93,9 @@ type RoleDTO struct {
ID int64 `json:"-" xorm:"pk autoincr 'id'"`
OrgID int64 `json:"-" xorm:"org_id"`
// required:true
Updated time.Time `json:"updated"`
// required:true
Created time.Time `json:"created"`
}
@@ -193,7 +201,7 @@ type BuiltinRole struct {
Created time.Time
}
// Permission is the model for access control permissions.
// Permission is the model for access control permissions
type Permission struct {
ID int64 `json:"-" xorm:"pk autoincr 'id'"`
RoleID int64 `json:"-" xorm:"role_id"`
+17 -8
View File
@@ -38,6 +38,7 @@ type Team struct {
// COMMANDS
type CreateTeamCommand struct {
// required:true
Name string `json:"name" binding:"Required"`
Email string `json:"email"`
ExternalUID string `json:"-"`
@@ -94,14 +95,21 @@ type SearchTeamsQuery struct {
}
type TeamDTO struct {
ID int64 `json:"id" xorm:"id"`
UID string `json:"uid" xorm:"uid"`
OrgID int64 `json:"orgId" xorm:"org_id"`
Name string `json:"name"`
Email string `json:"email"`
ExternalUID string `json:"externalUID" xorm:"external_uid"`
IsProvisioned bool `json:"isProvisioned"`
AvatarURL string `json:"avatarUrl"`
// @deprecated Use UID instead
// required: true
ID int64 `json:"id" xorm:"id"`
// required: true
UID string `json:"uid" xorm:"uid"`
// required: true
OrgID int64 `json:"orgId" xorm:"org_id"`
// required: true
Name string `json:"name"`
Email string `json:"email"`
ExternalUID string `json:"externalUID" xorm:"external_uid"`
// required: true
IsProvisioned bool `json:"isProvisioned"`
AvatarURL string `json:"avatarUrl"`
// required: true
MemberCount int64 `json:"memberCount"`
Permission PermissionType `json:"permission"`
AccessControl map[string]bool `json:"accessControl"`
@@ -146,6 +154,7 @@ type TeamMember struct {
// COMMANDS
type AddTeamMemberCommand struct {
// required:true
UserID int64 `json:"userId" binding:"Required"`
Permission PermissionType `json:"-"`
}
+7
View File
@@ -344,6 +344,13 @@ type SearchTeamsParams struct {
// If set it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded.
// required:false
Query string `json:"query"`
// in:query
// required:false
// default: false
AccessControl bool `json:"accesscontrol"`
// in:query
// required:false
Sort string `json:"sort"`
}
// swagger:parameters createTeam