mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
check permissions on client to hide/show careportal and boluscalc
This commit is contained in:
@@ -294,8 +294,6 @@ function init (client, plugins, $) {
|
||||
data.relative = data.enteredinsulin * data.splitExt / 100 / data.duration * 60;
|
||||
}
|
||||
|
||||
console.info('>>>client.authorized', client.authorized);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST'
|
||||
, url: '/api/v1/treatments/'
|
||||
|
||||
+7
-2
@@ -4,6 +4,7 @@
|
||||
var _ = require('lodash');
|
||||
var $ = (global && global.$) || require('jquery');
|
||||
var d3 = (global && global.d3) || require('d3');
|
||||
var shiroTrie = require('shiro-trie');
|
||||
|
||||
var language = require('../language')();
|
||||
var sandbox = require('../sandbox')();
|
||||
@@ -111,6 +112,7 @@ client.init = function init(serverSettings, plugins) {
|
||||
if (serverSettings.authorized) {
|
||||
client.authorized = serverSettings.authorized;
|
||||
client.authorized.lat = Date.now();
|
||||
client.authorized.shiro = shiroTrie.new(client.authorized.permissions);
|
||||
}
|
||||
|
||||
client.headers = function headers ( ) {
|
||||
@@ -876,8 +878,11 @@ client.init = function init(serverSettings, plugins) {
|
||||
if (serverSettings.apiEnabled) {
|
||||
$('.serverSettings').show();
|
||||
}
|
||||
$('#treatmentDrawerToggle').toggle(client.settings.showPlugins.indexOf('careportal') > -1);
|
||||
$('#boluscalcDrawerToggle').toggle(client.settings.showPlugins.indexOf('boluscalc') > -1);
|
||||
|
||||
var treatmentCreateAllowed = client.authorized ? client.authorized.shiro.check('api:treatments:create') : client.hashauth.isAuthenticated;
|
||||
$('#treatmentDrawerToggle').toggle(treatmentCreateAllowed && client.settings.showPlugins.indexOf('careportal') > -1);
|
||||
$('#boluscalcDrawerToggle').toggle(treatmentCreateAllowed && client.settings.showPlugins.indexOf('boluscalc') > -1);
|
||||
|
||||
// hide food control if not enabled
|
||||
$('.foodcontrol').toggle(client.settings.enable.indexOf('food') > -1);
|
||||
// hide cob control if not enabled
|
||||
|
||||
Reference in New Issue
Block a user