Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #146 from AppliedIS/config-ssl
Browse files Browse the repository at this point in the history
patch assembly info
  • Loading branch information
klinden committed Nov 17, 2016
2 parents cf0e763 + 8c4fa11 commit 67c88e0
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static class HelpPageConfig
public static void Register(HttpConfiguration config)
{
//// Uncomment the following to use the documentation from XML documentation file.
//config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));
config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/bin/DOL.WHD.Section14c.Api.XML")));

//// Uncomment the following to use "sample string" as the sample for all actions that have string as the body parameter or return type.
//// Also, the string arrays will be used for IEnumerable<string>. The sample objects will be serialized into different media type
Expand Down
58 changes: 58 additions & 0 deletions DOL.WHD.Section14c.Api/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ public ApplicationRoleManager RoleManager
}
}

/// <summary>
/// Creates a User Account
/// </summary>
/// <param name="model"></param>
/// <returns>HTTP status code</returns>
// POST api/Account/Register
[AllowAnonymous]
[Route("Register")]
Expand Down Expand Up @@ -104,6 +109,10 @@ public async Task<IHttpActionResult> Register(RegisterViewModel model)
return Ok();
}

/// <summary>
/// Returns user information for provided access_token
/// </summary>
/// <returns>User information, including; Email Address, Organizations, Roles, Application Claims</returns>
// GET api/Account/UserInfo
[Route("UserInfo")]
public UserInfoViewModel GetUserInfo()
Expand All @@ -122,6 +131,11 @@ public UserInfoViewModel GetUserInfo()
};
}

/// <summary>
/// Sends reset password email if account exists
/// </summary>
/// <param name="model">ResetPasswordViewModel</param>
/// <returns>Http status code, for information security it will return success even if account is not found</returns>
// POST api/Account/ResetPassword
[AllowAnonymous]
[Route("ResetPassword")]
Expand Down Expand Up @@ -152,6 +166,11 @@ public async Task<IHttpActionResult> ResetPassword(ResetPasswordViewModel model)

}

/// <summary>
/// Verifies the reset password token and resets users password. Updates email address as confirmed if not previously confirmed.
/// </summary>
/// <param name="model">VerifyResetPasswordViewModel</param>
/// <returns>Http status code</returns>
// POST api/Account/VerifyResetPassword
[AllowAnonymous]
[Route("VerifyResetPassword")]
Expand All @@ -175,6 +194,11 @@ public async Task<IHttpActionResult> VerifyResetPassword(VerifyResetPasswordView
return Ok();
}

/// <summary>
/// Changes password by username or bearer token
/// </summary>
/// <param name="model">ChangePasswordViewModel</param>
/// <returns>Http status code</returns>
// POST api/Account/ChangePassword
[AllowAnonymous]
[Route("ChangePassword")]
Expand Down Expand Up @@ -228,6 +252,11 @@ public async Task<IHttpActionResult> ChangePassword(ChangePasswordViewModel mode
return Ok();
}

/// <summary>
/// Verifies code sent during registration and updates user as email confirmed.
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
// POST api/Account/VerifyEmail
[AllowAnonymous]
[Route("VerifyEmail")]
Expand All @@ -243,6 +272,11 @@ public async Task<IHttpActionResult> VerifyEmail(VerifyEmailViewModel model)
return Ok();
}


/// <summary>
/// Updates security stamp so token can be validated
/// </summary>
/// <returns></returns>
// POST api/Account/Logout
[Route("LogOut")]
public async Task<IHttpActionResult> Logout()
Expand All @@ -254,6 +288,9 @@ public async Task<IHttpActionResult> Logout()

#region Account Management

/// <summary>
/// Returns collection of user accounts
/// </summary>
// GET api/Account
[AuthorizeClaims(ApplicationClaimTypes.GetAccounts)]
[HttpGet]
Expand All @@ -271,6 +308,10 @@ public async Task<IEnumerable<UserInfoViewModel>> GetAccounts()
}).ToListAsync();
}

