Skip to content

Commit

Permalink
Merge pull request #1711 from bcgov/test
Browse files Browse the repository at this point in the history
Master -> Test - IS30 UAT Release
  • Loading branch information
asanchezr authored Jul 7, 2022
2 parents 38b2c24 + 09189fd commit 55ff988
Show file tree
Hide file tree
Showing 331 changed files with 66,539 additions and 8,458 deletions.
11 changes: 5 additions & 6 deletions backend/api/Areas/Admin/Controllers/AccessRequestController.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using MapsterMapper;
using Microsoft.AspNetCore.Mvc;
using Pims.Api.Models;
using Pims.Api.Models.Concepts;
using Pims.Api.Policies;
using Pims.Dal;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
using EModel = Pims.Dal.Entities.Models;
using Entity = Pims.Dal.Entities;
using Pims.Api.Models;
using Pims.Api.Models.Concepts;

namespace Pims.Api.Areas.Admin.Controllers
{
Expand All @@ -28,6 +28,7 @@ public class AccessRequestController : Controller
#endregion

#region Constructors

/// <summary>
/// Creates a new instance of an AccessRequestController object, initializes with specified parameters.
/// </summary>
Expand All @@ -48,9 +49,6 @@ public AccessRequestController(IPimsRepository pimsService, IMapper mapper)
/// <param name="page"></param>
/// <param name="quantity"></param>
/// <param name="searchText"></param>
/// <param name="role"></param>
/// <param name="organization"></param>
/// <param name="status"></param>
/// <param name="sort"></param>
/// <returns></returns>
[HttpGet]
Expand Down Expand Up @@ -87,6 +85,7 @@ public IActionResult GetPage(int page = 1, int quantity = 10, string searchText
/// <summary>
/// Get the most recent access request for the current user.
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet("{id}")]
[Produces("application/json")]
Expand All @@ -105,6 +104,7 @@ public IActionResult GetAccessRequest(long id)
/// </summary>
/// <param name="id"></param>
/// <param name="model"></param>
/// <returns></returns>
[HttpDelete("{id}")]
[Produces("application/json")]
[ProducesResponseType(typeof(AccessRequestModel), 200)]
Expand All @@ -120,4 +120,3 @@ public IActionResult Delete(long id, [FromBody] AccessRequestModel model)

}
}

2 changes: 1 addition & 1 deletion backend/api/Areas/Admin/Controllers/ClaimController.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using System;
using MapsterMapper;
using Microsoft.AspNetCore.Mvc;
using Pims.Api.Policies;
using Pims.Dal;
using Pims.Dal.Entities;
using Pims.Dal.Security;
using Swashbuckle.AspNetCore.Annotations;
using System;
using Entity = Pims.Dal.Entities;
using Model = Pims.Api.Models.Concepts;

Expand Down
17 changes: 0 additions & 17 deletions backend/api/Areas/Admin/Controllers/RoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,6 @@ public IActionResult GetRole(Guid key)
return new JsonResult(role);
}

/// <summary>
/// GET - Returns a role for the specified 'name' from the datasource.
/// </summary>
/// <param name="name">The unique 'name' for the role to return.</param>
/// <returns>The role requested.</returns>
[HttpGet("name/{name}")]
[Produces("application/json")]
[ProducesResponseType(typeof(Model.RoleModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "admin-role" })]
public IActionResult GetRoleByName(string name)
{
var entity = _pimsService.Role.GetByName(name);
var role = _mapper.Map<Model.RoleModel>(entity);
return new JsonResult(role);
}

/// <summary>
/// POST - Add a new role to the datasource.
/// </summary>
Expand Down
132 changes: 0 additions & 132 deletions backend/api/Areas/Keycloak/Controllers/RoleController.cs

This file was deleted.

65 changes: 0 additions & 65 deletions backend/api/Areas/Keycloak/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,71 +43,6 @@ public UserController(IMapper mapper, IPimsKeycloakService keycloakService)
#endregion

#region Endpoints
/// <summary>
/// Sync the user for the specified 'key' from keycloak with PIMS.
/// If the user does not exist in keycloak it will return a 400-BadRequest.
/// If the user does not exist in PIMS it will add it.
/// Also links the user to the appropriate groups it is a member of within keycloak.!--
/// If the group does not exist in PIMS it will add it.
/// </summary>
/// <param name="key"></param>
/// <exception type="KeyNotFoundException">The user does not exist in keycloak.</exception>
/// <returns></returns>
[HttpPost("sync/{key}")]
[Produces("application/json")]
[ProducesResponseType(typeof(KModel.UserModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "keycloak-user" })]
[HasPermission(Permissions.AdminUsers)]
public async Task<IActionResult> SyncUserAsync(Guid key)
{
var user = await _keycloakService.SyncUserAsync(key);
var result = _mapper.Map<KModel.UserModel>(user);

return new JsonResult(result);
}

