Handle notification admin user type in the UI

This commit is contained in:
mabashian
2018-08-27 17:01:08 -04:00
parent d6ba3e1fc2
commit f7737e2f94
8 changed files with 42 additions and 10 deletions

View File

@@ -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'];

View File

@@ -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">