feature: flag permissions
feature: flag permissions
This commit is contained in:
@@ -239,17 +239,20 @@
|
||||
<div id="Device_Show_User_EmailAddress" title="Email Address"><a href="mailto:@(Model.Device.AssignedUser.EmailAddress)" data-clipboard="@assignedUser.DisplayName <@assignedUser.EmailAddress>">@assignedUser.EmailAddress</a></div>
|
||||
}
|
||||
}
|
||||
@if (Authorization.Has(Claims.User.ShowFlagAssignments))
|
||||
@if (assignedUser.UserFlagAssignments.CanShowAny())
|
||||
{
|
||||
<div id="Device_Show_User_Flags">
|
||||
@foreach (var flag in assignedUser.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
|
||||
{
|
||||
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)">
|
||||
<span class="details">
|
||||
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
|
||||
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
|
||||
</span>
|
||||
</i>
|
||||
if (flag.Item2.permission.CanShow())
|
||||
{
|
||||
<i class="flag fa fa-@(flag.Item2.flag.Icon) fa-fw d-@(flag.Item2.flag.IconColour)">
|
||||
<span class="details">
|
||||
<span class="name">@flag.Item2.flag.Name</span>@if (flag.Item1.Comments != null)
|
||||
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
|
||||
</span>
|
||||
</i>
|
||||
}
|
||||
}
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
@@ -765,12 +768,13 @@
|
||||
});
|
||||
</script>
|
||||
}
|
||||
@if (Model.Device.CanAddDeviceFlags() && Model.AvailableDeviceFlags != null && Model.AvailableDeviceFlags.Count > 0)
|
||||
@if (Model.AvailableDeviceFlags != null && Model.AvailableDeviceFlags.Count > 0)
|
||||
{
|
||||
@Html.ActionLinkSmallButton("Add Flag", MVC.API.DeviceFlagAssignment.AddDevice(), "Device_Show_Details_Actions_AddFlag_Button")
|
||||
<button id="Device_Show_Details_Actions_AddFlag_Button" type="button" class="button small">Add Flag</button>
|
||||
<div id="Device_Show_Details_Actions_AddFlag_Dialog" class="dialog" title="Add Device Flag">
|
||||
@using (Html.BeginForm(MVC.API.DeviceFlagAssignment.AddDevice()))
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
<input id="Device_Show_Details_Actions_AddFlag_Dialog_Id" type="hidden" name="id" />
|
||||
<input id="Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumber" type="hidden" name="DeviceSerialNumber" value="@Model.Device.SerialNumber" />
|
||||
<div class="flagPicker">
|
||||
@@ -794,7 +798,6 @@
|
||||
$(function () {
|
||||
const button = $('#Device_Show_Details_Actions_AddFlag_Button');
|
||||
let buttonDialog = null;
|
||||
const buttonLink = button.attr('href');
|
||||
|
||||
let flagPicker = null;
|
||||
let flagAddId = null;
|
||||
@@ -814,9 +817,7 @@
|
||||
flagAddComments.focus().select();
|
||||
}
|
||||
|
||||
button.attr('href', '#').click(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
button.click(function (e) {
|
||||
if (!buttonDialog) {
|
||||
buttonDialog = $('#Device_Show_Details_Actions_AddFlag_Dialog');
|
||||
buttonDialog.dialog({
|
||||
@@ -831,10 +832,9 @@
|
||||
},
|
||||
"Add Flag": function () {
|
||||
if (!!flagAddId.val()) {
|
||||
const $this = $(this);
|
||||
$this.dialog("disable");
|
||||
$this.dialog("option", "buttons", null);
|
||||
buttonDialog.find('form').submit();
|
||||
buttonDialog
|
||||
.dialog("option", "buttons", null)
|
||||
.find('form').submit();
|
||||
} else {
|
||||
alert('Select a Device Flag');
|
||||
}
|
||||
@@ -868,7 +868,6 @@
|
||||
|
||||
$('#Device_Show_Details_Actions_AddFlag_Dialog_Filter').val('');
|
||||
buttonDialog.dialog('open');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user