/// <summary>
/// Fetch an array of users from keycloak.
/// This endpoint supports paging.
/// </summary>
/// <param name="page"></param>
/// <param name="quantity"></param>
/// <param name="search"></param>
/// <returns></returns>
[HttpGet]
[Produces("application/json")]
[ProducesResponseType(typeof(IEnumerable<KModel.UserModel>), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "keycloak-user" })]
[HasPermission(Permissions.AdminUsers)]
public async Task<IActionResult> GetUsersAsync(int page = 1, int quantity = 10, string search = null)
{
var users = await _keycloakService.GetUsersAsync(page, quantity, search);
var result = _mapper.Map<KModel.UserModel[]>(users);

return new JsonResult(result);
}

/// <summary>
/// Fetch the user for the specified 'key'.
/// If the user does not exist in keycloak or PIMS return a 400-BadRequest.
/// </summary>
/// <exception type="KeyNotFoundException">The user does not exist in keycloak.</exception>
/// <returns></returns>
[HttpGet("{key:guid}")]
[Produces("application/json")]
[ProducesResponseType(typeof(KModel.UserModel), 200)]
[ProducesResponseType(typeof(Api.Models.ErrorResponseModel), 400)]
[SwaggerOperation(Tags = new[] { "keycloak-user" })]
[HasPermission(Permissions.AdminUsers)]
public async Task<IActionResult> GetUserAsync(Guid key)
{
var user = await _keycloakService.GetUserAsync(key);
var result = _mapper.Map<KModel.UserModel>(user);

return new JsonResult(result);
}

/// <summary>
/// Update the user for the specified 'key'.
Expand Down
2 changes: 1 addition & 1 deletion backend/api/Areas/Keycloak/Mapping/User/UserMap.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System.Linq;
using Mapster;
using Pims.Dal.Entities;
using Entity = Pims.Dal.Entities;
using KModel = Pims.Keycloak.Models;
using Model = Pims.Api.Areas.Keycloak.Models.User;
using System.Linq;

namespace Pims.Api.Areas.Keycloak.Mapping.User
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public IActionResult GetPropertyAssociationsWithPid(string pid)
public IActionResult GetConceptPropertyWithPid(string pid)
{
var property = _pimsService.PropertyService.GetByPid(pid);

return new JsonResult(_mapper.Map<Pims.Api.Models.Concepts.PropertyModel>(property));
}

Expand Down
5 changes: 5 additions & 0 deletions backend/api/Areas/Property/Mapping/Property/PropertyMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.Description, src => src.Description)
.Map(dest => dest.IsSensitive, src => src.IsSensitive)
.Map(dest => dest.IsProvincialPublicHwy, src => src.IsProvincialPublicHwy)
.Map(dest => dest.PphStatusUpdateUserid, src => src.PphStatusUpdateUserid)
.Map(dest => dest.PphStatusUpdateTimestamp, src => src.PphStatusUpdateTimestamp)
.Map(dest => dest.PphStatusUpdateUserGuid, src => src.PphStatusUpdateUserGuid)
.Map(dest => dest.IsRwyBeltDomPatent, src => src.IsRwyBeltDomPatent)
.Map(dest => dest.PphStatusTypeCode, src => src.PphStatusTypeCode)
.Map(dest => dest.Notes, src => src.Notes)

.Map(dest => dest.LandArea, src => src.LandArea)
Expand Down
25 changes: 25 additions & 0 deletions backend/api/Areas/Property/Models/Property/PropertyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,31 @@ public class PropertyModel : BaseModel
/// get/set - Whether the property is a provincial highway.
/// </summary>
public bool? IsProvincialPublicHwy { get; set; }

/// <summary>
/// get/set - Updated by user id.
/// </summary>
public string PphStatusUpdateUserid { get; set; }

/// <summary>
/// get/set - Updated on date time stamp.
/// </summary>
public DateTime? PphStatusUpdateTimestamp { get; set; }

/// <summary>
/// get/set - Updated by user guid.
/// </summary>
public Guid? PphStatusUpdateUserGuid { get; set; }

/// <summary>
/// get/set - Whether the property is a Rwy Belt Dom Patent.
/// </summary>
public bool? IsRwyBeltDomPatent { get; set; }

/// <summary>
/// get/set - Provincial Public Hwy Status.
/// </summary>
public string PphStatusTypeCode { get; set; }
#endregion

#region Address
Expand Down
4 changes: 3 additions & 1 deletion backend/api/Controllers/LookupController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public IActionResult GetAll()
var propertyAdjacentLandTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPropertyAdjacentLandTypes());
var volumeUnitTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPropertyVolumeUnitTypes());
var propertyVolumetricTypes = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPropertyVolumetricTypes());
var pphStatusType = _mapper.Map<Model.LookupModel[]>(_pimsService.Lookup.GetPPHStatusType());

var codes = new List<object>();
codes.AddRange(areaUnitTypes);
Expand Down Expand Up @@ -149,7 +150,8 @@ public IActionResult GetAll()
codes.AddRange(propertyAdjacentLandTypes);
codes.AddRange(volumeUnitTypes);
codes.AddRange(propertyVolumetricTypes);

codes.AddRange(pphStatusType);

return new JsonResult(codes);
}
#endregion
Expand Down
Loading

0 comments on commit 55ff988

Please sign in to comment.