[Security] Don't return all servers on the system when not a root admin and admin level servers are requested
Cleaned up the API endpoint by simplifying the logic and adds test case to cover this bug. If you ever need to list _all_ of the servers on the system you should be using the application API endpoint for the servers most likely.
This commit is contained in:
parent
24db6d9128
commit
f0ac0725b6
6 changed files with 84 additions and 88 deletions
|
@ -4,14 +4,14 @@ import http, { getPaginationSet, PaginatedResult } from '@/api/http';
|
|||
interface QueryParams {
|
||||
query?: string;
|
||||
page?: number;
|
||||
includeAdmin?: boolean;
|
||||
onlyAdmin?: boolean;
|
||||
}
|
||||
|
||||
export default ({ query, page = 1, includeAdmin = false }: QueryParams): Promise<PaginatedResult<Server>> => {
|
||||
export default ({ query, page = 1, onlyAdmin = false }: QueryParams): Promise<PaginatedResult<Server>> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
http.get('/api/client', {
|
||||
params: {
|
||||
type: includeAdmin ? 'all' : undefined,
|
||||
type: onlyAdmin ? 'admin' : undefined,
|
||||
'filter[name]': query,
|
||||
page,
|
||||
},
|
||||
|
|
Reference in a new issue