Feature #19: Allow auto unauthenticated enrolment
This commit is contained in:
@@ -23,6 +23,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
const string pEnforceOrganisationalUnit = "enforceorganisationalunit";
|
||||
const string pProvisionADAccount = "provisionadaccount";
|
||||
const string pAssignedUserLocalAdmin = "assigneduserlocaladmin";
|
||||
const string pAllowUntrustedReimageJobEnrolment = "allowuntrustedreimagejobrnrolment";
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
public virtual ActionResult Update(int id, string key, string value = null, Nullable<bool> redirect = null)
|
||||
@@ -77,6 +78,9 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
case pAssignedUserLocalAdmin:
|
||||
UpdateAssignedUserLocalAdmin(deviceProfile, value);
|
||||
break;
|
||||
case pAllowUntrustedReimageJobEnrolment:
|
||||
UpdateAllowUntrustedReimageJobEnrolment(deviceProfile, value);
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Invalid Update Key");
|
||||
}
|
||||
@@ -173,6 +177,11 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
return Update(id, pAssignedUserLocalAdmin, AssignedUserLocalAdmin, redirect);
|
||||
}
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
public virtual ActionResult UpdateAllowUntrustedReimageJobEnrolment(int id, string AllowUntrustedReimageJobEnrolment = null, Nullable<bool> redirect = null)
|
||||
{
|
||||
return Update(id, pAllowUntrustedReimageJobEnrolment, AllowUntrustedReimageJobEnrolment, redirect);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Update Properties
|
||||
@@ -301,7 +310,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
|
||||
|
||||
private void UpdateEnforceOrganisationalUnit(Disco.Models.Repository.DeviceProfile deviceProfile, string EnforceOrganisationalUnit)
|
||||
{
|
||||
bool bValue;
|
||||
@@ -314,7 +323,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
|
||||
|
||||
private void UpdateProvisionADAccount(Disco.Models.Repository.DeviceProfile deviceProfile, string ProvisionADAccount)
|
||||
{
|
||||
bool bValue;
|
||||
@@ -340,6 +349,19 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
}
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
|
||||
private void UpdateAllowUntrustedReimageJobEnrolment(DeviceProfile deviceProfile, string AllowUntrustedReimageJobEnrolment)
|
||||
{
|
||||
bool bValue;
|
||||
if (bool.TryParse(AllowUntrustedReimageJobEnrolment, out bValue))
|
||||
{
|
||||
deviceProfile.AllowUntrustedReimageJobEnrolment = bValue;
|
||||
|
||||
Database.SaveChanges();
|
||||
return;
|
||||
}
|
||||
throw new Exception("Invalid Boolean Value");
|
||||
}
|
||||
#endregion
|
||||
|
||||
[DiscoAuthorize(Claims.Config.DeviceProfile.Configure)]
|
||||
|
||||
Reference in New Issue
Block a user