diff --git a/Oqtane.Server/Modules/HtmlText/Controllers/HtmlTextController.cs b/Oqtane.Server/Modules/HtmlText/Controllers/HtmlTextController.cs index ba164d4f..6db9e5de 100644 --- a/Oqtane.Server/Modules/HtmlText/Controllers/HtmlTextController.cs +++ b/Oqtane.Server/Modules/HtmlText/Controllers/HtmlTextController.cs @@ -24,7 +24,7 @@ namespace Oqtane.Modules.HtmlText.Controllers // GET api//5 [HttpGet("{id}")] - [Authorize(Policy = "ViewModule")] + [Authorize(Policy = PolicyNames.ViewModule)] public List Get(int id) { var list = new List(); @@ -47,7 +47,7 @@ namespace Oqtane.Modules.HtmlText.Controllers // POST api/ [HttpPost] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public HtmlTextInfo Post([FromBody] HtmlTextInfo htmlText) { try @@ -68,7 +68,7 @@ namespace Oqtane.Modules.HtmlText.Controllers // PUT api//5 [HttpPut("{id}")] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public HtmlTextInfo Put(int id, [FromBody] HtmlTextInfo htmlText) { try @@ -89,7 +89,7 @@ namespace Oqtane.Modules.HtmlText.Controllers // DELETE api//5 [HttpDelete("{id}")] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public void Delete(int id) { try diff --git a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj index 60db0e22..21883a65 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj +++ b/Oqtane.Server/wwwroot/Modules/Templates/External/Server/[Owner].[Module].Server.csproj @@ -31,7 +31,7 @@ - [ServerReference] - [SharedReference] + + diff --git a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs index c8fe7485..5dcadfea 100644 --- a/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs +++ b/Oqtane.Server/wwwroot/Modules/Templates/Internal/Oqtane.Server/Modules/[Owner].[Module]/Controllers/[Module]Controller.cs @@ -30,7 +30,7 @@ namespace [Owner].[Module].Controllers // GET: api/?moduleid=x [HttpGet] - [Authorize(Policy = "ViewModule")] + [Authorize(Policy = PolicyNames.ViewModule)] public IEnumerable Get(string moduleid) { return _[Module]Repository.Get[Module]s(int.Parse(moduleid)); @@ -38,7 +38,7 @@ namespace [Owner].[Module].Controllers // GET api//5 [HttpGet("{id}")] - [Authorize(Policy = "ViewModule")] + [Authorize(Policy = PolicyNames.ViewModule)] public Models.[Module] Get(int id) { Models.[Module] [Module] = _[Module]Repository.Get[Module](id); @@ -51,7 +51,7 @@ namespace [Owner].[Module].Controllers // POST api/ [HttpPost] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public Models.[Module] Post([FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) @@ -64,7 +64,7 @@ namespace [Owner].[Module].Controllers // PUT api//5 [HttpPut("{id}")] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public Models.[Module] Put(int id, [FromBody] Models.[Module] [Module]) { if (ModelState.IsValid && [Module].ModuleId == _entityId) @@ -77,7 +77,7 @@ namespace [Owner].[Module].Controllers // DELETE api//5 [HttpDelete("{id}")] - [Authorize(Policy = "EditModule")] + [Authorize(Policy = PolicyNames.EditModule)] public void Delete(int id) { Models.[Module] [Module] = _[Module]Repository.Get[Module](id); diff --git a/Oqtane.Shared/Shared/PolicyNames.cs b/Oqtane.Shared/Shared/PolicyNames.cs new file mode 100644 index 00000000..71e27a8d --- /dev/null +++ b/Oqtane.Shared/Shared/PolicyNames.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Oqtane.Shared { + public class PolicyNames { + public const string ViewModule = "ViewModule"; + public const string EditModule = "EditModule"; + } +}