From e4c28fed037f0c52f32d5c095586efbbc93a4ad5 Mon Sep 17 00:00:00 2001 From: Jake McDermott Date: Sun, 4 Nov 2018 22:01:08 -0500 Subject: [PATCH] remove admin and member roles from team->organizations role assignment options --- .../add-rbac-user-team/rbac-user-team.controller.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js index f8ecec5446..c0762dea36 100644 --- a/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js +++ b/awx/ui/client/src/access/add-rbac-user-team/rbac-user-team.controller.js @@ -77,8 +77,17 @@ function(scope, $state, i18n, CreateSelect2, Rest, $q, Wait, ProcessErrors) { // aggregate name/descriptions for each available role, based on resource type // reasoning: - function aggregateKey(item, type){ - _.merge(scope.keys[type], item.summary_fields.object_roles); + function aggregateKey(item, type) { + const ownerType = _.get(scope, ['owner', 'type']); + const { object_roles } = item.summary_fields; + + if (ownerType === 'team' && type === 'organizations') { + // some organization object_roles aren't allowed for teams + delete object_roles.admin_role; + delete object_roles.member_role; + } + + _.merge(scope.keys[type], object_roles); } scope.closeModal = function() {