mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-06 08:21:50 -05:00
Handle notification admin user type in the UI
This commit is contained in:
@@ -16,6 +16,7 @@ function AtLayoutController ($scope, $http, strings, ProcessErrors, $transitions
|
||||
|
||||
if (!vm.isSuperUser) {
|
||||
checkOrgAdmin();
|
||||
checkNotificationAdmin();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -54,6 +55,25 @@ function AtLayoutController ($scope, $http, strings, ProcessErrors, $transitions
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function checkNotificationAdmin () {
|
||||
const usersPath = `/api/v2/users/${vm.currentUserId}/roles/?role_field=notification_admin_role`;
|
||||
$http.get(usersPath)
|
||||
.then(({ data }) => {
|
||||
console.log(data);
|
||||
if (data.count > 0) {
|
||||
vm.isNotificationAdmin = true;
|
||||
} else {
|
||||
vm.isNotificationAdmin = false;
|
||||
}
|
||||
})
|
||||
.catch(({ data, status }) => {
|
||||
ProcessErrors(null, data, status, null, {
|
||||
hdr: strings.get('error.HEADER'),
|
||||
msg: strings.get('error.CALL', { path: usersPath, action: 'GET', status })
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AtLayoutController.$inject = ['$scope', '$http', 'ComponentsStrings', 'ProcessErrors', '$transitions'];
|
||||
|
||||
@@ -81,10 +81,10 @@
|
||||
<span>
|
||||
</div>
|
||||
<at-side-nav-item icon-class="fa-list-alt" route="credentialTypes" name="CREDENTIAL_TYPES"
|
||||
system-admin-only="true">
|
||||
system-admin-only="true">
|
||||
</at-side-nav-item>
|
||||
<at-side-nav-item icon-class="fa-bell" route="notifications" name="NOTIFICATIONS"
|
||||
system-admin-only="true">
|
||||
ng-show="$parent.layoutVm.isSuperUser || $parent.layoutVm.isOrgAdmin || $parent.layoutVm.isNotificationAdmin">
|
||||
</at-side-nav-item>
|
||||
<at-side-nav-item icon-class="fa-briefcase" route="managementJobsList" name="MANAGEMENT_JOBS"
|
||||
system-admin-only="true">
|
||||
|
||||
Reference in New Issue
Block a user