Merge pull request #5630 from jakemcdermott/fix-5586

Use summary `object_roles` to lookup admin role id

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-01-13 17:05:02 +00:00
committed by GitHub

View File

@@ -26,11 +26,9 @@ function($scope, $rootScope, ProcessErrors, GetBasePath, generateList,
let notAdminAlreadyParams = {}; let notAdminAlreadyParams = {};
if ($scope.addType === 'Administrators') { if ($scope.addType === 'Administrators') {
Rest.setUrl(GetBasePath('organizations') + `${$state.params.organization_id}/object_roles`); Rest.setUrl(GetBasePath('organizations') + `${$state.params.organization_id}`);
Rest.get().then(({data}) => { Rest.get().then(({data}) => {
notAdminAlreadyParams.not__roles = data.results notAdminAlreadyParams.not__roles = data.summary_fields.object_roles.admin_role.id;
.filter(({name}) => name === i18n._('Admin'))
.map(({id}) => id)[0];
init(); init();
}); });
} else { } else {