Skip to content

Commit

Permalink
Merge pull request #775 from AnuGayan/main-4.4.0-alpha
Browse files Browse the repository at this point in the history
Fix issue related to add Key Manager form
  • Loading branch information
AnuGayan authored Oct 7, 2024
2 parents 1dcc131 + 2c396fb commit b42e2bc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ function AddEditKeyManager(props) {
setSaving(true);

let promisedAddKeyManager;
const newTokenValidation = (tokenValidation.length > 0 && tokenValidation[0].type === '')
? [] : tokenValidation;
const newTokenValidation = (tokenValidation.length > 0 && (tokenValidation[0].type === ''
|| tokenValidation[0].type === 'NONE')) ? [] : tokenValidation;
let tokenType;
if (enableDirectToken && enableExchangeToken) {
tokenType = 'BOTH';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ export default function KeyValidation(props) {
onChange={onChange}
fullWidth
>
<MenuItem value='NONE'>
<FormattedMessage id='KeyManager.KeyValidation.NONE' defaultMessage='NONE' />
</MenuItem>
<MenuItem value='REFERENCE'>
<FormattedMessage id='KeyManager.KeyValidation.REFERENCE' defaultMessage='REFERENCE' />
</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const StyledTableRow = styled(TableRow)((
},

[`& .${classes.dropDown}`]: {
width: theme.spacing(11.25),
width: 120,
},

[`& .${classes.divider}`]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import React, { Component } from 'react';
import { styled, useTheme } from '@mui/material/styles';
import PropTypes from 'prop-types';

import { isRestricted } from 'AppData/AuthManager';
import AuthManager, { isRestricted } from 'AppData/AuthManager';
import LifeCycleIcon from '@mui/icons-material/Autorenew';
import StoreIcon from '@mui/icons-material/Store';
import DashboardIcon from '@mui/icons-material/Dashboard';
Expand Down Expand Up @@ -712,6 +712,7 @@ class Details extends Component {
const uuid = match.params.apiUUID || match.params.api_uuid || match.params.apiProdUUID;
const pathPrefix = '/' + (isAPIProduct ? 'api-products' : 'apis') + '/' + uuid + '/';
const redirectUrl = pathPrefix;
const readOnlyUser = AuthManager.isReadOnlyUser();
const isAsyncAPI = api && (api.type === 'WS' || api.type === 'WEBSUB' || api.type === 'SSE'
|| api.type === 'ASYNC');
if (apiNotFound) {
Expand Down Expand Up @@ -834,7 +835,7 @@ class Details extends Component {
/>
</>
)}
{(isAPIProduct || (!isAPIProduct && !api.isWebSocket() && !api.isGraphql()
{!readOnlyUser && (isAPIProduct || (!isAPIProduct && !api.isWebSocket() && !api.isGraphql()
&& !isAsyncAPI)) && (
<div>
<Divider />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,10 @@ class AuthManager {
return false;
} else {
const arrayLength = AuthManager.getUser().scopes.length;
if (arrayLength === 3) {
if (arrayLength === 5) {
return intersectionBy(AuthManager.getUser().scopes,
['apim:api_view', 'apim:publisher_settings', 'openid']);
['apim:api_view', 'apim:publisher_settings', 'openid', 'apim:gateway_policy_view',
'apim:common_operation_policy_view']);
}
return false;
}
Expand Down

0 comments on commit b42e2bc

Please sign in to comment.