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
commit 04576af6a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,11 +26,9 @@ function($scope, $rootScope, ProcessErrors, GetBasePath, generateList,
let notAdminAlreadyParams = {};
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}) => {
notAdminAlreadyParams.not__roles = data.results
.filter(({name}) => name === i18n._('Admin'))
.map(({id}) => id)[0];
notAdminAlreadyParams.not__roles = data.summary_fields.object_roles.admin_role.id;
init();
});
} else {