diff --git a/Disco.BI/BI/DeviceBI/Enrol.cs b/Disco.BI/BI/DeviceBI/Enrol.cs index 28c1a5cd..8f8dc85f 100644 --- a/Disco.BI/BI/DeviceBI/Enrol.cs +++ b/Disco.BI/BI/DeviceBI/Enrol.cs @@ -347,7 +347,7 @@ namespace Disco.BI.DeviceBI { if (!authenticatedToken.Has(Claims.Device.Actions.EnrolDevices)) { - if (authenticatedToken.Has(Claims.ComputerAccount)) + if (!authenticatedToken.Has(Claims.ComputerAccount)) throw new EnrolSafeException(string.Format("Connection not correctly authenticated (SN: {0}; Auth User: {1})", Request.DeviceSerialNumber, authenticatedToken.User.Id)); if (!authenticatedToken.User.Id.Equals(string.Format("{0}$", Request.DeviceComputerName), System.StringComparison.InvariantCultureIgnoreCase)) throw new EnrolSafeException(string.Format("Connection not correctly authenticated (SN: {0}; Auth User: {1})", Request.DeviceSerialNumber, authenticatedToken.User.Id)); diff --git a/Disco.BI/BI/Extensions/ClientServicesExtensions.cs b/Disco.BI/BI/Extensions/ClientServicesExtensions.cs index d7b6321a..624b4ae7 100644 --- a/Disco.BI/BI/Extensions/ClientServicesExtensions.cs +++ b/Disco.BI/BI/Extensions/ClientServicesExtensions.cs @@ -7,6 +7,7 @@ using System.Web; using Disco.Data.Repository; using Disco.Models.Repository; using Disco.Services.Users; +using Disco.Services.Authorization; namespace Disco.BI.Extensions { @@ -43,12 +44,13 @@ namespace Disco.BI.Extensions using (DiscoDataContext database = new DiscoDataContext()) { - User user = UserService.GetUser(username, database, true); + AuthorizationToken token = UserService.GetAuthorization(username, database, true); + WhoAmIResponse response = new WhoAmIResponse() { - Username = user.Id, - DisplayName = user.DisplayName, - Type = "TODO!" + Username = token.User.Id, + DisplayName = token.User.DisplayName, + Type = token.Has(Claims.ComputerAccount) ? "Computer Account" : "User Account" }; return response; }