Add a admin user and the "role" information into the token.
This commit is contained in:
@@ -12,11 +12,13 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
{
|
||||
public InitDbService(IAircraftService aircraftService,
|
||||
IJumpTypeService jumpTypeService,
|
||||
IDropZoneService dropZoneService)
|
||||
IDropZoneService dropZoneService,
|
||||
IUserService userService)
|
||||
{
|
||||
_aircraftService = aircraftService;
|
||||
_jumpTypeService = jumpTypeService;
|
||||
_dropZoneService = dropZoneService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
public void GenerateDb()
|
||||
@@ -24,6 +26,7 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
LoadAircrafts();
|
||||
LoadDropZones();
|
||||
LoadJumpTypes();
|
||||
AddAdmin();
|
||||
}
|
||||
|
||||
private void LoadDropZones()
|
||||
@@ -74,10 +77,23 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
}
|
||||
}
|
||||
|
||||
private void AddAdmin()
|
||||
{
|
||||
var adminUser = new User
|
||||
{
|
||||
Login = "administrator",
|
||||
Password = "logsadmin"
|
||||
};
|
||||
_userService.AddNewUser(adminUser);
|
||||
}
|
||||
|
||||
|
||||
private readonly IAircraftService _aircraftService;
|
||||
|
||||
private readonly IJumpTypeService _jumpTypeService;
|
||||
|
||||
private readonly IDropZoneService _dropZoneService;
|
||||
|
||||
private readonly IUserService _userService;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace skydiveLogs_api.DomainBusiness
|
||||
|
||||
if (foundUser == null)
|
||||
{
|
||||
_userRepository.Add(newUser);
|
||||
result = true;
|
||||
result = _userRepository.Add(newUser);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user