Skip to content

Commit

Permalink
lots of user manager work
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkis117 committed Aug 19, 2016
1 parent daef199 commit 540f8b2
Show file tree
Hide file tree
Showing 51 changed files with 2,640 additions and 1,733 deletions.
2 changes: 1 addition & 1 deletion Mime-Detective
1 change: 1 addition & 0 deletions src/GenericMvcUtilities.Test.Library/project.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -3592,6 +3592,7 @@
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Mvc.ViewFeatures": "1.0.0",
"Microsoft.AspNetCore.Razor": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/GenericMvcUtilities/Attributes/AuthorizationAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

namespace GenericMvcUtilities.Attributes
{
public class AuthorizeUserManaging : AuthorizeAttribute
public class AuthorizeUserAdmin : AuthorizeAttribute
{
public AuthorizeUserManaging()
public AuthorizeUserAdmin()
{
Roles = $"{RoleHelper.SystemOwner},{RoleHelper.UserAdmin}";
}
Expand Down
23 changes: 8 additions & 15 deletions src/GenericMvcUtilities/Controllers/BaseApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public BaseApiController(IRepository<T> repository, ILogger<T> logger)
}
}

/*
/// <summary>
/// Matches the by identifier expression.
/// </summary>
Expand All @@ -69,6 +70,7 @@ public Expression<Func<IModel<TKey>, bool>> MatchByIdExpression(object id)
var binaryExpression = Expression.Equal(propertyOrField, Expression.Constant(id));
return Expression.Lambda<Func<IModel<TKey>, bool>>(binaryExpression, parameterExpression);
}
*/

[NonAction]
protected string FormatLogMessage(string message, Microsoft.AspNetCore.Http.HttpRequest request)
Expand Down Expand Up @@ -134,9 +136,7 @@ protected virtual async Task<ICollection<T>> DifferentalExistance(ICollection<T>
}
}

[AllowAnonymous]
[Route("[controller]/[action]/")]
[HttpGet]
[Route("[controller]/[action]/"), HttpGet]
public virtual async Task<IEnumerable<T>> GetAll()
{
try
Expand All @@ -155,9 +155,7 @@ public virtual async Task<IEnumerable<T>> GetAll()
}

//todo change back to mvc style
[AllowAnonymous]
[Route("[controller]/[action]/")]
[HttpGet("{id}")]
[Route("[controller]/[action]/"), HttpGet("{id}")]
public virtual async Task<T> Get(TKey id)
{
try
Expand Down Expand Up @@ -217,8 +215,7 @@ public virtual async Task<T> Get(TKey id)
/// or
/// </exception>
//[AllowAnonymous] //Testing only
[Route("[controller]/[action]/")]
[HttpPost]
[Route("[controller]/[action]/"), HttpPost]
public virtual async Task<IActionResult> Create([FromBody] T item)
{
try
Expand Down Expand Up @@ -285,9 +282,7 @@ public virtual async Task<IActionResult> Create([FromBody] T item)
/// Inserting items failed
/// or
/// </exception>
//[AllowAnonymous] //testing only
[Route("[controller]/[action]/")]
[HttpPost]
[Route("[controller]/[action]/"), HttpPost]
public virtual async Task<IActionResult> Creates([FromBody] T[] items)
{
try
Expand Down Expand Up @@ -335,8 +330,7 @@ public virtual async Task<IActionResult> Creates([FromBody] T[] items)
}

//todo: add behavior for returning updated section
[Route("[controller]/[action]/")]
[HttpPost("{id}")]
[Route("[controller]/[action]/"), HttpPost("{id}")]
public virtual async Task<IActionResult> Update(TKey id, [FromBody] T item)
{
try
Expand Down Expand Up @@ -398,8 +392,7 @@ public virtual async Task<IActionResult> Update(TKey id, [FromBody] T item)


//fixed: fix design oversight to have whole object deleted
[Route("[controller]/[action]/")]
[HttpDelete("{id}")]
[Route("[controller]/[action]/"), HttpDelete("{id}")]
public virtual async Task<IActionResult> Delete(TKey id)
{
try
Expand Down
Loading

0 comments on commit 540f8b2

Please sign in to comment.