mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
configured rbac fro creds, jts, orgs, and invs
This commit is contained in:
parent
4c6576da24
commit
b6d6fb556a
@ -329,7 +329,8 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
form = CredentialForm,
|
||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||
master = {},
|
||||
id = $stateParams.credential_id;
|
||||
id = $stateParams.credential_id,
|
||||
relatedSets = {};
|
||||
|
||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||
generator.reset();
|
||||
@ -378,6 +379,10 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
$scope.removeCredentialLoaded();
|
||||
}
|
||||
$scope.removeCredentialLoaded = $scope.$on('credentialLoaded', function () {
|
||||
var set;
|
||||
for (set in relatedSets) {
|
||||
$scope.search(relatedSets[set].iterator);
|
||||
}
|
||||
var orgUrl = ($rootScope.current_user.is_superuser) ?
|
||||
GetBasePath("organizations") :
|
||||
$rootScope.current_user.url + "admin_of_organizations?";
|
||||
@ -421,6 +426,13 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
Rest.setUrl(defaultUrl + ':id/');
|
||||
Rest.get({ params: { id: id } })
|
||||
.success(function (data) {
|
||||
if (data && data.summary_fields &&
|
||||
data.summary_fields.organization &&
|
||||
data.summary_fields.organization.id) {
|
||||
$scope.needsRoleList = true;
|
||||
} else {
|
||||
$scope.needsRoleList = false;
|
||||
}
|
||||
|
||||
$scope.credential_name = data.name;
|
||||
|
||||
@ -439,6 +451,7 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
|
||||
}
|
||||
}
|
||||
relatedSets = form.relatedSets(data.related);
|
||||
|
||||
if (!Empty($scope.user)) {
|
||||
$scope.owner = 'user';
|
||||
@ -509,6 +522,17 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||
$scope.subscription_id = data.username;
|
||||
|
||||
}
|
||||
$scope.credential_obj = data;
|
||||
|
||||
RelatedSearchInit({
|
||||
scope: $scope,
|
||||
form: form,
|
||||
relatedSets: relatedSets
|
||||
});
|
||||
RelatedPaginateInit({
|
||||
scope: $scope,
|
||||
relatedSets: relatedSets
|
||||
});
|
||||
|
||||
$scope.$emit('credentialLoaded');
|
||||
})
|
||||
|
||||
@ -364,6 +364,47 @@ export default
|
||||
}
|
||||
},
|
||||
|
||||
related: {}
|
||||
related: {
|
||||
permissions: {
|
||||
type: 'collection',
|
||||
title: 'Permissions',
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
searchType: 'select',
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "addPermission",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'User',
|
||||
linkBase: 'users',
|
||||
class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4'
|
||||
},
|
||||
role: {
|
||||
label: 'Role',
|
||||
type: 'role',
|
||||
noSort: true,
|
||||
class: 'col-lg-9 col-md-9 col-sm-9 col-xs-8'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
relatedSets: function(urls) {
|
||||
return {
|
||||
permissions: {
|
||||
iterator: 'permission',
|
||||
url: urls.access_list
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
@ -150,6 +150,38 @@ export default
|
||||
awToolTip: 'Delete the scan job template'
|
||||
}
|
||||
}
|
||||
},
|
||||
permissions: {
|
||||
type: 'collection',
|
||||
title: 'Permissions',
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
searchType: 'select',
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "addPermission",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'User',
|
||||
linkBase: 'users',
|
||||
class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4'
|
||||
},
|
||||
role: {
|
||||
label: 'Role',
|
||||
type: 'role',
|
||||
noSort: true,
|
||||
class: 'col-lg-9 col-md-9 col-sm-9 col-xs-8'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -158,6 +190,10 @@ export default
|
||||
scan_job_templates: {
|
||||
iterator: 'scan_job_template',
|
||||
url: urls.scan_job_templates
|
||||
},
|
||||
permissions: {
|
||||
iterator: 'permission',
|
||||
url: urls.access_list
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -369,6 +369,38 @@ export default
|
||||
},
|
||||
"completed_jobs": {
|
||||
include: "CompletedJobsList"
|
||||
},
|
||||
permissions: {
|
||||
type: 'collection',
|
||||
title: 'Permissions',
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
searchType: 'select',
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "addPermission",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'User',
|
||||
linkBase: 'users',
|
||||
class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4'
|
||||
},
|
||||
role: {
|
||||
label: 'Role',
|
||||
type: 'role',
|
||||
noSort: true,
|
||||
class: 'col-lg-9 col-md-9 col-sm-9 col-xs-8'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -381,6 +413,10 @@ export default
|
||||
schedules: {
|
||||
iterator: 'schedule',
|
||||
url: urls.schedules
|
||||
},
|
||||
permissions: {
|
||||
iterator: 'permission',
|
||||
url: urls.access_list
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -139,8 +139,48 @@ export default
|
||||
awToolTip: 'Remove administrator'
|
||||
}
|
||||
}
|
||||
},
|
||||
permissions: {
|
||||
type: 'collection',
|
||||
title: 'Permissions',
|
||||
iterator: 'permission',
|
||||
index: false,
|
||||
open: false,
|
||||
searchType: 'select',
|
||||
actions: {
|
||||
add: {
|
||||
ngClick: "addPermission",
|
||||
label: 'Add',
|
||||
awToolTip: 'Add a permission',
|
||||
actionClass: 'btn List-buttonSubmit',
|
||||
buttonContent: '+ ADD'
|
||||
}
|
||||
},
|
||||
|
||||
fields: {
|
||||
username: {
|
||||
key: true,
|
||||
label: 'User',
|
||||
linkBase: 'users',
|
||||
class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4'
|
||||
},
|
||||
role: {
|
||||
label: 'Role',
|
||||
type: 'role',
|
||||
noSort: true,
|
||||
class: 'col-lg-9 col-md-9 col-sm-9 col-xs-8'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
relatedSets: function(urls) {
|
||||
return {
|
||||
permissions: {
|
||||
iterator: 'permission',
|
||||
url: urls.access_list
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}); //OrganizationForm
|
||||
|
||||
@ -76,6 +76,7 @@ angular.module('JobTemplatesHelper', ['Utilities'])
|
||||
Rest.setUrl(defaultUrl + id);
|
||||
Rest.get()
|
||||
.success(function (data) {
|
||||
scope.job_template_obj = data;
|
||||
var fld, i;
|
||||
for (fld in form.fields) {
|
||||
if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) {
|
||||
|
||||
@ -103,6 +103,9 @@ function InventoriesEdit($scope, $rootScope, $compile, $location,
|
||||
field: 'organization',
|
||||
input_type: 'radio'
|
||||
});
|
||||
|
||||
$scope.inventory_obj = data;
|
||||
|
||||
$scope.$emit('inventoryLoaded');
|
||||
})
|
||||
.error(function (data, status) {
|
||||
|
||||
@ -66,9 +66,12 @@ export default ['$scope', '$rootScope', '$compile', '$location',
|
||||
};
|
||||
}
|
||||
}
|
||||
angular.extend(relatedSets, form
|
||||
.relatedSets(data.related));
|
||||
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
|
||||
RelatedSearchInit({ scope: $scope, form: form, relatedSets: relatedSets });
|
||||
RelatedPaginateInit({ scope: $scope, relatedSets: relatedSets });
|
||||
$scope.organization_obj = data;
|
||||
$scope.$emit('organizationLoaded');
|
||||
})
|
||||
.error(function (data, status) {
|
||||
|
||||
@ -33,6 +33,8 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
|
||||
url: defaultUrl,
|
||||
});
|
||||
|
||||
$scope.list = list;
|
||||
|
||||
$scope.search(list.iterator);
|
||||
|
||||
$scope.PaginateWidget = PaginateWidget({
|
||||
|
||||
@ -205,7 +205,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
this.scope.mode = options.mode;
|
||||
}
|
||||
|
||||
if(options.mode === 'edit' && this.form.tabs){
|
||||
if(options.mode === 'edit' && this.form.related &&
|
||||
!_.isEmpty(this.form.related)){
|
||||
var tabs = [this.form.name], that = this;
|
||||
tabs.push(Object.keys(this.form.related));
|
||||
tabs = _.flatten(tabs);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user