Skip to content

Commit

Permalink
Users that have AAD login but are not CDP users
Browse files Browse the repository at this point in the history
Should not see the proxy or buckets tabs. Loggin users that are
onboarded to CDP should see these tabs, as should admin
  • Loading branch information
feedmypixel committed Jan 16, 2025
1 parent e12777f commit 6c098b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/server/services/helpers/provide-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
async function provideTabs(request, h) {
const authedUser = await request.getUserSession()
const isAdmin = authedUser?.isAdmin
const isTenant = authedUser?.isTenant
const response = request.response

if (response.variety === 'view') {
Expand Down Expand Up @@ -34,7 +35,7 @@ async function provideTabs(request, h) {
}
]

if (authedUser) {
if (isAdmin || isTenant) {
response.source.context.tabDetails.tabs.push({
isActive: request.path.startsWith(`/services/${imageName}/buckets`),
url: request.routeLookup('services/{serviceId}/buckets', {
Expand Down
9 changes: 6 additions & 3 deletions src/server/services/helpers/provide-tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ describe('#provideTabs', () => {
.mockReturnValueOnce(`/services/${mockServiceName}/secrets`)
.mockReturnValueOnce(`/services/${mockServiceName}/terminal`)
mockUserSession.mockResolvedValue({
isAdmin: true
isAdmin: true,
isTenant: true
})
})

Expand Down Expand Up @@ -129,7 +130,8 @@ describe('#provideTabs', () => {
mockUserIsServiceOwner.mockResolvedValue(true)

mockUserSession.mockResolvedValue({
isAdmin: false
isAdmin: false,
isTenant: true
})
mockRouteLookup
.mockReturnValueOnce(`/services/${mockServiceName}`)
Expand Down Expand Up @@ -222,7 +224,8 @@ describe('#provideTabs', () => {
mockUserIsServiceOwner.mockResolvedValue(false)

mockUserSession.mockResolvedValue({
isAdmin: false
isAdmin: false,
isTenant: true
})
mockRouteLookup
.mockReturnValueOnce(`/services/${mockServiceName}`)
Expand Down

0 comments on commit 6c098b2

Please sign in to comment.