Make grids private unless admin
#CTCTOWALTZ-2410
import {reportGridKinds} from "./report-grid-utils";
import _ from "lodash";
+ import {userStore} from "../../../svelte-stores/user-store";
export let grid;
export let doCancel = () => console.log("Cancel");
let workingCopy = Object.assign({}, grid, {kind: grid?.kind || reportGridKinds.PRIVATE.key});
+ $: userCall = userStore.load();
+ $: user = $userCall.data;
+
+ $: isAdmin = _.includes(user?.roles, "ADMIN");
+
function noChange(workingCopy) {
return workingCopy?.name === grid?.name
&& workingCopy?.description === grid?.description
<label>
<input type="radio"
style="display: block"
+ disabled={!isAdmin}
checked={workingCopy.kind === reportGridKinds.PRIVATE.key}
bind:group={workingCopy.kind}
value={reportGridKinds.PRIVATE.key}>
<label>
<input type="radio"
style="display: block;"
+ disabled={!isAdmin}
checked={workingCopy.kind === reportGridKinds.PUBLIC.key}
bind:group={workingCopy.kind}
value={reportGridKinds.PUBLIC.key}>
{reportGridKinds.PUBLIC.name}
- <div class="help-block small">Public - These grids can be viewed by everyone</div>
+ <div class="help-block small">Public - These grids can be viewed by everyone, please contact an Admin to
+ set this grid to 'Public'
+ </div>
</label>
</div>
</div>
