Advanced User Management

This commit is contained in:
Nicola Carminati
2019-04-26 19:22:54 +02:00
parent 839fae6bd6
commit 796f0b32f3
12 changed files with 122 additions and 42 deletions
@@ -76,7 +76,8 @@ namespace Step.Database.Controllers
return new DTORoleModel()
{
Id = role.RoleId,
Name = role.Name
Name = role.Name,
Level = role.Level
};
}
@@ -86,7 +87,7 @@ namespace Step.Database.Controllers
public bool UserIsCmsAdmin(int machineId, int userId)
{
MachineUserModel user = FindByUserId(machineId, userId);
if (user.Role.RoleId == (int)ROLE_IDS.CMS_SERVICE_ONLY)
if (user.Role.RoleId == (int)ROLE_IDS.CMS_SERVICE || user.Role.RoleId == (int)ROLE_IDS.CMS_UT)
return true;
return false;
@@ -108,12 +109,13 @@ namespace Step.Database.Controllers
public List<DTORoleModel> GetRolesList()
{
return dbCtx
.Roles
.Roles.Where(X => X.Level < MIN_CMS_ROLE)
.Select(x => new DTORoleModel()
{
Id = x.RoleId,
Name = x.Name
}).ToList();
})
.ToList();
}
public void UpdateUserRole(int machineId, int userId, int roleId)