mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Use summary object_roles to lookup admin role id
To find the id of an org's admin role, use the `object_role` names in the organization's summary_fields instead of filtering on potentially translated role names.
This commit is contained in:
parent
200be3297a
commit
cf9f00ab86
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user