Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Oqtane.Models;
using OpenEugene.Module.LittleHelpBook.Models;
using OpenEugene.Module.LittleHelpBook.Repository;
using OpenEugene.Module.LittleHelpBook.Shared;

namespace OE.Module.LHB.Controllers
{
Expand All @@ -25,6 +26,7 @@ public AddressController(LittleHelpBookRepository LittleHelpBookRepository, ILog

// POST api/<controller>
[HttpPost]
[Authorize(Roles = LhbRoleNames.Editors)]
public Address Post([FromBody] Address item)
{
if (ModelState.IsValid )
Expand All @@ -43,6 +45,7 @@ public Address Post([FromBody] Address item)

// DELETE api/<controller>/5
[HttpDelete("{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public void Delete(int id)
{
var item = _LittleHelpBookRepository.GetAddressByAddressId(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using System.Net;
using OpenEugene.Module.LittleHelpBook.Models;
using OpenEugene.Module.LittleHelpBook.Repository;
using Microsoft.AspNetCore.Authorization;
using OpenEugene.Module.LittleHelpBook.Shared;

namespace OE.Module.LHB.Controllers;

Expand All @@ -19,6 +21,7 @@ public class PhoneNumberController : ModuleControllerBase

// POST api/<controller>
[HttpPost]
[Authorize(Roles = LhbRoleNames.Editors)]
public PhoneNumber Post([FromBody] PhoneNumber item)
{
if (ModelState.IsValid)
Expand All @@ -38,6 +41,7 @@ public PhoneNumber Post([FromBody] PhoneNumber item)

// DELETE api/<controller>/5
[HttpDelete("{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public void Delete(int id)
{
var item = _LittleHelpBookRepository.GetPhoneNumberByPhoneNumberId(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using OpenEugene.Module.LittleHelpBook.ViewModels;
using OpenEugene.Module.LittleHelpBook.Models;
using OpenEugene.Module.LittleHelpBook.Repository;

using OpenEugene.Module.LittleHelpBook.Shared;

namespace OE.Module.LHB.Controllers
{
Expand Down Expand Up @@ -70,6 +70,7 @@ public ActionResult<List<ProviderViewModel>> GetProviderAttributes(int id)

// POST api/<controller>
[HttpPost]
[Authorize(Roles = LhbRoleNames.Editors)]
public Provider Post([FromBody] Provider item)
{
if (ModelState.IsValid )
Expand All @@ -87,6 +88,7 @@ public Provider Post([FromBody] Provider item)

// PUT api/<controller>/5
[HttpPut("{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public Provider Put(int id, [FromBody] Provider item)
{
if (ModelState.IsValid && _LittleHelpBookRepository.GetProvider(item.ProviderId, false) != null)
Expand All @@ -105,6 +107,7 @@ public Provider Put(int id, [FromBody] Provider item)

// PUT api/<controller>/5
[HttpPut("vm/{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public ProviderViewModel PutVm(int id, [FromBody] ProviderViewModel item)
{
if (ModelState.IsValid)
Expand All @@ -123,6 +126,7 @@ public ProviderViewModel PutVm(int id, [FromBody] ProviderViewModel item)

// DELETE api/<controller>/5
[HttpDelete("{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public void Delete(int id)
{
Provider item = _LittleHelpBookRepository.GetProvider(id);
Expand All @@ -140,6 +144,7 @@ public void Delete(int id)

// POST api/<controller>
[HttpPost]
[Authorize(Roles = LhbRoleNames.Editors)]
public Address Post([FromBody] Address item)
{
if (ModelState.IsValid)
Expand All @@ -154,8 +159,10 @@ public Address Post([FromBody] Address item)
item = null;
}
return item;
} // POST api/<controller>
}
// POST api/<controller>
[HttpPost("ProviderAttribute")]
[Authorize(Roles = LhbRoleNames.Editors)]
public ProviderAttribute Post([FromBody] ProviderAttribute item)
{
if (ModelState.IsValid)
Expand All @@ -175,6 +182,7 @@ public ProviderAttribute Post([FromBody] ProviderAttribute item)

// DELETE api/<controller>/5
[HttpDelete("ProviderAttribute/{id}")]
[Authorize(Roles = LhbRoleNames.Editors)]
public void DeleteProviderAttribute(int id)
{
var item = _LittleHelpBookRepository.GetProviderAttribute(id);
Expand Down
3 changes: 2 additions & 1 deletion OpenEugene.Module.LittleHelpBook/Shared/Shared/RoleNames.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Oqtane.Shared;
namespace OpenEugene.Module.LittleHelpBook.Shared
{
public partial class LhbRoleNames {
public partial class LhbRoleNames : RoleNames {
public const string Editors = "Editors";
}
}