diff --git a/awx/ui/client/src/shared/form-generator.js b/awx/ui/client/src/shared/form-generator.js
index d487efa925..0d66226088 100644
--- a/awx/ui/client/src/shared/form-generator.js
+++ b/awx/ui/client/src/shared/form-generator.js
@@ -1760,6 +1760,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
if (this.form.horizontal) {
html += "\n";
}
+ html += '';
}
}
diff --git a/awx/ui/client/src/shared/stateDefinitions.factory.js b/awx/ui/client/src/shared/stateDefinitions.factory.js
index b76c5b5a36..62b7f9cb68 100644
--- a/awx/ui/client/src/shared/stateDefinitions.factory.js
+++ b/awx/ui/client/src/shared/stateDefinitions.factory.js
@@ -230,7 +230,74 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
*/
generateFormListDefinitions: function(form, formStateDefinition) {
- function buildPermissionDirective() {
+ function buildRbacUserTeamDirective(){
+ let states = [];
+
+ states.push($stateExtender.buildDefinition({
+ name: `${formStateDefinition.name}.permissions.add`,
+ squashSearchUrl: true,
+ url: '/add-permissions',
+ params: {
+ project_search: {
+ value: {order_by: 'name', page_size: '5'},
+ dynamic: true
+ },
+ template_search: {
+ value: {order_by: 'name', page_size: '5', type: 'workflow_job_template,job_template'}, // @issue and also system_job_template?
+ dynamic: true
+ },
+ inventory_search: {
+ value: {order_by: 'name', page_size: '5'},
+ dynamic: true
+ },
+ credential_search: {
+ value: {order_by: 'name', page_size: '5'},
+ dynamic: true
+ }
+ },
+ views: {
+ [`modal@${formStateDefinition.name}`]: {
+ template: ``
+ }
+ },
+ resolve: {
+ templatesDataset: ['TemplateList', 'QuerySet', '$stateParams', 'GetBasePath',
+ function(list, qs, $stateParams, GetBasePath) {
+ let path = GetBasePath(list.basePath) || GetBasePath(list.name);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ projectsDataset: ['ProjectList', 'QuerySet', '$stateParams', 'GetBasePath',
+ function(list, qs, $stateParams, GetBasePath) {
+ let path = GetBasePath(list.basePath) || GetBasePath(list.name);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ inventoriesDataset: ['InventoryList', 'QuerySet', '$stateParams', 'GetBasePath',
+ function(list, qs, $stateParams, GetBasePath) {
+ let path = GetBasePath(list.basePath) || GetBasePath(list.name);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ credentialsDataset: ['CredentialList', 'QuerySet', '$stateParams', 'GetBasePath',
+ function(list, qs, $stateParams, GetBasePath) {
+ let path = GetBasePath(list.basePath) || GetBasePath(list.name);
+ return qs.search(path, $stateParams[`${list.iterator}_search`]);
+ }
+ ],
+ },
+ onExit: function($state) {
+ if ($state.transition) {
+ $('#add-permissions-modal').modal('hide');
+ $('.modal-backdrop').remove();
+ $('body').removeClass('modal-open');
+ }
+ },
+ }));
+ return states;
+ }
+
+ function buildRbacResourceDirective() {
let states = [];
states.push($stateExtender.buildDefinition({
@@ -249,7 +316,7 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
},
views: {
[`modal@${formStateDefinition.name}`]: {
- template: ``
+ template: ``
}
},
resolve: {
@@ -282,7 +349,13 @@ export default ['$injector', '$stateExtender', '$log', function($injector, $stat
let states = [];
states.push(buildListDefinition(field));
if (field.iterator === 'permission' && field.actions && field.actions.add) {
- states.push(buildPermissionDirective());
+ if (form.name === 'user' || form.name === 'team'){
+ states.push(buildRbacUserTeamDirective());
+
+ }
+ else {
+ states.push(buildRbacResourceDirective());
+ }
states = _.flatten(states);
}
return states;