mirror of
https://github.com/ansible/awx.git
synced 2026-03-10 05:59:28 -02:30
Merge pull request #2943 from mabashian/2930-notif-admin-v2
Exposes organization notification list to users with notification admin role
This commit is contained in:
@@ -20,7 +20,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
|||||||
hover: false,
|
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> "),
|
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',
|
basePath: 'notification_templates',
|
||||||
ngIf: 'current_user.is_superuser || isOrgAdmin',
|
ngIf: 'current_user.is_superuser || isOrgAdmin || isNotificationAdmin',
|
||||||
fields: {
|
fields: {
|
||||||
name: {
|
name: {
|
||||||
key: true,
|
key: true,
|
||||||
@@ -40,6 +40,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
|||||||
flag: 'notification_templates_success',
|
flag: 'notification_templates_success',
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_success\")",
|
ngClick: "toggleNotification($event, notification.id, \"notification_templates_success\")",
|
||||||
|
ngDisabled: "!(current_user.is_superuser || isOrgAdmin)",
|
||||||
awToolTip: "{{ schedule.play_tip }}",
|
awToolTip: "{{ schedule.play_tip }}",
|
||||||
dataTipWatch: "schedule.play_tip",
|
dataTipWatch: "schedule.play_tip",
|
||||||
dataPlacement: "right",
|
dataPlacement: "right",
|
||||||
@@ -51,6 +52,7 @@ export default ['i18n', 'templateUrl', function(i18n, templateUrl){
|
|||||||
flag: 'notification_templates_error',
|
flag: 'notification_templates_error',
|
||||||
type: "toggle",
|
type: "toggle",
|
||||||
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")",
|
ngClick: "toggleNotification($event, notification.id, \"notification_templates_error\")",
|
||||||
|
ngDisabled: "!(current_user.is_superuser || isOrgAdmin)",
|
||||||
awToolTip: "{{ schedule.play_tip }}",
|
awToolTip: "{{ schedule.play_tip }}",
|
||||||
dataTipWatch: "schedule.play_tip",
|
dataTipWatch: "schedule.play_tip",
|
||||||
dataPlacement: "right",
|
dataPlacement: "right",
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
||||||
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt',
|
'OrganizationForm', 'Rest', 'ProcessErrors', 'Prompt', '$rootScope',
|
||||||
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'ConfigData',
|
'GetBasePath', 'Wait', '$state', 'ToggleNotification', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'ConfigData',
|
||||||
function($scope, $location, $stateParams, OrgAdminLookup,
|
function($scope, $location, $stateParams, OrgAdminLookup,
|
||||||
OrganizationForm, Rest, ProcessErrors, Prompt,
|
OrganizationForm, Rest, ProcessErrors, Prompt, $rootScope,
|
||||||
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData, ConfigData) {
|
GetBasePath, Wait, $state, ToggleNotification, CreateSelect2, InstanceGroupsService, InstanceGroupsData, ConfigData) {
|
||||||
|
|
||||||
let form = OrganizationForm(),
|
let form = OrganizationForm(),
|
||||||
@@ -26,6 +26,12 @@ export default ['$scope', '$location', '$stateParams', 'OrgAdminLookup',
|
|||||||
$scope.isOrgAdmin = isOrgAdmin;
|
$scope.isOrgAdmin = isOrgAdmin;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Rest.setUrl(GetBasePath('users') + $rootScope.current_user.id + '/roles/?role_field=notification_admin_role');
|
||||||
|
Rest.get()
|
||||||
|
.then(({data}) => {
|
||||||
|
$scope.isNotificationAdmin = (data.count && data.count > 0);
|
||||||
|
});
|
||||||
|
|
||||||
$scope.$watch('organization_obj.summary_fields.user_capabilities.edit', function(val) {
|
$scope.$watch('organization_obj.summary_fields.user_capabilities.edit', function(val) {
|
||||||
if (val === false) {
|
if (val === false) {
|
||||||
$scope.canAdd = false;
|
$scope.canAdd = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user