Fixed encoding & URL issues for users & groups pages (#896)
* Fixed encoding & URL issues for users & groups pages * Update portal-ui/src/screens/Console/Users/ListUsers.tsx Co-authored-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
var (
|
||||
configuration = "/settings"
|
||||
users = "/users"
|
||||
usersDetail = "/users/:userName"
|
||||
usersDetail = "/users/:userName+"
|
||||
groups = "/groups"
|
||||
iamPolicies = "/policies"
|
||||
policiesDetail = "/policies/:policyName"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"files": {
|
||||
"main.css": "/static/css/main.8cfac526.chunk.css",
|
||||
"main.js": "/static/js/main.c2e8f74d.chunk.js",
|
||||
"main.js.map": "/static/js/main.c2e8f74d.chunk.js.map",
|
||||
"main.js": "/static/js/main.2cc5eec9.chunk.js",
|
||||
"main.js.map": "/static/js/main.2cc5eec9.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.43a31377.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.43a31377.js.map",
|
||||
"static/css/2.c5a51b70.chunk.css": "/static/css/2.c5a51b70.chunk.css",
|
||||
@@ -20,6 +20,6 @@
|
||||
"static/css/2.c5a51b70.chunk.css",
|
||||
"static/js/2.c512ce9d.chunk.js",
|
||||
"static/css/main.8cfac526.chunk.css",
|
||||
"static/js/main.c2e8f74d.chunk.js"
|
||||
"static/js/main.2cc5eec9.chunk.js"
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link href="/styles/root-styles.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.c5a51b70.chunk.css" rel="stylesheet"><link href="/static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div id="loader-block"><svg class="loader-svg-container" viewBox="22 22 44 44"><circle class="loader-style MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg></div></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.c512ce9d.chunk.js"></script><script src="/static/js/main.c2e8f74d.chunk.js"></script></body></html>
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="MinIO Console"/><link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;500;700;900&display=swap" rel="stylesheet"/><link href="/styles/root-styles.css" rel="stylesheet"/><link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png"/><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"/><link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"/><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"/><link rel="manifest" href="/manifest.json"/><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#3a4e54"/><title>MinIO Console</title><link href="/static/css/2.c5a51b70.chunk.css" rel="stylesheet"><link href="/static/css/main.8cfac526.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"><div id="loader-block"><svg class="loader-svg-container" viewBox="22 22 44 44"><circle class="loader-style MuiCircularProgress-circle MuiCircularProgress-circleIndeterminate" cx="44" cy="44" r="20.2" fill="none" stroke-width="3.6"></circle></svg></div></div><script>!function(e){function r(r){for(var n,l,i=r[0],a=r[1],p=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n]);for(f&&f(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var a=t[i];0!==o[a]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonpportal-ui"]=this["webpackJsonpportal-ui"]||[],a=i.push.bind(i);i.push=r,i=i.slice();for(var p=0;p<i.length;p++)r(i[p]);var f=a;t()}([])</script><script src="/static/js/2.c512ce9d.chunk.js"></script><script src="/static/js/main.2cc5eec9.chunk.js"></script></body></html>
|
||||
2
portal-ui/build/static/js/main.2cc5eec9.chunk.js
Normal file
2
portal-ui/build/static/js/main.2cc5eec9.chunk.js
Normal file
File diff suppressed because one or more lines are too long
1
portal-ui/build/static/js/main.2cc5eec9.chunk.js.map
Normal file
1
portal-ui/build/static/js/main.2cc5eec9.chunk.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -287,7 +287,7 @@ const Console = ({
|
||||
},
|
||||
{
|
||||
component: Users,
|
||||
path: "/users/:userName",
|
||||
path: "/users/:userName+",
|
||||
},
|
||||
{
|
||||
component: Users,
|
||||
|
||||
@@ -90,7 +90,7 @@ const AddGroup = ({
|
||||
const saveRecord = () => {
|
||||
if (selectedGroup !== null) {
|
||||
api
|
||||
.invoke("PUT", `/api/v1/groups/${groupName}`, {
|
||||
.invoke("PUT", `/api/v1/group?name=${encodeURI(groupName)}`, {
|
||||
group: groupName,
|
||||
members: selectedUsers,
|
||||
status: groupEnabled ? "enabled" : "disabled",
|
||||
@@ -135,7 +135,7 @@ const AddGroup = ({
|
||||
if (selectedGroup && loadingGroup) {
|
||||
const fetchGroupInfo = () => {
|
||||
api
|
||||
.invoke("GET", `/api/v1/groups/${selectedGroup}`)
|
||||
.invoke("GET", `/api/v1/group?name=${encodeURI(selectedGroup)}`)
|
||||
.then((res: MainGroupProps) => {
|
||||
setGroupEnabled(res.status === "enabled");
|
||||
setGroupName(res.name);
|
||||
|
||||
@@ -51,7 +51,7 @@ const DeleteGroup = ({
|
||||
}
|
||||
|
||||
api
|
||||
.invoke("DELETE", `/api/v1/groups/${selectedGroup}`)
|
||||
.invoke("DELETE", `/api/v1/group?name=${encodeURI(selectedGroup)}`)
|
||||
.then(() => {
|
||||
setDeleteLoading(false);
|
||||
closeDeleteModalAndRefresh(true);
|
||||
|
||||
@@ -90,7 +90,7 @@ const SetPolicy = ({
|
||||
const fetchGroupInformation = () => {
|
||||
if (selectedGroup) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/groups/${selectedGroup}`)
|
||||
.invoke("GET", `/api/v1/group?name=${encodeURI(selectedGroup)}`)
|
||||
.then((res: any) => {
|
||||
const groupPolicy: String = get(res, "policy", "");
|
||||
setActualPolicy(groupPolicy.split(","));
|
||||
|
||||
@@ -88,12 +88,14 @@ const StorageVolumes = ({
|
||||
{
|
||||
type: "view",
|
||||
onClick: (record: any) => {
|
||||
history.push(`/namespaces/${record.namespace}/tenants/${record.tenant}`);
|
||||
history.push(
|
||||
`/namespaces/${record.namespace}/tenants/${record.tenant}`
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
return (
|
||||
<Fragment>
|
||||
<Grid item xs={12} className={classes.actionsTray}>
|
||||
<TextField
|
||||
@@ -138,7 +140,8 @@ const StorageVolumes = ({
|
||||
{
|
||||
label: "Tenant",
|
||||
renderFullObject: true,
|
||||
renderFunction: (record: any) => `${record.namespace}/${record.tenant}`,
|
||||
renderFunction: (record: any) =>
|
||||
`${record.namespace}/${record.tenant}`,
|
||||
},
|
||||
{
|
||||
label: "Capacity",
|
||||
|
||||
@@ -71,7 +71,7 @@ const AddUser = ({
|
||||
}
|
||||
|
||||
api
|
||||
.invoke("GET", `/api/v1/users/${selectedUser.accessKey}`)
|
||||
.invoke("GET", `/api/v1/user?name=${encodeURI(selectedUser.accessKey)}`)
|
||||
.then((res) => {
|
||||
setAddLoading(false);
|
||||
setAccessKey(res.accessKey);
|
||||
@@ -110,10 +110,14 @@ const AddUser = ({
|
||||
setAddLoading(true);
|
||||
if (selectedUser !== null) {
|
||||
api
|
||||
.invoke("PUT", `/api/v1/users/${selectedUser.accessKey}`, {
|
||||
status: enabled ? "enabled" : "disabled",
|
||||
groups: selectedGroups,
|
||||
})
|
||||
.invoke(
|
||||
"PUT",
|
||||
`/api/v1/user?name=${encodeURI(selectedUser.accessKey)}`,
|
||||
{
|
||||
status: enabled ? "enabled" : "disabled",
|
||||
groups: selectedGroups,
|
||||
}
|
||||
)
|
||||
.then((res) => {
|
||||
setAddLoading(false);
|
||||
closeModalAndRefresh();
|
||||
|
||||
@@ -66,7 +66,7 @@ const ChangeUserGroups = ({
|
||||
}
|
||||
|
||||
api
|
||||
.invoke("GET", `/api/v1/users/${selectedUser}`)
|
||||
.invoke("GET", `/api/v1/user?name=${encodeURI(selectedUser)}`)
|
||||
.then((res) => {
|
||||
setAddLoading(false);
|
||||
setAccessKey(res.accessKey);
|
||||
@@ -98,7 +98,7 @@ const ChangeUserGroups = ({
|
||||
setAddLoading(true);
|
||||
if (selectedUser !== null) {
|
||||
api
|
||||
.invoke("PUT", `/api/v1/users/${selectedUser}`, {
|
||||
.invoke("PUT", `/api/v1/user?name=${encodeURI(selectedUser)}`, {
|
||||
status: enabled ? "enabled" : "disabled",
|
||||
groups: selectedGroups,
|
||||
})
|
||||
|
||||
@@ -53,9 +53,13 @@ const DeleteUser = ({
|
||||
}
|
||||
setDeleteLoading(true);
|
||||
api
|
||||
.invoke("DELETE", `/api/v1/users/${selectedUser.accessKey}`, {
|
||||
id: selectedUser.id,
|
||||
})
|
||||
.invoke(
|
||||
"DELETE",
|
||||
`/api/v1/user?name=${encodeURI(selectedUser.accessKey)}`,
|
||||
{
|
||||
id: selectedUser.id,
|
||||
}
|
||||
)
|
||||
.then((res: UsersList) => {
|
||||
setDeleteLoading(false);
|
||||
closeDeleteModalAndRefresh(true);
|
||||
|
||||
@@ -54,7 +54,7 @@ const DeleteUserString = ({
|
||||
}
|
||||
setDeleteLoading(true);
|
||||
api
|
||||
.invoke("DELETE", `/api/v1/users/${userName}`, {
|
||||
.invoke("DELETE", `/api/v1/user?name=${encodeURI(userName)}`, {
|
||||
id: userName,
|
||||
})
|
||||
.then((res: UsersList) => {
|
||||
|
||||
@@ -36,7 +36,6 @@ import AddToGroup from "./BulkAddToGroup";
|
||||
import TableWrapper from "../Common/TableWrapper/TableWrapper";
|
||||
import SetPolicy from "../Policies/SetPolicy";
|
||||
import PageHeader from "../Common/PageHeader/PageHeader";
|
||||
import history from "../../../history";
|
||||
|
||||
const styles = (theme: Theme) =>
|
||||
createStyles({
|
||||
@@ -77,10 +76,11 @@ const styles = (theme: Theme) =>
|
||||
|
||||
interface IUsersProps {
|
||||
classes: any;
|
||||
history: any;
|
||||
setErrorSnackMessage: typeof setErrorSnackMessage;
|
||||
}
|
||||
|
||||
const ListUsers = ({ classes, setErrorSnackMessage }: IUsersProps) => {
|
||||
const ListUsers = ({ classes, setErrorSnackMessage, history }: IUsersProps) => {
|
||||
const [records, setRecords] = useState<User[]>([]);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const [addScreenOpen, setAddScreenOpen] = useState<boolean>(false);
|
||||
@@ -155,7 +155,8 @@ const ListUsers = ({ classes, setErrorSnackMessage }: IUsersProps) => {
|
||||
};
|
||||
|
||||
const viewAction = (selectionElement: any): void => {
|
||||
history.push(`/users/${selectionElement.accessKey}`);
|
||||
|
||||
history.push(`/users/${encodeURI(selectionElement.accessKey)}`);
|
||||
};
|
||||
|
||||
const deleteAction = (selectionElement: any): void => {
|
||||
|
||||
@@ -166,7 +166,7 @@ const UserDetails = ({ classes, match }: IUserDetailsProps) => {
|
||||
}
|
||||
setLoading(true);
|
||||
api
|
||||
.invoke("GET", `/api/v1/users/${userName}`)
|
||||
.invoke("GET", `/api/v1/user?name=${encodeURI(userName)}`)
|
||||
.then((res) => {
|
||||
setAddLoading(false);
|
||||
const memberOf = res.memberOf || [];
|
||||
@@ -202,7 +202,7 @@ const UserDetails = ({ classes, match }: IUserDetailsProps) => {
|
||||
}
|
||||
setAddLoading(true);
|
||||
api
|
||||
.invoke("PUT", `/api/v1/users/${userName}`, {
|
||||
.invoke("PUT", `/api/v1/user?name=${encodeURI(userName)}`, {
|
||||
status: isEnabled ? "enabled" : "disabled",
|
||||
groups: selectedGroups,
|
||||
})
|
||||
|
||||
@@ -75,7 +75,7 @@ const UserServiceAccountsPanel = ({
|
||||
useEffect(() => {
|
||||
if (loading) {
|
||||
api
|
||||
.invoke("GET", `/api/v1/users/${user}/service-accounts`)
|
||||
.invoke("GET", `/api/v1/user/service-accounts?name=${user}`)
|
||||
.then((res: string[]) => {
|
||||
const serviceAccounts = res.sort(stringSort);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ const Users = () => {
|
||||
return (
|
||||
<Router history={history}>
|
||||
<Switch>
|
||||
<Route path="/users/:userName" component={UserDetails} />
|
||||
<Route path="/users/:userName+" component={UserDetails} />
|
||||
<Route path="/" component={ListUsers} />
|
||||
<Route component={NotFoundPage} />
|
||||
</Switch>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -162,7 +162,7 @@ func prepareError(err ...error) *models.Error {
|
||||
errorMessage = err[0].Error()
|
||||
}
|
||||
if err[0].Error() == errRemoteInvalidCredentials.Error() {
|
||||
errorCode = 401
|
||||
errorCode = 403
|
||||
errorMessage = err[0].Error()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewGetUserInfo(ctx *middleware.Context, handler GetUserInfoHandler) *GetUse
|
||||
return &GetUserInfo{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GetUserInfo swagger:route GET /users/{name} AdminAPI getUserInfo
|
||||
/* GetUserInfo swagger:route GET /user AdminAPI getUserInfo
|
||||
|
||||
Get User Info
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewGetUserInfoParams creates a new GetUserInfoParams object
|
||||
@@ -49,7 +51,7 @@ type GetUserInfoParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -63,8 +65,10 @@ func (o *GetUserInfoParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -73,15 +77,22 @@ func (o *GetUserInfoParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *GetUserInfoParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GetUserInfoURL generates an URL for the get user info operation
|
||||
@@ -57,14 +56,7 @@ func (o *GetUserInfoURL) SetBasePath(bp string) {
|
||||
func (o *GetUserInfoURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/users/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on GetUserInfoURL")
|
||||
}
|
||||
var _path = "/user"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *GetUserInfoURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewGroupInfo(ctx *middleware.Context, handler GroupInfoHandler) *GroupInfo
|
||||
return &GroupInfo{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* GroupInfo swagger:route GET /groups/{name} AdminAPI groupInfo
|
||||
/* GroupInfo swagger:route GET /group AdminAPI groupInfo
|
||||
|
||||
Group info
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewGroupInfoParams creates a new GroupInfoParams object
|
||||
@@ -49,7 +51,7 @@ type GroupInfoParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -63,8 +65,10 @@ func (o *GroupInfoParams) BindRequest(r *http.Request, route *middleware.Matched
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -73,15 +77,22 @@ func (o *GroupInfoParams) BindRequest(r *http.Request, route *middleware.Matched
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *GroupInfoParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// GroupInfoURL generates an URL for the group info operation
|
||||
@@ -57,14 +56,7 @@ func (o *GroupInfoURL) SetBasePath(bp string) {
|
||||
func (o *GroupInfoURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/groups/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on GroupInfoURL")
|
||||
}
|
||||
var _path = "/group"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *GroupInfoURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewListAUserServiceAccounts(ctx *middleware.Context, handler ListAUserServi
|
||||
return &ListAUserServiceAccounts{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* ListAUserServiceAccounts swagger:route GET /users/{name}/service-accounts AdminAPI listAUserServiceAccounts
|
||||
/* ListAUserServiceAccounts swagger:route GET /user/service-accounts AdminAPI listAUserServiceAccounts
|
||||
|
||||
returns a list of service accounts for a user
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewListAUserServiceAccountsParams creates a new ListAUserServiceAccountsParams object
|
||||
@@ -49,7 +51,7 @@ type ListAUserServiceAccountsParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -63,8 +65,10 @@ func (o *ListAUserServiceAccountsParams) BindRequest(r *http.Request, route *mid
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -73,15 +77,22 @@ func (o *ListAUserServiceAccountsParams) BindRequest(r *http.Request, route *mid
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *ListAUserServiceAccountsParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ListAUserServiceAccountsURL generates an URL for the list a user service accounts operation
|
||||
@@ -57,14 +56,7 @@ func (o *ListAUserServiceAccountsURL) SetBasePath(bp string) {
|
||||
func (o *ListAUserServiceAccountsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/users/{name}/service-accounts"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on ListAUserServiceAccountsURL")
|
||||
}
|
||||
var _path = "/user/service-accounts"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *ListAUserServiceAccountsURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewRemoveGroup(ctx *middleware.Context, handler RemoveGroupHandler) *Remove
|
||||
return &RemoveGroup{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* RemoveGroup swagger:route DELETE /groups/{name} AdminAPI removeGroup
|
||||
/* RemoveGroup swagger:route DELETE /group AdminAPI removeGroup
|
||||
|
||||
Remove group
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewRemoveGroupParams creates a new RemoveGroupParams object
|
||||
@@ -49,7 +51,7 @@ type RemoveGroupParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -63,8 +65,10 @@ func (o *RemoveGroupParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -73,15 +77,22 @@ func (o *RemoveGroupParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *RemoveGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// RemoveGroupURL generates an URL for the remove group operation
|
||||
@@ -57,14 +56,7 @@ func (o *RemoveGroupURL) SetBasePath(bp string) {
|
||||
func (o *RemoveGroupURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/groups/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on RemoveGroupURL")
|
||||
}
|
||||
var _path = "/group"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *RemoveGroupURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewRemoveUser(ctx *middleware.Context, handler RemoveUserHandler) *RemoveUs
|
||||
return &RemoveUser{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* RemoveUser swagger:route DELETE /users/{name} AdminAPI removeUser
|
||||
/* RemoveUser swagger:route DELETE /user AdminAPI removeUser
|
||||
|
||||
Remove user
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewRemoveUserParams creates a new RemoveUserParams object
|
||||
@@ -49,7 +51,7 @@ type RemoveUserParams struct {
|
||||
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -63,8 +65,10 @@ func (o *RemoveUserParams) BindRequest(r *http.Request, route *middleware.Matche
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -73,15 +77,22 @@ func (o *RemoveUserParams) BindRequest(r *http.Request, route *middleware.Matche
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *RemoveUserParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// RemoveUserURL generates an URL for the remove user operation
|
||||
@@ -57,14 +56,7 @@ func (o *RemoveUserURL) SetBasePath(bp string) {
|
||||
func (o *RemoveUserURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/users/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on RemoveUserURL")
|
||||
}
|
||||
var _path = "/user"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *RemoveUserURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewUpdateGroup(ctx *middleware.Context, handler UpdateGroupHandler) *Update
|
||||
return &UpdateGroup{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* UpdateGroup swagger:route PUT /groups/{name} AdminAPI updateGroup
|
||||
/* UpdateGroup swagger:route PUT /group AdminAPI updateGroup
|
||||
|
||||
Update Group Members or Status
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ type UpdateGroupParams struct {
|
||||
Body *models.UpdateGroupRequest
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -74,6 +74,8 @@ func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.UpdateGroupRequest
|
||||
@@ -102,8 +104,8 @@ func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -112,15 +114,22 @@ func (o *UpdateGroupParams) BindRequest(r *http.Request, route *middleware.Match
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *UpdateGroupParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UpdateGroupURL generates an URL for the update group operation
|
||||
@@ -57,14 +56,7 @@ func (o *UpdateGroupURL) SetBasePath(bp string) {
|
||||
func (o *UpdateGroupURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/groups/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on UpdateGroupURL")
|
||||
}
|
||||
var _path = "/group"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *UpdateGroupURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewUpdateUserGroups(ctx *middleware.Context, handler UpdateUserGroupsHandle
|
||||
return &UpdateUserGroups{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* UpdateUserGroups swagger:route PUT /users/{name}/groups AdminAPI updateUserGroups
|
||||
/* UpdateUserGroups swagger:route PUT /user/groups AdminAPI updateUserGroups
|
||||
|
||||
Update Groups for a user
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ type UpdateUserGroupsParams struct {
|
||||
Body *models.UpdateUserGroups
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -74,6 +74,8 @@ func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware.
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.UpdateUserGroups
|
||||
@@ -102,8 +104,8 @@ func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware.
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -112,15 +114,22 @@ func (o *UpdateUserGroupsParams) BindRequest(r *http.Request, route *middleware.
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *UpdateUserGroupsParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UpdateUserGroupsURL generates an URL for the update user groups operation
|
||||
@@ -57,14 +56,7 @@ func (o *UpdateUserGroupsURL) SetBasePath(bp string) {
|
||||
func (o *UpdateUserGroupsURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/users/{name}/groups"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on UpdateUserGroupsURL")
|
||||
}
|
||||
var _path = "/user/groups"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *UpdateUserGroupsURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewUpdateUserInfo(ctx *middleware.Context, handler UpdateUserInfoHandler) *
|
||||
return &UpdateUserInfo{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/* UpdateUserInfo swagger:route PUT /users/{name} AdminAPI updateUserInfo
|
||||
/* UpdateUserInfo swagger:route PUT /user AdminAPI updateUserInfo
|
||||
|
||||
Update User Info
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ type UpdateUserInfoParams struct {
|
||||
Body *models.UpdateUser
|
||||
/*
|
||||
Required: true
|
||||
In: path
|
||||
In: query
|
||||
*/
|
||||
Name string
|
||||
}
|
||||
@@ -74,6 +74,8 @@ func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.Ma
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.UpdateUser
|
||||
@@ -102,8 +104,8 @@ func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.Ma
|
||||
res = append(res, errors.Required("body", "body", ""))
|
||||
}
|
||||
|
||||
rName, rhkName, _ := route.Params.GetOK("name")
|
||||
if err := o.bindName(rName, rhkName, route.Formats); err != nil {
|
||||
qName, qhkName, _ := qs.GetOK("name")
|
||||
if err := o.bindName(qName, qhkName, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
@@ -112,15 +114,22 @@ func (o *UpdateUserInfoParams) BindRequest(r *http.Request, route *middleware.Ma
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindName binds and validates parameter Name from path.
|
||||
// bindName binds and validates parameter Name from query.
|
||||
func (o *UpdateUserInfoParams) bindName(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("name", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// Parameter is provided by construction from the route
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("name", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.Name = raw
|
||||
|
||||
return nil
|
||||
|
||||
@@ -26,7 +26,6 @@ import (
|
||||
"errors"
|
||||
"net/url"
|
||||
golangswaggerpaths "path"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// UpdateUserInfoURL generates an URL for the update user info operation
|
||||
@@ -57,14 +56,7 @@ func (o *UpdateUserInfoURL) SetBasePath(bp string) {
|
||||
func (o *UpdateUserInfoURL) Build() (*url.URL, error) {
|
||||
var _result url.URL
|
||||
|
||||
var _path = "/users/{name}"
|
||||
|
||||
name := o.Name
|
||||
if name != "" {
|
||||
_path = strings.Replace(_path, "{name}", name, -1)
|
||||
} else {
|
||||
return nil, errors.New("name is required on UpdateUserInfoURL")
|
||||
}
|
||||
var _path = "/user"
|
||||
|
||||
_basePath := o._basePath
|
||||
if _basePath == "" {
|
||||
@@ -72,6 +64,15 @@ func (o *UpdateUserInfoURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
nameQ := o.Name
|
||||
if nameQ != "" {
|
||||
qs.Set("name", nameQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -1204,11 +1204,11 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/users/{name}"] = admin_api.NewGetUserInfo(o.context, o.AdminAPIGetUserInfoHandler)
|
||||
o.handlers["GET"]["/user"] = admin_api.NewGetUserInfo(o.context, o.AdminAPIGetUserInfoHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/groups/{name}"] = admin_api.NewGroupInfo(o.context, o.AdminAPIGroupInfoHandler)
|
||||
o.handlers["GET"]["/group"] = admin_api.NewGroupInfo(o.context, o.AdminAPIGroupInfoHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1216,7 +1216,7 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/users/{name}/service-accounts"] = admin_api.NewListAUserServiceAccounts(o.context, o.AdminAPIListAUserServiceAccountsHandler)
|
||||
o.handlers["GET"]["/user/service-accounts"] = admin_api.NewListAUserServiceAccounts(o.context, o.AdminAPIListAUserServiceAccountsHandler)
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers["GET"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1340,7 +1340,7 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/groups/{name}"] = admin_api.NewRemoveGroup(o.context, o.AdminAPIRemoveGroupHandler)
|
||||
o.handlers["DELETE"]["/group"] = admin_api.NewRemoveGroup(o.context, o.AdminAPIRemoveGroupHandler)
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1348,7 +1348,7 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers["DELETE"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/users/{name}"] = admin_api.NewRemoveUser(o.context, o.AdminAPIRemoveUserHandler)
|
||||
o.handlers["DELETE"]["/user"] = admin_api.NewRemoveUser(o.context, o.AdminAPIRemoveUserHandler)
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers["POST"] = make(map[string]http.Handler)
|
||||
}
|
||||
@@ -1404,15 +1404,15 @@ func (o *ConsoleAPI) initHandlerCache() {
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/groups/{name}"] = admin_api.NewUpdateGroup(o.context, o.AdminAPIUpdateGroupHandler)
|
||||
o.handlers["PUT"]["/group"] = admin_api.NewUpdateGroup(o.context, o.AdminAPIUpdateGroupHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/users/{name}/groups"] = admin_api.NewUpdateUserGroups(o.context, o.AdminAPIUpdateUserGroupsHandler)
|
||||
o.handlers["PUT"]["/user/groups"] = admin_api.NewUpdateUserGroups(o.context, o.AdminAPIUpdateUserGroupsHandler)
|
||||
if o.handlers["PUT"] == nil {
|
||||
o.handlers["PUT"] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/users/{name}"] = admin_api.NewUpdateUserInfo(o.context, o.AdminAPIUpdateUserInfoHandler)
|
||||
o.handlers["PUT"]["/user"] = admin_api.NewUpdateUserInfo(o.context, o.AdminAPIUpdateUserInfoHandler)
|
||||
}
|
||||
|
||||
// Serve creates a http handler to serve the API over HTTP
|
||||
|
||||
@@ -1207,13 +1207,13 @@ paths:
|
||||
tags:
|
||||
- AdminAPI
|
||||
|
||||
/users/{name}:
|
||||
/user:
|
||||
get:
|
||||
summary: Get User Info
|
||||
operationId: GetUserInfo
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
@@ -1232,7 +1232,7 @@ paths:
|
||||
operationId: UpdateUserInfo
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
@@ -1256,7 +1256,7 @@ paths:
|
||||
operationId: RemoveUser
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
@@ -1269,13 +1269,13 @@ paths:
|
||||
tags:
|
||||
- AdminAPI
|
||||
|
||||
/users/{name}/groups:
|
||||
/user/groups:
|
||||
put:
|
||||
summary: Update Groups for a user
|
||||
operationId: UpdateUserGroups
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
@@ -1295,13 +1295,13 @@ paths:
|
||||
tags:
|
||||
- AdminAPI
|
||||
|
||||
/users/{name}/service-accounts:
|
||||
/user/service-accounts:
|
||||
get:
|
||||
summary: returns a list of service accounts for a user
|
||||
operationId: ListAUserServiceAccounts
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
@@ -1381,13 +1381,13 @@ paths:
|
||||
tags:
|
||||
- AdminAPI
|
||||
|
||||
/groups/{name}:
|
||||
/group:
|
||||
get:
|
||||
summary: Group info
|
||||
operationId: GroupInfo
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
@@ -1406,7 +1406,7 @@ paths:
|
||||
operationId: RemoveGroup
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
responses:
|
||||
@@ -1423,7 +1423,7 @@ paths:
|
||||
operationId: UpdateGroup
|
||||
parameters:
|
||||
- name: name
|
||||
in: path
|
||||
in: query
|
||||
required: true
|
||||
type: string
|
||||
- name: body
|
||||
|
||||
Reference in New Issue
Block a user