/// <summary>
/// Returns user account by Id
/// </summary>
/// <param name="userId">User Id</param>
// POST api/Account/{userId}
[AuthorizeClaims(ApplicationClaimTypes.GetAccounts)]
[HttpGet]
Expand All @@ -296,6 +337,9 @@ public IHttpActionResult GetSingleAccount(string userId)
.Select(i => i.Feature.Key)});
}

/// <summary>
/// Returns all available roles in system
/// </summary>
// GET api/Account/Roles
[AuthorizeClaims(ApplicationClaimTypes.GetRoles)]
[HttpGet]
Expand All @@ -309,6 +353,11 @@ public async Task<IEnumerable<RoleViewModel>> GetRoles()
}).OrderBy(x => x.Name).ToListAsync();
}

/// <summary>
/// Creates User Account
/// </summary>
/// <param name="model">UserInfoViewModel</param>
/// <returns>Http status code</returns>
// POST api/Account
[AuthorizeClaims(ApplicationClaimTypes.CreateAccount)]
[HttpPost]
Expand Down Expand Up @@ -342,6 +391,12 @@ public async Task<IHttpActionResult> CreateAccount(UserInfoViewModel model)
return Ok(result);
}

/// <summary>
/// Updates User Account
/// </summary>
/// <param name="userId">User Id</param>
/// <param name="model">UserInfoViewModel</param>
/// <returns>Http status code</returns>
// POST api/Account/{userId}
[AuthorizeClaims(ApplicationClaimTypes.ModifyAccount)]
[HttpPost]
Expand Down Expand Up @@ -402,6 +457,9 @@ public IHttpActionResult ModifyAccount(string userId, UserInfoViewModel model)
}
#endregion

/// <summary>
/// OPTIONS endpoint for CORS
/// </summary>
[AllowAnonymous]
public HttpResponseMessage Options()
{
Expand Down
20 changes: 20 additions & 0 deletions DOL.WHD.Section14c.Api/Controllers/ApplicationController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public ApplicationController(IIdentityService identityService, IApplicationServi
_statusService = statusService;
}

/// <summary>
/// Submit 14c application
/// </summary>
/// <returns>Http status code</returns>
[HttpPost]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
public async Task<HttpResponseMessage> Submit([FromBody]ApplicationSubmission submission)
Expand All @@ -54,6 +58,10 @@ public async Task<HttpResponseMessage> Submit([FromBody]ApplicationSubmission su
return Request.CreateResponse(HttpStatusCode.Created);
}

/// <summary>
/// Returns 14c application by Id
/// </summary>
/// <param name="id">Id</param>
[HttpGet]
[AuthorizeClaims(ApplicationClaimTypes.ViewAllApplications)]
public HttpResponseMessage GetApplication(Guid id)
Expand All @@ -66,6 +74,9 @@ public HttpResponseMessage GetApplication(Guid id)
return Request.CreateResponse(HttpStatusCode.NotFound);
}

/// <summary>
/// Gets summary collection of all 14c applications
/// </summary>
[HttpGet]
[Route("summary")]
[AuthorizeClaims(ApplicationClaimTypes.ViewAllApplications)]
Expand All @@ -76,6 +87,12 @@ public HttpResponseMessage GetApplicationsSummary()
return Request.CreateResponse(HttpStatusCode.OK, applicationSummaries);
}

/// <summary>
/// Change application status
/// </summary>
/// <param name="id">Application Id</param>
/// <param name="statusId">Status Id</param>
/// <returns></returns>
[HttpPost]
[Route("status")]
[AuthorizeClaims(ApplicationClaimTypes.ChangeApplicationStatus)]
Expand All @@ -98,6 +115,9 @@ public async Task<HttpResponseMessage> ChangeApplicationStatus(Guid id, int stat
return Request.CreateResponse(HttpStatusCode.OK, $"/api/application?id={id}");
}

