mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 19:51:08 -03:30
configured rbac fro creds, jts, orgs, and invs
This commit is contained in:
@@ -329,7 +329,8 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
form = CredentialForm,
|
form = CredentialForm,
|
||||||
base = $location.path().replace(/^\//, '').split('/')[0],
|
base = $location.path().replace(/^\//, '').split('/')[0],
|
||||||
master = {},
|
master = {},
|
||||||
id = $stateParams.credential_id;
|
id = $stateParams.credential_id,
|
||||||
|
relatedSets = {};
|
||||||
|
|
||||||
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
generator.inject(form, { mode: 'edit', related: true, scope: $scope });
|
||||||
generator.reset();
|
generator.reset();
|
||||||
@@ -378,6 +379,10 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
$scope.removeCredentialLoaded();
|
$scope.removeCredentialLoaded();
|
||||||
}
|
}
|
||||||
$scope.removeCredentialLoaded = $scope.$on('credentialLoaded', function () {
|
$scope.removeCredentialLoaded = $scope.$on('credentialLoaded', function () {
|
||||||
|
var set;
|
||||||
|
for (set in relatedSets) {
|
||||||
|
$scope.search(relatedSets[set].iterator);
|
||||||
|
}
|
||||||
var orgUrl = ($rootScope.current_user.is_superuser) ?
|
var orgUrl = ($rootScope.current_user.is_superuser) ?
|
||||||
GetBasePath("organizations") :
|
GetBasePath("organizations") :
|
||||||
$rootScope.current_user.url + "admin_of_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.setUrl(defaultUrl + ':id/');
|
||||||
Rest.get({ params: { id: id } })
|
Rest.get({ params: { id: id } })
|
||||||
.success(function (data) {
|
.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;
|
$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];
|
$scope[form.fields[fld].sourceModel + '_' + form.fields[fld].sourceField];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
relatedSets = form.relatedSets(data.related);
|
||||||
|
|
||||||
if (!Empty($scope.user)) {
|
if (!Empty($scope.user)) {
|
||||||
$scope.owner = 'user';
|
$scope.owner = 'user';
|
||||||
@@ -509,6 +522,17 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
$scope.subscription_id = data.username;
|
$scope.subscription_id = data.username;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$scope.credential_obj = data;
|
||||||
|
|
||||||
|
RelatedSearchInit({
|
||||||
|
scope: $scope,
|
||||||
|
form: form,
|
||||||
|
relatedSets: relatedSets
|
||||||
|
});
|
||||||
|
RelatedPaginateInit({
|
||||||
|
scope: $scope,
|
||||||
|
relatedSets: relatedSets
|
||||||
|
});
|
||||||
|
|
||||||
$scope.$emit('credentialLoaded');
|
$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'
|
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: {
|
scan_job_templates: {
|
||||||
iterator: 'scan_job_template',
|
iterator: 'scan_job_template',
|
||||||
url: urls.scan_job_templates
|
url: urls.scan_job_templates
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
iterator: 'permission',
|
||||||
|
url: urls.access_list
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,6 +369,38 @@ export default
|
|||||||
},
|
},
|
||||||
"completed_jobs": {
|
"completed_jobs": {
|
||||||
include: "CompletedJobsList"
|
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: {
|
schedules: {
|
||||||
iterator: 'schedule',
|
iterator: 'schedule',
|
||||||
url: urls.schedules
|
url: urls.schedules
|
||||||
|
},
|
||||||
|
permissions: {
|
||||||
|
iterator: 'permission',
|
||||||
|
url: urls.access_list
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,8 +139,48 @@ export default
|
|||||||
awToolTip: 'Remove administrator'
|
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
|
}); //OrganizationForm
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ angular.module('JobTemplatesHelper', ['Utilities'])
|
|||||||
Rest.setUrl(defaultUrl + id);
|
Rest.setUrl(defaultUrl + id);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
|
scope.job_template_obj = data;
|
||||||
var fld, i;
|
var fld, i;
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) {
|
if (fld !== 'variables' && data[fld] !== null && data[fld] !== undefined) {
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ function InventoriesEdit($scope, $rootScope, $compile, $location,
|
|||||||
field: 'organization',
|
field: 'organization',
|
||||||
input_type: 'radio'
|
input_type: 'radio'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.inventory_obj = data;
|
||||||
|
|
||||||
$scope.$emit('inventoryLoaded');
|
$scope.$emit('inventoryLoaded');
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.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.
|
// Initialize related search functions. Doing it here to make sure relatedSets object is populated.
|
||||||
RelatedSearchInit({ scope: $scope, form: form, relatedSets: relatedSets });
|
RelatedSearchInit({ scope: $scope, form: form, relatedSets: relatedSets });
|
||||||
RelatedPaginateInit({ scope: $scope, relatedSets: relatedSets });
|
RelatedPaginateInit({ scope: $scope, relatedSets: relatedSets });
|
||||||
|
$scope.organization_obj = data;
|
||||||
$scope.$emit('organizationLoaded');
|
$scope.$emit('organizationLoaded');
|
||||||
})
|
})
|
||||||
.error(function (data, status) {
|
.error(function (data, status) {
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
|
|||||||
url: defaultUrl,
|
url: defaultUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.list = list;
|
||||||
|
|
||||||
$scope.search(list.iterator);
|
$scope.search(list.iterator);
|
||||||
|
|
||||||
$scope.PaginateWidget = PaginateWidget({
|
$scope.PaginateWidget = PaginateWidget({
|
||||||
|
|||||||
@@ -205,7 +205,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
this.scope.mode = options.mode;
|
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;
|
var tabs = [this.form.name], that = this;
|
||||||
tabs.push(Object.keys(this.form.related));
|
tabs.push(Object.keys(this.form.related));
|
||||||
tabs = _.flatten(tabs);
|
tabs = _.flatten(tabs);
|
||||||
|
|||||||
Reference in New Issue
Block a user