@model Disco.Web.Areas.Config.Models.UserFlag.ShowModel @using Disco.Services.Interop.ActiveDirectory; @using Disco.Services.Users.UserFlags; @using Disco.Web.Areas.Config.Models.Shared; @{ Authorization.Require(Claims.Config.UserFlag.Show); ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "User Flags", MVC.Config.UserFlag.Index(null), Model.UserFlag.ToString()); var canConfig = Authorization.Has(Claims.Config.UserFlag.Configure); var canDelete = Authorization.Has(Claims.Config.UserFlag.Delete); var canBulkAssignment = Authorization.HasAll(Claims.User.Actions.AddFlags, Claims.User.Actions.RemoveFlags, Claims.User.ShowFlagAssignments); var canShowUsers = Model.CurrentAssignmentCount > 0 && Authorization.HasAll(Claims.User.Search, Claims.User.ShowFlagAssignments); var hideAdvanced = Model.UserFlag.UserDevicesLinkedGroup == null && Model.UserFlag.UsersLinkedGroup == null && Model.UserFlag.OnAssignmentExpression == null && Model.UserFlag.OnUnassignmentExpression == null; Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers"); }
@if (hideAdvanced) { }
Id: @Html.DisplayFor(model => model.UserFlag.Id)
Name: @if (canConfig) {@Html.EditorFor(model => model.UserFlag.Name) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else { @Model.UserFlag.Name }
Description: @if (canConfig) {@Html.EditorFor(model => model.UserFlag.Description) @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else {
                    @if (string.IsNullOrEmpty(Model.UserFlag.Description))
                    {
                    <None>
                    }
                    else
                    {
                        @Model.UserFlag.Description.ToHtmlComment()
                    }
                    
}
Statistics:
@Model.CurrentAssignmentCount user@(Model.CurrentAssignmentCount != 1 ? "s" : null) currently assigned
@Model.TotalAssignmentCount total user historical assignment@(Model.TotalAssignmentCount != 1 ? "s" : null)
Icon: @if (canConfig) {
Update
@foreach (var icon in Model.Icons) { }
@foreach (var colour in Model.ThemeColours) { }
}
On Assignment
Expression:
@if (canConfig) { @Html.EditorFor(model => model.UserFlag.OnAssignmentExpression) @AjaxHelpers.AjaxRemove() @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else { if (string.IsNullOrWhiteSpace(Model.UserFlag.OnAssignmentExpression)) { <None Specified> } else {
@Model.UserFlag.OnAssignmentExpression
} }

This expression will be evaluated whenever the user flag is assigned to a user. The output of the expression will be shown with the flag assignment.

On Unassignment
Expression:
@if (canConfig) { @Html.EditorFor(model => model.UserFlag.OnUnassignmentExpression) @AjaxHelpers.AjaxRemove() @AjaxHelpers.AjaxSave() @AjaxHelpers.AjaxLoader() } else { if (string.IsNullOrWhiteSpace(Model.UserFlag.OnUnassignmentExpression)) { <None Specified> } else {
@Model.UserFlag.OnUnassignmentExpression
} }

This expression will be evaluated whenever the user flag is removed from a user. The output of the expression will be shown with the flag assignment.

Linked Groups:
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, CategoryDescription = UserFlagUsersManagedGroup.GetCategoryDescription(Model.UserFlag), Description = UserFlagUsersManagedGroup.GetDescription(Model.UserFlag), ManagedGroup = Model.UsersLinkedGroup, IncludeFilterBeginDate = true, UpdateUrl = Url.Action(MVC.API.UserFlag.UpdateAssignedUsersLinkedGroup(Model.UserFlag.Id, redirect: true)) }) @Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel() { CanConfigure = canConfig, CategoryDescription = UserFlagUserDevicesManagedGroup.GetCategoryDescription(Model.UserFlag), Description = UserFlagUserDevicesManagedGroup.GetDescription(Model.UserFlag), ManagedGroup = Model.UserDevicesLinkedGroup, IncludeFilterBeginDate = true, UpdateUrl = Url.Action(MVC.API.UserFlag.UpdateAssignedUserDevicesLinkedGroup(Model.UserFlag.Id, redirect: true)) }) @if (canConfig) { @Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared) }
@if (canBulkAssignment || canDelete || canShowUsers) {
@if (canBulkAssignment) { Bulk Assign Users

Select the mode used to assign users:

Add

Specified users will have this flag added. Users who already have this flag will be skipped.

Override

Specified users will have this flag added. Specified users which already have this flag will be skipped. Users who already have this flag but are not specified will have the flag removed.

Enter multiple User Ids separated by <new line>, commas (,) or semicolons (;).

Examples:

user6
smi0099
@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith
user6,smi0099,@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith
user6;smi0099;@(ActiveDirectory.Context.PrimaryDomain.NetBiosName)\rsmith

Loading current assignments...

Comments:

} @if (canDelete) { @Html.ActionLinkButton("Delete", MVC.API.UserFlag.Delete(Model.UserFlag.Id, true), "Config_UserFlags_Actions_Delete_Button")

This item will be permanently deleted and cannot be recovered.

@if (Model.CurrentAssignmentCount > 0) { @Model.CurrentAssignmentCount user@(Model.CurrentAssignmentCount != 1 ? "s are" : " is") currently assigned

} Are you sure?

} @if (canShowUsers) { @Html.ActionLinkButton(string.Format("Show {0} user{1}", Model.CurrentAssignmentCount, (Model.CurrentAssignmentCount == 1 ? null : "s")), MVC.Search.Query(Model.UserFlag.Id.ToString(), "UserFlag"), "Config_UserFlags_Actions_ShowUsers_Button") }
}