mirror of
https://github.com/ansible/awx.git
synced 2024-10-30 22:21:13 +03:00
Exposes organization notification list to users with notification admin role
This commit is contained in:
parent
70d930e019
commit
1408200927
@ -20,7 +20,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
||||
hover: false,
|
||||
emptyListText: i18n.sprintf(i18n._("This list is populated by notification templates added from the %sNotifications%s section"), " <a ui-sref='notifications.add'>", "</a> "),
|
||||
basePath: 'notification_templates',
|
||||
ngIf: 'current_user.is_superuser || isOrgAdmin',
|
||||
ngIf: 'current_user.is_superuser || isOrgAdmin || isNotificationAdmin',
|
||||
fields: {
|
||||
name: {
|
||||
key: true,
|
||||
@ -40,6 +40,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
||||
flag: 'notification_templates_success',
|
||||
type: "toggle",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_success\")",
|
||||
ngDisabled: "!(current_user.is_superuser || isOrgAdmin)",
|
||||
awToolTip: "{{ schedule.play_tip }}",
|
||||
dataTipWatch: "schedule.play_tip",
|
||||
dataPlacement: "right",
|
||||
@ -51,6 +52,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
||||
flag: 'notification_templates_error',
|
||||
type: "toggle",
|
||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")",
|
||||
ngDisabled: "!(current_user.is_superuser || isOrgAdmin)",
|
||||
awToolTip: "{{ schedule.play_tip }}",
|
||||
dataTipWatch: "schedule.play_tip",
|
||||
dataPlacement: "right",
|
||||
|
@ -5,10 +5,10 @@
|
||||
*************************************************/
|
||||
|
||||
export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
||||
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt',
|
||||
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt', '$rootScope',
|
||||
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'ConfigData',
|
||||
function($scope, $location, $stateParams, OrgAdminLookup,
|
||||
OrganizationForm, Rest, ProcessErrors, Prompt,
|
||||
OrganizationForm, Rest, ProcessErrors, Prompt, $rootScope,
|
||||
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData, ConfigData) {
|
||||
|
||||
let form = OrganizationForm(),
|
||||
@ -26,6 +26,13 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
||||
$scope.isOrgAdmin = isOrgAdmin;
|
||||
});
|
||||
|
||||
Rest.setUrl(GetBasePath('users') + $rootScope.current_user.id + '/roles/?role_field=notification_admin_role');
|
||||
Rest.get()
|
||||
.then(({data}) => {
|
||||
console.log(data);
|
||||
$scope.isNotificationAdmin = (data.count && data.count > 0);
|
||||
});
|
||||
|
||||
$scope.$watch('organization_obj.summary_fields.user_capabilities.edit', function(val) {
|
||||
if (val === false) {
|
||||
$scope.canAdd = false;
|
||||
|
Loading…
Reference in New Issue
Block a user