Fix for filtering organizations, and fixing the org lookup on credentials form

This commit is contained in:
jaredevantabor
2017-01-20 17:50:24 -08:00
parent 6c7c4061d1
commit 250340e063
2 changed files with 3 additions and 4 deletions

View File

@@ -43,8 +43,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)' ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
}, },
organization: { organization: {
// interpolated with $rootScope basePath: 'organizations',
basePath: "{{$rootScope.current_user.is_superuser ? 'api/v1/organizations' : $rootScope.current_user.url + 'admin_of_organizations'}}",
ngShow: 'canShareCredential', ngShow: 'canShareCredential',
label: i18n._('Organization'), label: i18n._('Organization'),
type: 'lookup', type: 'lookup',

View File

@@ -686,10 +686,10 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
interpolator = $interpolate(list.basePath); interpolator = $interpolate(list.basePath);
path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams }); path = interpolator({ $rootScope: $rootScope, $stateParams: $stateParams });
} }
// Need to delete the role_level here b/c organizations and inventory scripts // Need to change the role_level here b/c organizations and inventory scripts
// don't have a "use_role", only "admin_role" and "read_role" // don't have a "use_role", only "admin_role" and "read_role"
if(list.iterator === "organization" || list.iterator === "inventory_script"){ if(list.iterator === "organization" || list.iterator === "inventory_script"){
delete $stateParams[`${list.iterator}_search`].role_level; $stateParams[`${list.iterator}_search`].role_level = "admin_role";
} }
return qs.search(path, $stateParams[`${list.iterator}_search`]); return qs.search(path, $stateParams[`${list.iterator}_search`]);
} }