Skip to content

Commit 5a4db41

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-fmodel-endpoint
2 parents 560840c + 037d3f1 commit 5a4db41

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

src/api.authz.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,4 +1139,10 @@ describe('API authz tests', () => {
11391139
await agent.post('/alpha/teams/team1/agents').send(agentData).expect(401)
11401140
})
11411141
})
1142+
test('team member cannot access settings', async () => {
1143+
await agent.get('/v1/settings').set('Authorization', `Bearer ${teamMemberToken}`).expect(403)
1144+
})
1145+
test('team admin cannot access settings', async () => {
1146+
await agent.get('/v1/settings').set('Authorization', `Bearer ${teamAdminToken}`).expect(403)
1147+
})
11421148
})

src/api/v1/dashboard.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const debug = Debug('otomi:api:v1:dashboard')
99
* Get dashboard information
1010
*/
1111
export const getDashboard = (req: OpenApiRequestExt, res: Response): void => {
12-
const { teamName } = req.query
13-
debug(`getDashboard(${teamName})`)
14-
const v = req.otomi.getDashboard(teamName as string)
12+
const { teamId } = req.query
13+
debug(`getDashboard(${teamId})`)
14+
const v = req.otomi.getDashboard(teamId as string)
1515
res.json(v)
1616
}

src/openapi/settings.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
Settings:
22
x-acl:
33
platformAdmin: [read-any, update-any]
4-
teamAdmin: [read]
5-
teamMember: [read]
64
additionalProperties: false
75
properties:
86
alerts:

src/otomi-stack.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,13 +1278,13 @@ export default class OtomiStack {
12781278
return internalRepoUrls
12791279
}
12801280

1281-
getDashboard(teamName: string): Array<any> {
1282-
const codeRepos = teamName ? this.getTeamAplCodeRepos(teamName) : this.getAllCodeRepos()
1283-
const builds = teamName ? this.getTeamAplBuilds(teamName) : this.getAllBuilds()
1284-
const workloads = teamName ? this.getTeamAplWorkloads(teamName) : this.getAllWorkloads()
1285-
const services = teamName ? this.getTeamAplServices(teamName) : this.getAllServices()
1286-
const secrets = teamName ? this.getAplSealedSecrets(teamName) : this.getAllAplSealedSecrets()
1287-
const netpols = teamName ? this.getTeamAplNetpols(teamName) : this.getAllNetpols()
1281+
getDashboard(teamId: string): Array<any> {
1282+
const codeRepos = teamId ? this.getTeamAplCodeRepos(teamId) : this.getAllCodeRepos()
1283+
const builds = teamId ? this.getTeamAplBuilds(teamId) : this.getAllBuilds()
1284+
const workloads = teamId ? this.getTeamAplWorkloads(teamId) : this.getAllWorkloads()
1285+
const services = teamId ? this.getTeamAplServices(teamId) : this.getAllServices()
1286+
const secrets = teamId ? this.getAplSealedSecrets(teamId) : this.getAllAplSealedSecrets()
1287+
const netpols = teamId ? this.getTeamAplNetpols(teamId) : this.getAllNetpols()
12881288

12891289
return [
12901290
{ name: 'code-repositories', count: codeRepos?.length },

0 commit comments

Comments
 (0)