diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentAdd.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentAdd.jsx index 56c50448085..534c2ade0cf 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentAdd.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentAdd.jsx @@ -26,7 +26,7 @@ import { FormattedMessage, injectIntl } from 'react-intl'; import Alert from 'AppComponents/Shared/Alert'; import CommentsAPI from 'AppData/Comments'; import MCPServer from 'AppData/MCPServer'; -import { isRestricted } from 'AppData/AuthManager'; +import AuthManager from 'AppData/AuthManager'; const PREFIX = 'CommentAdd'; @@ -192,12 +192,8 @@ class CommentAdd extends React.Component { * @returns {boolean} - True if access is restricted, false otherwise */ isAccessRestricted() { - const { api } = this.props; - if (api.apiType.toUpperCase() === MCPServer.CONSTS.MCP) { - return isRestricted(['apim:comment_write', 'apim:comment_manage'], api); - } else { - return isRestricted(['apim:api_create', 'apim:api_publish'], api); - } + const user = AuthManager.getUser(); + return !user.scopes.includes("apim:comment_write") && !user.scopes.includes("apim:comment_manage"); } /** diff --git a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentOptions.jsx b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentOptions.jsx index 685f7273ce9..ee01698be35 100644 --- a/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentOptions.jsx +++ b/portals/publisher/src/main/webapp/source/src/app/components/Apis/Details/Comments/CommentOptions.jsx @@ -171,7 +171,7 @@ class CommentOptions extends React.Component { const user = AuthManager.getUser(); const username = Utils.getUserNameWithoutDomain(user.name); const canDelete = (comment.createdBy === username) || user.isAdmin(); - const canReply = !user.isCreator() || user.isAdmin(); + const canReply = user.scopes.includes("apim:comment_write") || user.scopes.includes("apim:comment_manage"); // const canModify = comment.createdBy === username; return (