From c4a84e9adccb95eb8bcf562525b8426a1941db42 Mon Sep 17 00:00:00 2001 From: James Tombleson Date: Sun, 23 Jul 2023 16:22:11 -0700 Subject: [PATCH] moved some rest actions over to roles --- Newsbot.Collector.Api/Controllers/CodeProjectController.cs | 2 +- Newsbot.Collector.Api/Controllers/RssController.cs | 2 +- Newsbot.Collector.Api/Controllers/SourcesController.cs | 6 +++--- Newsbot.Collector.Api/Controllers/YoutubeController.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Newsbot.Collector.Api/Controllers/CodeProjectController.cs b/Newsbot.Collector.Api/Controllers/CodeProjectController.cs index e4ec6d9..4929d39 100644 --- a/Newsbot.Collector.Api/Controllers/CodeProjectController.cs +++ b/Newsbot.Collector.Api/Controllers/CodeProjectController.cs @@ -25,7 +25,7 @@ public class CodeProjectController } [HttpPost("check")] - [Authorize(Roles = AuthorizationRoles.Administrators)] + [Authorize(Roles = Authorization.AdministratorsRole)] public void PullNow() { BackgroundJob.Enqueue(x => x.InitAndExecute(new CodeProjectWatcherJobOptions diff --git a/Newsbot.Collector.Api/Controllers/RssController.cs b/Newsbot.Collector.Api/Controllers/RssController.cs index 8b13143..bfaaa7d 100644 --- a/Newsbot.Collector.Api/Controllers/RssController.cs +++ b/Newsbot.Collector.Api/Controllers/RssController.cs @@ -28,7 +28,7 @@ public class RssController } [HttpPost("check")] - [Authorize(Roles = AuthorizationRoles.Administrators)] + [Authorize(Roles = Authorization.AdministratorsRole)] public void CheckReddit() { BackgroundJob.Enqueue(x => x.InitAndExecute(new RssWatcherJobOptions diff --git a/Newsbot.Collector.Api/Controllers/SourcesController.cs b/Newsbot.Collector.Api/Controllers/SourcesController.cs index 1afda4f..8bd4b27 100644 --- a/Newsbot.Collector.Api/Controllers/SourcesController.cs +++ b/Newsbot.Collector.Api/Controllers/SourcesController.cs @@ -200,14 +200,14 @@ public class SourcesController : ControllerBase return SourceDto.Convert(item); } - [Authorize(Roles = AuthorizationRoles.Administrators)] + [Authorize(Roles = Authorization.AdministratorsRole)] [HttpPost("{id}/disable")] public void Disable(Guid id) { _sources.Disable(id); } - [Authorize(Roles = AuthorizationRoles.Administrators)] + [Authorize(Roles = Authorization.AdministratorsRole)] [HttpPost("{id}/enable")] public void Enable(Guid id) { @@ -215,7 +215,7 @@ public class SourcesController : ControllerBase } [HttpDelete("{id}")] - [Authorize(Roles = AuthorizationRoles.Administrators)] + [Authorize(Roles = Authorization.AdministratorsRole)] public void Delete(Guid id, bool purgeOrphanedRecords) { _sources.Delete(id); diff --git a/Newsbot.Collector.Api/Controllers/YoutubeController.cs b/Newsbot.Collector.Api/Controllers/YoutubeController.cs index 91c909f..b3f34e1 100644 --- a/Newsbot.Collector.Api/Controllers/YoutubeController.cs +++ b/Newsbot.Collector.Api/Controllers/YoutubeController.cs @@ -28,7 +28,7 @@ public class YoutubeController } [HttpPost("check")] - [Authorize(Policy = AuthorizationRoles.Administrators)] + [Authorize(Policy = Authorization.AdministratorsRole)] public void CheckYoutube() { BackgroundJob.Enqueue(x => x.InitAndExecute(new YoutubeWatcherJobOptions