feature: device profiles - set assigned user for logon
This commit is contained in:
@@ -22,22 +22,23 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
{
|
||||
public partial class DeviceProfileController : AuthorizedDatabaseController
|
||||
{
|
||||
const string pDescription = "description";
|
||||
const string pName = "name";
|
||||
const string pShortName = "shortname";
|
||||
const string pDistributionType = "distributiontype";
|
||||
const string pCertificateProviders = "certificateproviders";
|
||||
const string pCertificateAuthorityProviders = "certificateauthorityproviders";
|
||||
const string pWirelessProfileProviders = "wirelessprofileproviders";
|
||||
const string pOrganisationalUnit = "organisationalunit";
|
||||
const string pDefaultOrganisationAddress = "defaultorganisationaddress";
|
||||
const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
|
||||
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
|
||||
const string pProvisionADAccount = "provisionadaccount";
|
||||
const string pAssignedUserLocalAdmin = "assigneduserlocaladmin";
|
||||
const string pAllowUntrustedReimageJobEnrolment = "allowuntrustedreimagejobrnrolment";
|
||||
const string pDevicesLinkedGroup = "deviceslinkedgroup";
|
||||
const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
||||
private const string pDescription = "description";
|
||||
private const string pName = "name";
|
||||
private const string pShortName = "shortname";
|
||||
private const string pDistributionType = "distributiontype";
|
||||
private const string pCertificateProviders = "certificateproviders";
|
||||
private const string pCertificateAuthorityProviders = "certificateauthorityproviders";
|
||||
private const string pWirelessProfileProviders = "wirelessprofileproviders";
|
||||
private const string pOrganisationalUnit = "organisationalunit";
|
||||
private const string pDefaultOrganisationAddress = "defaultorganisationaddress";
|
||||
private const string pEnforceComputerNameConvention = "enforcecomputernameconvention";
|
||||
private const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
|
||||
private const string pProvisionADAccount = "provisionadaccount";
|
||||
private const string pAssignedUserLocalAdmin = "assigneduserlocaladmin";
|
||||
private const string pSetAssignedUserForLogon = "setassigneduserforlogon";
|
||||
private const string pAllowUntrustedReimageJobEnrolment = "allowuntrustedreimagejobrnrolment";
|
||||
private const string pDevicesLinkedGroup = "deviceslinkedgroup";
|
||||
private const string pAssignedUsersLinkedGroup = "assigneduserslinkedgroup";
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
@@ -95,6 +96,9 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
case pAssignedUserLocalAdmin:
|
||||
UpdateAssignedUserLocalAdmin(deviceProfile, value);
|
||||
break;
|
||||
case pSetAssignedUserForLogon:
|
||||
UpdateSetAssignedUserForLogon(deviceProfile, value);
|
||||
break;
|
||||
case pAllowUntrustedReimageJobEnrolment:
|
||||
UpdateAllowUntrustedReimageJobEnrolment(deviceProfile, value);
|
||||
break;
|
||||
@@ -347,6 +351,13 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return Update(id, pProvisionADAccount, ProvisionADAccount, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult UpdateSetAssignedUserForLogon(int id, string setAssignedUserForLogon = null, bool? redirect = null)
|
||||
{
|
||||
return Update(id, pSetAssignedUserForLogon, setAssignedUserForLogon, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
[HttpPost, ValidateAntiForgeryToken]
|
||||
public virtual ActionResult UpdateAssignedUserLocalAdmin(int id, string AssignedUserLocalAdmin = null, bool? redirect = null)
|
||||
@@ -667,6 +678,18 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
|
||||
private void UpdateSetAssignedUserForLogon(DeviceProfile deviceProfile, string setAssignedUserForLogon)
|
||||
{
|
||||
if (bool.TryParse(setAssignedUserForLogon, out var bValue))
|
||||
{
|
||||
deviceProfile.SetAssignedUserForLogon = bValue;
|
||||
|
||||
Database.SaveChanges();
|
||||
return;
|
||||
}
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
|
||||
private void UpdateAllowUntrustedReimageJobEnrolment(DeviceProfile deviceProfile, string allowUntrustedReimageJobEnrolment)
|
||||
{
|
||||
if (bool.TryParse(allowUntrustedReimageJobEnrolment, out var bValue))
|
||||
|
||||
@@ -134,7 +134,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
ProvisionADAccount = true,
|
||||
ComputerNameTemplate = DeviceProfile.DefaultComputerNameTemplate,
|
||||
DistributionType = DeviceProfile.DistributionTypes.OneToMany,
|
||||
OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer
|
||||
OrganisationalUnit = ActiveDirectory.Context.PrimaryDomain.DefaultComputerContainer,
|
||||
SetAssignedUserForLogon = true,
|
||||
};
|
||||
|
||||
Database.DeviceProfiles.Add(deviceProfile);
|
||||
|
||||
@@ -258,6 +258,35 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 8px;">
|
||||
@if (canConfig)
|
||||
{
|
||||
<input id="DeviceProfile_SetAssignedUserForLogon" type="checkbox" @(Model.DeviceProfile.SetAssignedUserForLogon ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) />
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
document.DiscoFunctions.PropertyChangeHelper(
|
||||
$('#DeviceProfile_SetAssignedUserForLogon'),
|
||||
null,
|
||||
'@Url.Action(MVC.API.DeviceProfile.UpdateSetAssignedUserForLogon(Model.DeviceProfile.Id))',
|
||||
'setAssignedUserForLogon'
|
||||
);
|
||||
});
|
||||
</script>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input id="DeviceProfile_SetAssignedUserForLogon" type="checkbox" @(Model.DeviceProfile.SetAssignedUserForLogon ? new MvcHtmlString("checked=\"checked\" ") : new MvcHtmlString(string.Empty)) disabled="disabled" />
|
||||
}
|
||||
<label for="DeviceProfile_SetAssignedUserForLogon">
|
||||
Set Assigned User for Logon
|
||||
</label>
|
||||
@AjaxHelpers.AjaxLoader()
|
||||
<div class="info-box">
|
||||
<p class="fa-p">
|
||||
<i class="fa fa-info-circle"></i>When enabled the assigned user details will be pre-populated at the device logon screen.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="margin-top: 8px;">
|
||||
@if (canConfig)
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user