diff options
4 files changed, 27 insertions, 14 deletions
diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java index 22d81a73dc..1f56c1038a 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/main/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImpl.java @@ -56,7 +56,8 @@ public class PermissionsRulesImpl implements PermissionsRules { break; case Submit_Item: - if (permission.equals(PermissionTypes.Owner.name())) { + if (permission.equals(PermissionTypes.Contributor.name()) || permission.equals + (PermissionTypes.Owner.name())) { return true; } break; diff --git a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/test/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImplTest.java b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/test/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImplTest.java index 635a0b2a25..c2a193103a 100644 --- a/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/test/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImplTest.java +++ b/openecomp-be/lib/openecomp-item-permissions-lib/openecomp-item-permissions-impl/src/test/java/org/openecomp/sdc/itempermissions/impl/PermissionsRulesImplTest.java @@ -61,7 +61,7 @@ public class PermissionsRulesImplTest { @Test public void testIsAllowedCaseSubmitNotOwner(){ - Assert.assertFalse(permissionsRules.isAllowed(PERMISSION_CONTRIBUTOR,SUBMIT_ACTION)); + Assert.assertTrue(permissionsRules.isAllowed(PERMISSION_CONTRIBUTOR,SUBMIT_ACTION)); } @Test diff --git a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx index 4346a0e5dc..88ea9c6e3a 100644 --- a/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx +++ b/openecomp-ui/src/nfvo-components/panel/versionController/components/ActionButtons.jsx @@ -1,5 +1,5 @@ /*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2016-2017 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,7 +83,7 @@ const ActionButtons = ({isReadOnlyMode, onSubmit, onRevert, onSave, isFormDataVa <VCButton dataTestId='vc-revert-btn' onClick={onOpenRevisionsModal} name='version-controller-revert' tooltipText={i18n('Revert')} disabled={isReadOnlyMode || isOutOfSync} /> } - {onSubmit && (permissions.owner && permissions.owner.userId === userInfo.userId) && + {onSubmit && <div className='vc-submit-section'> <Separator /> <SubmitButton onClick={onSubmit} diff --git a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js index 64304ab9de..73dd6b6977 100644 --- a/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js +++ b/openecomp-ui/test/nfvo-components/panel/VersionController/versionController.test.js @@ -1,17 +1,17 @@ -/* +/*! * Copyright © 2016-2017 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. */ @@ -105,13 +105,25 @@ describe('versionController UI Component', () => { expect(elem.length).toBe(1); }); - it('Doesn\'t show the submit button when user is not owner', () => { - const permissions = {owner: {userId: '111'}}, - userInfo = {userId: '222'}; + it('Shows the submit button when callVCAction available and user is contributor', () => { + const permissions = {owner: {userId: '111'}, contributors: ['232']}, + userInfo = {userId: '232'}; let callVCActionProps = { ...props, callVCAction: function(){}, permissions, userInfo}; let versionController = TestUtils.renderIntoDocument(<Provider store={store}><VersionController {...callVCActionProps} /></Provider>); let elem = scryRenderedDOMComponentsWithTestId(versionController,'vc-submit-btn'); expect(elem).toBeTruthy(); + expect(elem.length).toBe(1); + }); + + it('Doesn\'t show the submit button when user is not owner or contributor', () => { + const permissions = {owner: {userId: '111'}, contributors: ['232']}, + userInfo = {userId: '222'}; + const propsViewer = {...props, + itemPermission: {isCertified: false, isCollaborator: false, isDirty: false}}; + let callVCActionProps = { ...propsViewer, callVCAction: function(){}, permissions, userInfo}; + let versionController = TestUtils.renderIntoDocument(<Provider store={store}><VersionController {...callVCActionProps} /></Provider>); + let elem = scryRenderedDOMComponentsWithTestId(versionController,'vc-submit-btn'); + expect(elem).toBeTruthy(); expect(elem.length).toBe(0); }); |