Merge "Fix whitelabel authz"

This commit is contained in:
Zuul
2025-01-30 01:54:41 +00:00
committed by Gerrit Code Review
2 changed files with 7 additions and 6 deletions

View File

@@ -65,8 +65,9 @@ const fetchUserACLFail = error => ({
})
export const fetchUserACL = (tenant) => (dispatch) => {
dispatch(fetchUserACLRequest(tenant))
let apiPrefix = tenant? 'tenant/' + tenant + '/' : ''
dispatch(fetchUserACLRequest(tenant? tenant.name : null))
// tenant.name will be null if we're at the root
const apiPrefix = tenant && tenant.name ? tenant.apiPrefix : ''
return API.fetchUserAuthorizations(apiPrefix)
.then(response => dispatch(fetchUserACLSuccess(response.data)))
.catch(error => {

View File

@@ -109,8 +109,8 @@ class AuthContainer extends React.Component {
this.props.userManager.events.addUserLoaded(this.onUserLoaded)
if (user.data) {
console.log('Refreshing ACL', user.tenant, tenant.name)
this.props.dispatch(fetchUserACL(tenant? tenant.name : null))
console.log('Refreshing ACL', user.tenant, tenant)
this.props.dispatch(fetchUserACL(tenant))
}
}
@@ -124,8 +124,8 @@ class AuthContainer extends React.Component {
// Make sure the token is current and the tenant is up to date.
if (user.data && user.tenant !== tenant.name) {
console.log('Refreshing ACL', user.tenant, tenant.name)
this.props.dispatch(fetchUserACL(tenant? tenant.name : null))
console.log('Refreshing ACL', user.tenant, tenant)
this.props.dispatch(fetchUserACL(tenant))
}
}