From 8d5c795cc4cc6b254a897461a860f25b0708ee14 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 18 Feb 2021 09:25:35 +0100 Subject: [API] Add Restricted Field to User (#14630) * Expose Restricted field for User * Add Option to Change Restricted on User via adminEditUser API * Add test who change restricted & test if it changed it ... * make generate-swagger Co-authored-by: zeripath Co-authored-by: Lunny Xiao --- modules/structs/admin_user.go | 1 + modules/structs/user.go | 2 ++ 2 files changed, 3 insertions(+) (limited to 'modules/structs') diff --git a/modules/structs/admin_user.go b/modules/structs/admin_user.go index 8cd4dc59e8..ee1738579a 100644 --- a/modules/structs/admin_user.go +++ b/modules/structs/admin_user.go @@ -41,4 +41,5 @@ type EditUserOption struct { MaxRepoCreation *int `json:"max_repo_creation"` ProhibitLogin *bool `json:"prohibit_login"` AllowCreateOrganization *bool `json:"allow_create_organization"` + Restricted *bool `json:"restricted"` } diff --git a/modules/structs/user.go b/modules/structs/user.go index bf52cc9ed6..511e4c56ce 100644 --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -30,6 +30,8 @@ type User struct { LastLogin time.Time `json:"last_login,omitempty"` // swagger:strfmt date-time Created time.Time `json:"created,omitempty"` + // Is user restricted + Restricted bool `json:"restricted"` } // MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility -- cgit v1.2.3