Skip to content

Commit

Permalink
Enable management job notications for admins
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemcdermott committed May 15, 2020
1 parent 30610f1 commit ae84d1e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

export default
[ 'NotificationsList', 'GetBasePath', 'ToggleNotification', 'NotificationsListInit',
'$stateParams', 'Dataset', '$scope',
'$stateParams', 'Dataset', '$scope', 'isAdmin',
function(
NotificationsList, GetBasePath, ToggleNotification, NotificationsListInit,
$stateParams, Dataset, $scope) {
$stateParams, Dataset, $scope, isAdmin) {
var defaultUrl = GetBasePath('system_job_templates'),
list = NotificationsList,
id = $stateParams.management_id;
Expand All @@ -19,6 +19,8 @@ export default
$scope[`${list.iterator}_dataset`] = Dataset.data;
$scope[list.name] = $scope[`${list.iterator}_dataset`].results;

console.log(isAdmin);

NotificationsListInit({
scope: $scope,
url: defaultUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ export default {
let path = `${GetBasePath('system_job_templates')}${$stateParams.management_id}`;
Rest.setUrl(path);
return Rest.get(path).then((res) => res.data);
}],
isAdmin: ['Rest', 'GetBasePath', function(Rest, GetBasePath) {
Rest.setUrl(GetBasePath('me'));
return Rest.get()
.then((res) => {
if (res.data && res.data.results && res.data.count && res.data.results[0] && res.data.results.is_superuser) {
return true;
}
return false;
})
.catch(() => {
return false;
});
}]
},
ncyBreadcrumb: {
Expand Down

0 comments on commit ae84d1e

Please sign in to comment.