aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-19 18:10:35 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-19 18:10:35 +0200
commit945520000da0ae4a3fa3b40e9756d67379e25314 (patch)
tree5d0b88721a2eb6a6805cf10fb08cce3f486e2928 /Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
parent93e6a6bfa7238826dcdea989e279ec3450067f83 (diff)
downloadTango-945520000da0ae4a3fa3b40e9756d67379e25314.tar.gz
Tango-945520000da0ae4a3fa3b40e9756d67379e25314.zip
Machine Studio v4.0.8.0
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs15
1 files changed, 7 insertions, 8 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
index 82082ca2f..054c8d781 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs
@@ -145,15 +145,9 @@ namespace Tango.MachineService.Controllers
using (ObservablesContext db = ObservablesContextHelper.CreateContext())
{
- //Load relation first...
- db.Roles.ToList();
- db.Permissions.ToList();
- db.UsersRoles.ToList();
- db.RolesPermissions.ToList();
-
String userID = TokensManager.GetTokenObject(request.AccessToken);
- var user = db.Users.SingleOrDefault(x => x.Guid == userID);
+ var user = new UserBuilder(db).Set(userID).WithRolesAndPermissions().Build();
if (user != null && user.HasPermission(Permissions.PublishMachineStudioVersions))
{
@@ -281,7 +275,7 @@ namespace Tango.MachineService.Controllers
db.UsersRoles.ToList();
db.RolesPermissions.ToList();
- user = db.Users.SingleOrDefault(x => x.Email.ToLower() == request.Email.ToLower());
+ user = new UserBuilder(db).Set(x => x.Email.ToLower() == request.Email.ToLower()).WithRolesAndPermissions().WithDeleted().Build();
IHashGenerator g = new BasicHashGenerator();
@@ -318,6 +312,11 @@ namespace Tango.MachineService.Controllers
}
else
{
+ if (user.Deleted)
+ {
+ throw new AuthenticationException("Your account has been disabled. Please contact your administrator.");
+ }
+
user.LastLogin = DateTime.UtcNow;
user.Password = g.Encrypt(request.Password);
}