@@ -790,6 +790,12 @@ const docTemplate = `{
790
790
}
791
791
}
792
792
}
793
+ },
794
+ "409": {
795
+ "description": "User registered only with OIDC authentication",
796
+ "schema": {
797
+ "$ref": "#/definitions/models.LicenseError"
798
+ }
793
799
}
794
800
}
795
801
}
@@ -1859,6 +1865,12 @@ const docTemplate = `{
1859
1865
"summary": "Get users",
1860
1866
"operationId": "GetAllUsers",
1861
1867
"parameters": [
1868
+ {
1869
+ "type": "boolean",
1870
+ "description": "Active user only",
1871
+ "name": "active",
1872
+ "in": "query"
1873
+ },
1862
1874
{
1863
1875
"type": "integer",
1864
1876
"description": "Page number",
@@ -1912,7 +1924,54 @@ const docTemplate = `{
1912
1924
"in": "body",
1913
1925
"required": true,
1914
1926
"schema": {
1915
- "$ref": "#/definitions/models.UserInput"
1927
+ "$ref": "#/definitions/models.UserCreate"
1928
+ }
1929
+ }
1930
+ ],
1931
+ "responses": {
1932
+ "201": {
1933
+ "description": "Created",
1934
+ "schema": {
1935
+ "$ref": "#/definitions/models.UserResponse"
1936
+ }
1937
+ },
1938
+ "400": {
1939
+ "description": "Invalid json body",
1940
+ "schema": {
1941
+ "$ref": "#/definitions/models.LicenseError"
1942
+ }
1943
+ },
1944
+ "409": {
1945
+ "description": "User already exists",
1946
+ "schema": {
1947
+ "$ref": "#/definitions/models.LicenseError"
1948
+ }
1949
+ }
1950
+ }
1951
+ }
1952
+ },
1953
+ "/users/oidc": {
1954
+ "post": {
1955
+ "description": "Create a new service user via oidc",
1956
+ "consumes": [
1957
+ "application/json"
1958
+ ],
1959
+ "produces": [
1960
+ "application/json"
1961
+ ],
1962
+ "tags": [
1963
+ "Users"
1964
+ ],
1965
+ "summary": "Create new user via oidc",
1966
+ "operationId": "CreateOidcUser",
1967
+ "parameters": [
1968
+ {
1969
+ "description": "User to create",
1970
+ "name": "user",
1971
+ "in": "body",
1972
+ "required": true,
1973
+ "schema": {
1974
+ "$ref": "#/definitions/models.OidcUserCreate"
1916
1975
}
1917
1976
}
1918
1977
],
@@ -1938,14 +1997,14 @@ const docTemplate = `{
1938
1997
}
1939
1998
}
1940
1999
},
1941
- "/users/{id }": {
2000
+ "/users/{username }": {
1942
2001
"get": {
1943
2002
"security": [
1944
2003
{
1945
2004
"ApiKeyAuth": []
1946
2005
}
1947
2006
],
1948
- "description": "Get a single user by ID ",
2007
+ "description": "Get a single user by username ",
1949
2008
"consumes": [
1950
2009
"application/json"
1951
2010
],
@@ -1959,9 +2018,9 @@ const docTemplate = `{
1959
2018
"operationId": "GetUser",
1960
2019
"parameters": [
1961
2020
{
1962
- "type": "integer ",
1963
- "description": "User ID ",
1964
- "name": "id ",
2021
+ "type": "string ",
2022
+ "description": "Username ",
2023
+ "name": "username ",
1965
2024
"in": "path",
1966
2025
"required": true
1967
2026
}
@@ -1986,6 +2045,102 @@ const docTemplate = `{
1986
2045
}
1987
2046
}
1988
2047
}
2048
+ },
2049
+ "delete": {
2050
+ "security": [
2051
+ {
2052
+ "ApiKeyAuth": []
2053
+ }
2054
+ ],
2055
+ "description": "Deactivate an user",
2056
+ "consumes": [
2057
+ "application/json"
2058
+ ],
2059
+ "produces": [
2060
+ "application/json"
2061
+ ],
2062
+ "tags": [
2063
+ "Users"
2064
+ ],
2065
+ "summary": "Deactivate user",
2066
+ "operationId": "DeleteUser",
2067
+ "parameters": [
2068
+ {
2069
+ "type": "string",
2070
+ "description": "Username of the user to be marked as inactive",
2071
+ "name": "username",
2072
+ "in": "path",
2073
+ "required": true
2074
+ }
2075
+ ],
2076
+ "responses": {
2077
+ "204": {
2078
+ "description": "No Content"
2079
+ },
2080
+ "404": {
2081
+ "description": "No user with given username found",
2082
+ "schema": {
2083
+ "$ref": "#/definitions/models.LicenseError"
2084
+ }
2085
+ }
2086
+ }
2087
+ },
2088
+ "patch": {
2089
+ "security": [
2090
+ {
2091
+ "ApiKeyAuth": []
2092
+ }
2093
+ ],
2094
+ "description": "Update a service user",
2095
+ "consumes": [
2096
+ "application/json"
2097
+ ],
2098
+ "produces": [
2099
+ "application/json"
2100
+ ],
2101
+ "tags": [
2102
+ "Users"
2103
+ ],
2104
+ "summary": "Update user",
2105
+ "operationId": "UpdateUser",
2106
+ "parameters": [
2107
+ {
2108
+ "type": "string",
2109
+ "description": "username of the user to be updated",
2110
+ "name": "username",
2111
+ "in": "path",
2112
+ "required": true
2113
+ },
2114
+ {
2115
+ "description": "User to update",
2116
+ "name": "user",
2117
+ "in": "body",
2118
+ "required": true,
2119
+ "schema": {
2120
+ "$ref": "#/definitions/models.UserUpdate"
2121
+ }
2122
+ }
2123
+ ],
2124
+ "responses": {
2125
+ "200": {
2126
+ "description": "OK",
2127
+ "schema": {
2128
+ "$ref": "#/definitions/models.UserResponse"
2129
+ }
2130
+ },
2131
+ "400": {
2132
+ "description": "Invalid json body",
2133
+ "schema": {
2134
+ "$ref": "#/definitions/models.LicenseError"
2135
+ }
2136
+ },
2137
+ "403": {
2138
+ "description": "This resource requires elevated access rights",
2139
+ "schema": {
2140
+ "$ref": "#/definitions/models.LicenseError"
2141
+ }
2142
+ }
2143
+ }
1989
2144
}
1990
2145
}
1991
2146
},
@@ -2756,6 +2911,14 @@ const docTemplate = `{
2756
2911
}
2757
2912
}
2758
2913
},
2914
+ "models.OidcUserCreate": {
2915
+ "type": "object",
2916
+ "properties": {
2917
+ "token": {
2918
+ "type": "string"
2919
+ }
2920
+ }
2921
+ },
2759
2922
"models.PaginationMeta": {
2760
2923
"type": "object",
2761
2924
"properties": {
@@ -2829,40 +2992,49 @@ const docTemplate = `{
2829
2992
},
2830
2993
"models.User": {
2831
2994
"type": "object",
2832
- "required": [
2833
- "userlevel",
2834
- "username"
2835
- ],
2836
2995
"properties": {
2837
2996
"id": {
2838
2997
"type": "integer",
2839
2998
"example": 123
2840
2999
},
2841
- "userlevel ": {
3000
+ "user_email ": {
2842
3001
"type": "string",
2843
- "example": "admin"
3002
+
3003
+ },
3004
+ "user_level": {
3005
+ "type": "string",
3006
+ "example": "USER"
2844
3007
},
2845
3008
"username": {
2846
3009
"type": "string",
2847
3010
"example": "fossy"
2848
3011
}
2849
3012
}
2850
3013
},
2851
- "models.UserInput ": {
3014
+ "models.UserCreate ": {
2852
3015
"type": "object",
2853
3016
"required": [
2854
- "password",
2855
- "userlevel",
3017
+ "user_email",
3018
+ "user_level",
3019
+ "user_password",
2856
3020
"username"
2857
3021
],
2858
3022
"properties": {
2859
- "password ": {
3023
+ "user_email ": {
2860
3024
"type": "string",
2861
- "example": "fossy"
3025
+ "example": "fossy@org.com "
2862
3026
},
2863
- "userlevel ": {
3027
+ "user_level ": {
2864
3028
"type": "string",
2865
- "example": "admin"
3029
+ "enum": [
3030
+ "USER",
3031
+ "ADMIN"
3032
+ ],
3033
+ "example": "ADMIN"
3034
+ },
3035
+ "user_password": {
3036
+ "type": "string",
3037
+ "example": "fossy"
2866
3038
},
2867
3039
"username": {
2868
3040
"type": "string",
@@ -2904,6 +3076,29 @@ const docTemplate = `{
2904
3076
"example": 200
2905
3077
}
2906
3078
}
3079
+ },
3080
+ "models.UserUpdate": {
3081
+ "type": "object",
3082
+ "properties": {
3083
+ "active": {
3084
+ "type": "boolean"
3085
+ },
3086
+ "user_level": {
3087
+ "type": "string",
3088
+ "enum": [
3089
+ "USER",
3090
+ "ADMIN"
3091
+ ],
3092
+ "example": "ADMIN"
3093
+ },
3094
+ "user_password": {
3095
+ "type": "string"
3096
+ },
3097
+ "username": {
3098
+ "type": "string",
3099
+ "example": "fossy"
3100
+ }
3101
+ }
2907
3102
}
2908
3103
},
2909
3104
"securityDefinitions": {
0 commit comments