/// <summary>
/// OPTIONS endpoint for CORS
/// </summary>
[AllowAnonymous]
public HttpResponseMessage Options()
{
Expand Down
21 changes: 21 additions & 0 deletions DOL.WHD.Section14c.Api/Controllers/AttachmentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ public AttachmentController(ISaveService saveService, IIdentityService identityS
_saveService = saveService;
_identityService = identityService;
}

/// <summary>
/// Upload Attachment
/// </summary>
/// <param name="EIN">Employer Identification Number</param>
/// <returns>Http status code</returns>
[Route("{EIN}")]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
public async Task<IHttpActionResult> Post(string EIN)
Expand Down Expand Up @@ -62,6 +68,12 @@ public async Task<IHttpActionResult> Post(string EIN)
return Ok(files);
}

/// <summary>
/// Download attachment by Id
/// </summary>
/// <param name="EIN">Employer Identification Number</param>
/// <param name="fileId">File Id</param>
/// <returns></returns>
[HttpGet]
[Route("{EIN}/{fileId}")]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
Expand Down Expand Up @@ -103,6 +115,12 @@ public HttpResponseMessage Download(string EIN, Guid fileId)
}
}

/// <summary>
/// Delete Attachment by Id
/// </summary>
/// <param name="EIN">Employer Identification Number</param>
/// <param name="fileId">File Id</param>
/// <returns></returns>
[HttpDelete]
[Route("{EIN}/{fileId}")]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
Expand All @@ -127,6 +145,9 @@ public IHttpActionResult Delete(string EIN, Guid fileId)
return Ok();
}

/// <summary>
/// OPTIONS endpoint for CORS
/// </summary>
[AllowAnonymous]
public HttpResponseMessage Options()
{
Expand Down
6 changes: 6 additions & 0 deletions DOL.WHD.Section14c.Api/Controllers/ResponseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ public ResponseController(IResponseService responseService)
_responseService = responseService;
}

/// <summary>
/// Returns list of Responses for us on dynamic questions
/// </summary>
/// <param name="questionKey">Optional Question Key</param>
/// <param name="onlyActive">Only return active responses</param>
/// <returns>All options by default, specific question key limits results.</returns>
public IEnumerable<Response> Get(string questionKey = null, bool onlyActive = true)
{
return _responseService.GetResponses(questionKey, onlyActive);
Expand Down
14 changes: 13 additions & 1 deletion DOL.WHD.Section14c.Api/Controllers/SaveController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public SaveController(ISaveService saveService, IIdentityService identityService
_identityService = identityService;
}

/// <summary>
/// Returns pre-submission 14c application
/// </summary>
/// <param name="EIN">Employer Identification Number</param>
[HttpGet]
[Route("{EIN}")]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
Expand All @@ -44,6 +48,11 @@ public IHttpActionResult GetSave(string EIN)
return NotFound();
}

/// <summary>
/// Creates or updates pre-submission 14c application
/// </summary>
/// <param name="EIN"></param>
/// <returns></returns>
[HttpPost]
[Route("{EIN}")]
[AuthorizeClaims(ApplicationClaimTypes.SubmitApplication)]
Expand All @@ -69,7 +78,10 @@ public IHttpActionResult AddSave(string EIN)
_saveService.AddOrUpdate(EIN, state);
return Created($"/api/Save?userId={User.Identity.GetUserId()}&EIN={EIN}", new { });
}


/// <summary>
/// OPTIONS endpoint for CORS
/// </summary>
[AllowAnonymous]
public HttpResponseMessage Options()
{
Expand Down
1 change: 1 addition & 0 deletions DOL.WHD.Section14c.Api/DOL.WHD.Section14c.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
<DocumentationFile>bin\DOL.WHD.Section14c.Api.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down
8 changes: 7 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
version: 1.0.{build}-alpha
version: 1.0.{build}
branches:
only:
- master
assembly_info:
patch: true
file: '**\AssemblyInfo.*'
assembly_version: '{version}'
assembly_file_version: '{version}'
assembly_informational_version: '{version}-alpha'
environment:
COVERALLS_REPO_TOKEN:
secure: Kddo/RjSZXFb9lLk3XL8lH3mb0A9i1koBq+Zp3IIKG5oAU5di672aBcL6H/FPUGF
Expand Down

0 comments on commit 67c88e0

Please sign in to comment.