diff --git a/CategoryPages/basecamp2.html b/CategoryPages/basecamp2.html deleted file mode 100644 index a1e1bbe0bd..0000000000 --- a/CategoryPages/basecamp2.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
- -
-

Plan Directory - basecamp2.html

-
- - -
-
-

Plan Definition Description

-

Related Plans

- - - - - - - - - - - - - - - - - - -
#Plan NamePlan DescriptionAction
1BasecampBasecampCreate
-
- - diff --git a/CategoryPages/built-in services-slack.html b/CategoryPages/built-in services-slack.html deleted file mode 100644 index f5f7faf28a..0000000000 --- a/CategoryPages/built-in services-slack.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
- -
-

Plan Directory - built-in services-slack.html

-
- - - - - -
-
-

Plan Definition Description

-

Related Plans

- - - - - - - - - - - - - - - - - - -
#Plan NamePlan DescriptionAction
1Core+SlackCore+SlackCreate
-
- - diff --git a/CategoryPages/built-in services.html b/CategoryPages/built-in services.html deleted file mode 100644 index 8525984b03..0000000000 --- a/CategoryPages/built-in services.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
- -
-

Plan Directory - built-in services.html

-
- - -
-
-

Plan Definition Description

-

Related Plans

- - - - - - - - - - - - - - - - - - -
#Plan NamePlan DescriptionAction
1Core+SlackCore+SlackCreate
-
- - diff --git a/CategoryPages/slack.html b/CategoryPages/slack.html deleted file mode 100644 index 43ee029562..0000000000 --- a/CategoryPages/slack.html +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - -
- -
- -
-

Plan Directory - slack.html

-
- - -
-
-

Plan Definition Description

-

Related Plans

- - - - - - - - - - - - - - - - - - - - - - - - -
#Plan NamePlan DescriptionAction
1Slack+SlackSlack+SlackCreate
2Core+SlackCore+SlackCreate
-
- - diff --git a/Content/css/plan-directory.css b/Content/css/plan-directory.css index 1a66c340fc..5ff2677d10 100644 --- a/Content/css/plan-directory.css +++ b/Content/css/plan-directory.css @@ -108,6 +108,7 @@ header#site-header:after { /*Search Bar Container*/ .search-bar-container { + width: 100%; text-align: center; display: inline-block; padding: 0 1em; @@ -138,6 +139,7 @@ header#site-header:after { text-align: center; padding: 0 1em; display: inline-block; + width: 100%; } .result-container .base-block-white { diff --git a/Controllers/Api/AuthenticationController.cs b/Controllers/Api/AuthenticationController.cs index 471f371c31..39200c6370 100644 --- a/Controllers/Api/AuthenticationController.cs +++ b/Controllers/Api/AuthenticationController.cs @@ -21,6 +21,7 @@ using HubWeb.Infrastructure_HubWeb; using System.Web.Http.Description; using Fr8.Infrastructure; +using Fr8.Infrastructure.Utilities.Logging; using Hub.Services; using Newtonsoft.Json; using Swashbuckle.Swagger.Annotations; @@ -127,6 +128,7 @@ public IHttpActionResult Login([FromUri]string username, [FromUri]string passwor { if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { + Logger.GetLogger().Warn($"Username or password is not specified"); return BadRequest("Username or password is not specified"); } @@ -151,6 +153,7 @@ public IHttpActionResult Login([FromUri]string username, [FromUri]string passwor } } } + Logger.GetLogger().Warn($"Loging failed for {username}"); return StatusCode(HttpStatusCode.Forbidden); } diff --git a/Controllers/Api/PageGenerationController.cs b/Controllers/Api/PageGenerationController.cs index 34dc1e93ee..71adb7fd91 100644 --- a/Controllers/Api/PageGenerationController.cs +++ b/Controllers/Api/PageGenerationController.cs @@ -1,6 +1,7 @@ using System.Threading.Tasks; using System.Web.Http; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Enums; +using Hub.Interfaces; using StructureMap; namespace HubWeb.Controllers.Api diff --git a/Controllers/Api/PlanTemplatesController.cs b/Controllers/Api/PlanTemplatesController.cs index d4e7b4c157..c602f43170 100644 --- a/Controllers/Api/PlanTemplatesController.cs +++ b/Controllers/Api/PlanTemplatesController.cs @@ -4,10 +4,10 @@ using System.Threading.Tasks; using System.Web.Http; using Fr8.Infrastructure.Data.DataTransferObjects; +using Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory; using Fr8.Infrastructure.Utilities.Configuration; using Hub.Infrastructure; using Hub.Interfaces; -using HubWeb.Infrastructure_PD.Interfaces; using log4net; using Microsoft.AspNet.Identity; using PlanDirectory.Infrastructure; @@ -37,7 +37,6 @@ public PlanTemplatesController() [HttpPost] [Fr8ApiAuthorize] - [PlanDirectoryHMACAuthenticate] public async Task Post(PublishPlanTemplateDTO dto) { var fr8AccountId = User.Identity.GetUserId(); @@ -49,7 +48,6 @@ public async Task Post(PublishPlanTemplateDTO dto) [HttpDelete] [Fr8ApiAuthorize] - [PlanDirectoryHMACAuthenticate] public async Task Delete(Guid id) { var identity = User.Identity as ClaimsIdentity; @@ -73,7 +71,6 @@ public async Task Delete(Guid id) [HttpGet] [Fr8ApiAuthorize] - [PlanDirectoryHMACAuthenticate] public async Task Get(Guid id) { var fr8AccountId = User.Identity.GetUserId(); @@ -100,7 +97,6 @@ public async Task Search( [HttpPost] [Fr8ApiAuthorize] - [PlanDirectoryHMACAuthenticate] public async Task CreatePlan(Guid id) { try diff --git a/Controllers/Api/PlansController.cs b/Controllers/Api/PlansController.cs index 4481f866a7..468a95a366 100644 --- a/Controllers/Api/PlansController.cs +++ b/Controllers/Api/PlansController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Net; using System.Net.Http; +using System.Security.Claims; using System.Web.Http; using System.Web.Http.Description; using AutoMapper; @@ -448,7 +449,10 @@ public async Task Share(Guid planId) [SwaggerResponseRemoveDefaults] public async Task Unpublish(Guid planId) { - await _planDirectoryService.Unpublish(planId, User.Identity.GetUserId()); + var identity = User.Identity as ClaimsIdentity; + var privileged = identity.HasClaim(ClaimsIdentity.DefaultRoleClaimType, "Admin"); + + await _planDirectoryService.Unpublish(planId, User.Identity.GetUserId(), privileged); return Ok(); } /// diff --git a/Infrastructure_PD/Interfaces/CreatePlanDTO.cs b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/CreatePlanDTO.cs similarity index 56% rename from Infrastructure_PD/Interfaces/CreatePlanDTO.cs rename to Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/CreatePlanDTO.cs index 02cb159ee1..719ef03558 100644 --- a/Infrastructure_PD/Interfaces/CreatePlanDTO.cs +++ b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/CreatePlanDTO.cs @@ -1,4 +1,4 @@ -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory { public class CreatePlanDTO { diff --git a/Infrastructure_PD/Interfaces/SearchItemDTO.cs b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchItemDTO.cs similarity index 78% rename from Infrastructure_PD/Interfaces/SearchItemDTO.cs rename to Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchItemDTO.cs index 564f79ccc1..405dad1f5c 100644 --- a/Infrastructure_PD/Interfaces/SearchItemDTO.cs +++ b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchItemDTO.cs @@ -1,6 +1,6 @@ using System; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory { public class SearchItemDTO { diff --git a/Infrastructure_PD/Interfaces/SearchRequestDTO.cs b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchRequestDTO.cs similarity index 71% rename from Infrastructure_PD/Interfaces/SearchRequestDTO.cs rename to Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchRequestDTO.cs index d114f06656..c11e57b46b 100644 --- a/Infrastructure_PD/Interfaces/SearchRequestDTO.cs +++ b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchRequestDTO.cs @@ -1,4 +1,4 @@ -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory { public class SearchRequestDTO { diff --git a/Infrastructure_PD/Interfaces/SearchResultDTO.cs b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchResultDTO.cs similarity index 74% rename from Infrastructure_PD/Interfaces/SearchResultDTO.cs rename to Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchResultDTO.cs index 7fd58991fa..603f93fa32 100644 --- a/Infrastructure_PD/Interfaces/SearchResultDTO.cs +++ b/Fr8Infrastructure.NET/Data/DataTransferObjects/PlanDirectory/SearchResultDTO.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory { public class SearchResultDTO { diff --git a/Fr8Infrastructure.NET/Fr8Infrastructure.NET.csproj b/Fr8Infrastructure.NET/Fr8Infrastructure.NET.csproj index f005a2a5f4..a757aaa1f5 100644 --- a/Fr8Infrastructure.NET/Fr8Infrastructure.NET.csproj +++ b/Fr8Infrastructure.NET/Fr8Infrastructure.NET.csproj @@ -210,6 +210,10 @@ + + + + diff --git a/Infrastructure_PD/Interfaces/GenerateMode.cs b/Hub/Enums/GenerateMode.cs similarity index 72% rename from Infrastructure_PD/Interfaces/GenerateMode.cs rename to Hub/Enums/GenerateMode.cs index 64c87c4f0f..7a3028b0d3 100644 --- a/Infrastructure_PD/Interfaces/GenerateMode.cs +++ b/Hub/Enums/GenerateMode.cs @@ -1,4 +1,4 @@ -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Enums { public enum GenerateMode { diff --git a/Infrastructure_PD/Exceptions/ManifestGenerationException.cs b/Hub/Exceptions/ManifestGenerationException.cs similarity index 78% rename from Infrastructure_PD/Exceptions/ManifestGenerationException.cs rename to Hub/Exceptions/ManifestGenerationException.cs index b80f60f735..b2d544f7f1 100644 --- a/Infrastructure_PD/Exceptions/ManifestGenerationException.cs +++ b/Hub/Exceptions/ManifestGenerationException.cs @@ -1,6 +1,6 @@ using System; -namespace HubWeb.Infrastructure_PD.Exceptions +namespace Hub.Exceptions { public class ManifestGenerationException : Exception { diff --git a/Infrastructure_PD/Exceptions/ManifestNotFoundException.cs b/Hub/Exceptions/ManifestNotFoundException.cs similarity index 81% rename from Infrastructure_PD/Exceptions/ManifestNotFoundException.cs rename to Hub/Exceptions/ManifestNotFoundException.cs index be549f5197..6884af9e40 100644 --- a/Infrastructure_PD/Exceptions/ManifestNotFoundException.cs +++ b/Hub/Exceptions/ManifestNotFoundException.cs @@ -1,4 +1,4 @@ -namespace HubWeb.Infrastructure_PD.Exceptions +namespace Hub.Exceptions { public class ManifestNotFoundException : ManifestGenerationException { diff --git a/Infrastructure_PD/Exceptions/ManifestPageNotFoundException.cs b/Hub/Exceptions/ManifestPageNotFoundException.cs similarity index 83% rename from Infrastructure_PD/Exceptions/ManifestPageNotFoundException.cs rename to Hub/Exceptions/ManifestPageNotFoundException.cs index 03a5fd1a93..f911d4e0e3 100644 --- a/Infrastructure_PD/Exceptions/ManifestPageNotFoundException.cs +++ b/Hub/Exceptions/ManifestPageNotFoundException.cs @@ -1,4 +1,4 @@ -namespace HubWeb.Infrastructure_PD.Exceptions +namespace Hub.Exceptions { public class ManifestPageNotFoundException : ManifestGenerationException { diff --git a/Hub/Hub.csproj b/Hub/Hub.csproj index eded839fae..c1f121ff1b 100644 --- a/Hub/Hub.csproj +++ b/Hub/Hub.csproj @@ -139,6 +139,10 @@ ..\packages\Microsoft.AspNet.Identity.Owin.2.0.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll + + ..\packages\Microsoft.Azure.Search.1.1.2\lib\net45\Microsoft.Azure.Search.dll + True + ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll @@ -156,6 +160,18 @@ ..\packages\Microsoft.Owin.Security.Cookies.3.0.1\lib\net45\Microsoft.Owin.Security.Cookies.dll True + + ..\packages\Microsoft.Rest.ClientRuntime.1.8.1\lib\net45\Microsoft.Rest.ClientRuntime.dll + True + + + ..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.2\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll + True + + + ..\packages\Microsoft.Spatial.6.13.0\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.Spatial.dll + True + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll @@ -297,11 +313,15 @@ + + + + @@ -313,11 +333,17 @@ + + + + + + @@ -326,6 +352,16 @@ + + ManifestDescriptionTemplate.tt + True + True + + + PlanCategoryTemplate.tt + True + True + @@ -398,6 +434,13 @@ + + + + + + + @@ -408,7 +451,10 @@ + + + @@ -428,6 +474,7 @@ + @@ -445,6 +492,10 @@ + + TextTemplatingFilePreprocessor + PlanCategoryTemplate.cs + Designer @@ -460,12 +511,15 @@ + + TextTemplatingFilePreprocessor + ManifestDescriptionTemplate.cs + - diff --git a/Infrastructure_PD/Interfaces/IManifestPageGenerator.cs b/Hub/Interfaces/IManifestPageGenerator.cs similarity index 80% rename from Infrastructure_PD/Interfaces/IManifestPageGenerator.cs rename to Hub/Interfaces/IManifestPageGenerator.cs index 1f346ac557..967fa69cd9 100644 --- a/Infrastructure_PD/Interfaces/IManifestPageGenerator.cs +++ b/Hub/Interfaces/IManifestPageGenerator.cs @@ -1,7 +1,8 @@ using System; using System.Threading.Tasks; +using Hub.Enums; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface IManifestPageGenerator { diff --git a/Hub/Interfaces/IPlanDirectoryService.cs b/Hub/Interfaces/IPlanDirectoryService.cs index 254fa894f2..6971834179 100644 --- a/Hub/Interfaces/IPlanDirectoryService.cs +++ b/Hub/Interfaces/IPlanDirectoryService.cs @@ -21,7 +21,7 @@ public interface IPlanDirectoryService Task GetTemplate(Guid id, string userId); Task Share(Guid planId, string userId); - Task Unpublish(Guid planId, string userId); + Task Unpublish(Guid planId, string userId, bool privileged); PlanDTO CrateTemplate(Guid planId, string userId); PlanNoChildrenDTO CreateFromTemplate(PlanDTO plan, string userId); } diff --git a/Infrastructure_PD/Interfaces/IPlanTemplate.cs b/Hub/Interfaces/IPlanTemplate.cs similarity index 91% rename from Infrastructure_PD/Interfaces/IPlanTemplate.cs rename to Hub/Interfaces/IPlanTemplate.cs index 77b39e5017..e03d98a9b3 100644 --- a/Infrastructure_PD/Interfaces/IPlanTemplate.cs +++ b/Hub/Interfaces/IPlanTemplate.cs @@ -3,7 +3,7 @@ using Fr8.Infrastructure.Data.DataTransferObjects; using Fr8.Infrastructure.Data.Manifests; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface IPlanTemplate { diff --git a/Infrastructure_PD/Interfaces/ISearchProvider.cs b/Hub/Interfaces/ISearchProvider.cs similarity index 78% rename from Infrastructure_PD/Interfaces/ISearchProvider.cs rename to Hub/Interfaces/ISearchProvider.cs index 11c7f85a64..f92b942aee 100644 --- a/Infrastructure_PD/Interfaces/ISearchProvider.cs +++ b/Hub/Interfaces/ISearchProvider.cs @@ -1,8 +1,9 @@ using System; using System.Threading.Tasks; +using Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory; using Fr8.Infrastructure.Data.Manifests; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface ISearchProvider { diff --git a/Infrastructure_PD/Interfaces/ITagGenerator.cs b/Hub/Interfaces/ITagGenerator.cs similarity index 70% rename from Infrastructure_PD/Interfaces/ITagGenerator.cs rename to Hub/Interfaces/ITagGenerator.cs index d43c8dfbbd..897cd9e2c2 100644 --- a/Infrastructure_PD/Interfaces/ITagGenerator.cs +++ b/Hub/Interfaces/ITagGenerator.cs @@ -1,8 +1,8 @@ using System.Threading.Tasks; using Fr8.Infrastructure.Data.Manifests; -using HubWeb.Infrastructure_PD.Infrastructure; +using Hub.Services.PlanDirectory; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface ITagGenerator { diff --git a/Infrastructure_PD/Interfaces/ITemplateGenerator.cs b/Hub/Interfaces/ITemplateGenerator.cs similarity index 89% rename from Infrastructure_PD/Interfaces/ITemplateGenerator.cs rename to Hub/Interfaces/ITemplateGenerator.cs index a65bcb3a66..537a94ac81 100644 --- a/Infrastructure_PD/Interfaces/ITemplateGenerator.cs +++ b/Hub/Interfaces/ITemplateGenerator.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface ITemplateGenerator { diff --git a/Infrastructure_PD/Interfaces/IWebservicesPageGenerator.cs b/Hub/Interfaces/IWebservicesPageGenerator.cs similarity index 82% rename from Infrastructure_PD/Interfaces/IWebservicesPageGenerator.cs rename to Hub/Interfaces/IWebservicesPageGenerator.cs index 3a07900e03..a4be053be9 100644 --- a/Infrastructure_PD/Interfaces/IWebservicesPageGenerator.cs +++ b/Hub/Interfaces/IWebservicesPageGenerator.cs @@ -1,7 +1,7 @@ using System.Threading.Tasks; using Fr8.Infrastructure.Data.Manifests; -namespace HubWeb.Infrastructure_PD.Interfaces +namespace Hub.Interfaces { public interface IWebservicesPageGenerator { diff --git a/ManifestPages/ManifestDescriptionTemplate.cs b/Hub/Resources/ManifestDescriptionTemplate.cs similarity index 99% rename from ManifestPages/ManifestDescriptionTemplate.cs rename to Hub/Resources/ManifestDescriptionTemplate.cs index 9553607c7b..51d48b8dab 100644 --- a/ManifestPages/ManifestDescriptionTemplate.cs +++ b/Hub/Resources/ManifestDescriptionTemplate.cs @@ -7,11 +7,11 @@ // the code is regenerated. // // ------------------------------------------------------------------------------ -namespace HubWeb.ManifestPages + +using Newtonsoft.Json; + +namespace Hub.Resources { - using Newtonsoft.Json; - using System; - /// /// Class to produce the template output /// diff --git a/ManifestPages/ManifestDescriptionTemplate.tt b/Hub/Resources/ManifestDescriptionTemplate.tt similarity index 100% rename from ManifestPages/ManifestDescriptionTemplate.tt rename to Hub/Resources/ManifestDescriptionTemplate.tt diff --git a/CategoryPages/PlanCategoryTemplate.cs b/Hub/Resources/PlanCategoryTemplate.cs similarity index 99% rename from CategoryPages/PlanCategoryTemplate.cs rename to Hub/Resources/PlanCategoryTemplate.cs index f69c0b5254..cf84bf1524 100644 --- a/CategoryPages/PlanCategoryTemplate.cs +++ b/Hub/Resources/PlanCategoryTemplate.cs @@ -7,10 +7,9 @@ // the code is regenerated. // // ------------------------------------------------------------------------------ -namespace HubWeb.CategoryPages + +namespace Hub.Resources { - using System; - /// /// Class to produce the template output /// diff --git a/CategoryPages/PlanCategoryTemplate.tt b/Hub/Resources/PlanCategoryTemplate.tt similarity index 100% rename from CategoryPages/PlanCategoryTemplate.tt rename to Hub/Resources/PlanCategoryTemplate.tt diff --git a/Infrastructure_PD/Infrastructure/ActivityTemplateTag.cs b/Hub/Services/PlanDirectory/ActivityTemplateTag.cs similarity index 93% rename from Infrastructure_PD/Infrastructure/ActivityTemplateTag.cs rename to Hub/Services/PlanDirectory/ActivityTemplateTag.cs index ced4ec2c36..dbddfb6359 100644 --- a/Infrastructure_PD/Infrastructure/ActivityTemplateTag.cs +++ b/Hub/Services/PlanDirectory/ActivityTemplateTag.cs @@ -4,7 +4,7 @@ using Fr8.Infrastructure.Data.DataTransferObjects; using Newtonsoft.Json; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class ActivityTemplateTag : TemplateTag { diff --git a/Infrastructure_PD/Infrastructure/ManifestPageGenerator.cs b/Hub/Services/PlanDirectory/ManifestPageGenerator.cs similarity index 96% rename from Infrastructure_PD/Infrastructure/ManifestPageGenerator.cs rename to Hub/Services/PlanDirectory/ManifestPageGenerator.cs index 94b474412b..dad08e82f3 100644 --- a/Infrastructure_PD/Infrastructure/ManifestPageGenerator.cs +++ b/Hub/Services/PlanDirectory/ManifestPageGenerator.cs @@ -5,13 +5,12 @@ using Data.Entities; using Data.Interfaces; using Fr8.Infrastructure.Data.Manifests; +using Hub.Enums; +using Hub.Exceptions; using Hub.Interfaces; -using HubWeb.Infrastructure_PD.Exceptions; -using HubWeb.Infrastructure_PD.Interfaces; -using HubWeb.ManifestPages; +using Hub.Resources; - -namespace PlanDirectory.Infrastructure +namespace Hub.Services.PlanDirectory { public class ManifestPageGenerator : IManifestPageGenerator { diff --git a/Infrastructure_PD/Infrastructure/PlanTemplate.Impl.cs b/Hub/Services/PlanDirectory/PlanTemplate.Impl.cs similarity index 98% rename from Infrastructure_PD/Infrastructure/PlanTemplate.Impl.cs rename to Hub/Services/PlanDirectory/PlanTemplate.Impl.cs index 3b63f612a6..473a3b543f 100644 --- a/Infrastructure_PD/Infrastructure/PlanTemplate.Impl.cs +++ b/Hub/Services/PlanDirectory/PlanTemplate.Impl.cs @@ -7,10 +7,10 @@ using Data.States; using Fr8.Infrastructure.Data.DataTransferObjects; using Fr8.Infrastructure.Data.Manifests; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Interfaces; using StructureMap; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class PlanTemplate : IPlanTemplate { diff --git a/Infrastructure_PD/Infrastructure/SearchProvider.Impl.cs b/Hub/Services/PlanDirectory/SearchProvider.Impl.cs similarity index 98% rename from Infrastructure_PD/Infrastructure/SearchProvider.Impl.cs rename to Hub/Services/PlanDirectory/SearchProvider.Impl.cs index 099021b9ce..8523785b75 100644 --- a/Infrastructure_PD/Infrastructure/SearchProvider.Impl.cs +++ b/Hub/Services/PlanDirectory/SearchProvider.Impl.cs @@ -2,13 +2,14 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory; using Fr8.Infrastructure.Data.Manifests; using Fr8.Infrastructure.Utilities.Configuration; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Interfaces; using Microsoft.Azure.Search; using Microsoft.Azure.Search.Models; -namespace PlanDirectory.Infrastructure +namespace Hub.Services.PlanDirectory { public class SearchProvider : ISearchProvider { diff --git a/Infrastructure_PD/Infrastructure/TagGenerator.cs b/Hub/Services/PlanDirectory/TagGenerator.cs similarity index 84% rename from Infrastructure_PD/Infrastructure/TagGenerator.cs rename to Hub/Services/PlanDirectory/TagGenerator.cs index 3a98a916ea..c8bb4c9fc3 100644 --- a/Infrastructure_PD/Infrastructure/TagGenerator.cs +++ b/Hub/Services/PlanDirectory/TagGenerator.cs @@ -6,13 +6,20 @@ using Fr8.Infrastructure.Data.Manifests; using Fr8.Infrastructure.Interfaces; using Fr8.Infrastructure.Utilities.Configuration; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Interfaces; using StructureMap; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class TagGenerator : ITagGenerator { + private readonly IPlanNode _activity; + + public TagGenerator(IPlanNode activity) + { + _activity = activity; + } + /// /// The result of this method is a a list of ActivityTemplateTag and WebServiceTemplateTag classes /// For a plan, that consists of activity named "A" of a webservice "Y" @@ -30,20 +37,21 @@ public async Task GetTags(PlanTemplateCM planTemplateCM, str var result = new TemplateTagStorage(); //requesting all activity templates - var hmacService = ObjectFactory.GetInstance(); - var client = ObjectFactory.GetInstance(); - - var uri = new Uri(CloudConfigurationManager.GetSetting("HubApiUrl") + "/api/v1/activitytemplates"); - var headers = await hmacService.GenerateHMACHeader( - uri, - "PlanDirectory", - CloudConfigurationManager.GetSetting("PlanDirectorySecret"), - fr8AccountId, - null - ); - - var activityCategories = await client.GetAsync>( - uri, headers: headers); + //var hmacService = ObjectFactory.GetInstance(); + //var client = ObjectFactory.GetInstance(); + + //var uri = new Uri(CloudConfigurationManager.GetSetting("HubApiUrl") + "/activitytemplates"); + //var headers = await hmacService.GenerateHMACHeader( + // uri, + // "PlanDirectory", + // CloudConfigurationManager.GetSetting("PlanDirectorySecret"), + // fr8AccountId, + // null + //); + + var activityCategories = _activity.GetAvailableActivityGroups(); + // await client.GetAsync>( + //uri, headers: headers); var activityDict = activityCategories .SelectMany(a => a.Activities) diff --git a/Infrastructure_PD/Infrastructure/TemplateGenerator.cs b/Hub/Services/PlanDirectory/TemplateGenerator.cs similarity index 95% rename from Infrastructure_PD/Infrastructure/TemplateGenerator.cs rename to Hub/Services/PlanDirectory/TemplateGenerator.cs index 129bc33a00..0d8bff73e1 100644 --- a/Infrastructure_PD/Infrastructure/TemplateGenerator.cs +++ b/Hub/Services/PlanDirectory/TemplateGenerator.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.IO; using System.Threading.Tasks; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Interfaces; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class TemplateGenerator : ITemplateGenerator { diff --git a/Infrastructure_PD/Infrastructure/TemplateTag.cs b/Hub/Services/PlanDirectory/TemplateTag.cs similarity index 74% rename from Infrastructure_PD/Infrastructure/TemplateTag.cs rename to Hub/Services/PlanDirectory/TemplateTag.cs index b9d2ff3421..433f5779c8 100644 --- a/Infrastructure_PD/Infrastructure/TemplateTag.cs +++ b/Hub/Services/PlanDirectory/TemplateTag.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public abstract class TemplateTag { diff --git a/Infrastructure_PD/Infrastructure/TemplateTagStorage.cs b/Hub/Services/PlanDirectory/TemplateTagStorage.cs similarity index 90% rename from Infrastructure_PD/Infrastructure/TemplateTagStorage.cs rename to Hub/Services/PlanDirectory/TemplateTagStorage.cs index 74804e3376..1a424aeeef 100644 --- a/Infrastructure_PD/Infrastructure/TemplateTagStorage.cs +++ b/Hub/Services/PlanDirectory/TemplateTagStorage.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class TemplateTagStorage { diff --git a/Infrastructure_PD/Infrastructure/WebServiceTemplateTag.cs b/Hub/Services/PlanDirectory/WebServiceTemplateTag.cs similarity index 90% rename from Infrastructure_PD/Infrastructure/WebServiceTemplateTag.cs rename to Hub/Services/PlanDirectory/WebServiceTemplateTag.cs index 9fa4b202ca..f7a40d325e 100644 --- a/Infrastructure_PD/Infrastructure/WebServiceTemplateTag.cs +++ b/Hub/Services/PlanDirectory/WebServiceTemplateTag.cs @@ -3,9 +3,8 @@ using System.Linq; using Fr8.Infrastructure.Data.DataTransferObjects; using Newtonsoft.Json; -using PlanDirectory.Infrastructure; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class WebServiceTemplateTag : TemplateTag { diff --git a/Infrastructure_PD/Infrastructure/WebservicesPageGenerator.cs b/Hub/Services/PlanDirectory/WebservicesPageGenerator.cs similarity index 94% rename from Infrastructure_PD/Infrastructure/WebservicesPageGenerator.cs rename to Hub/Services/PlanDirectory/WebservicesPageGenerator.cs index cd13ad2339..dbba1a20eb 100644 --- a/Infrastructure_PD/Infrastructure/WebservicesPageGenerator.cs +++ b/Hub/Services/PlanDirectory/WebservicesPageGenerator.cs @@ -7,10 +7,9 @@ using Fr8.Infrastructure.Data.Manifests; using Fr8.Infrastructure.Utilities.Configuration; using Hub.Interfaces; -using HubWeb.CategoryPages; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Resources; -namespace HubWeb.Infrastructure_PD.Infrastructure +namespace Hub.Services.PlanDirectory { public class WebservicesPageGenerator : IWebservicesPageGenerator { @@ -66,7 +65,7 @@ public async Task Generate(PlanTemplateCM planTemplate, string fr8AccountId) publishPlanTemplateDTO.Name, publishPlanTemplateDTO.Description ?? publishPlanTemplateDTO.Name, CloudConfigurationManager.GetSetting("HubApiUrl").Replace("/api/v1/", "") - + "/dashboard/plans/" + publishPlanTemplateDTO.ParentPlanId + "/builder?viewMode=plan")); + + "dashboard/plans/" + publishPlanTemplateDTO.ParentPlanId + "/builder?viewMode=plan")); } await _templateGenerator.Generate(new PlanCategoryTemplate(), pageName, new Dictionary { diff --git a/Hub/Services/PlanDirectoryService.cs b/Hub/Services/PlanDirectoryService.cs index b4c179c18c..bb6d2bfb59 100644 --- a/Hub/Services/PlanDirectoryService.cs +++ b/Hub/Services/PlanDirectoryService.cs @@ -28,6 +28,10 @@ public class PlanDirectoryService : IPlanDirectoryService private readonly IPlan _planService; private readonly IActivityTemplate _activityTemplate; + private readonly IPlanTemplate _planTemplate; + private readonly ISearchProvider _searchProvider; + private readonly IWebservicesPageGenerator _webservicesPageGenerator; + public PlanDirectoryService(IHMACService hmac, @@ -35,7 +39,10 @@ public PlanDirectoryService(IHMACService hmac, IPusherNotifier pusherNotifier, IUnitOfWorkFactory unitOfWorkFactory, IPlan planService, - IActivityTemplate activityTemplate) + IActivityTemplate activityTemplate, + IPlanTemplate planTemplate, + ISearchProvider searchProvider, + IWebservicesPageGenerator webservicesPageGenerator) { _hmacService = hmac; _client = client; @@ -43,6 +50,10 @@ public PlanDirectoryService(IHMACService hmac, _unitOfWorkFactory = unitOfWorkFactory; _planService = planService; _activityTemplate = activityTemplate; + + _planTemplate = planTemplate; + _searchProvider = searchProvider; + _webservicesPageGenerator = webservicesPageGenerator; } public async Task GetToken(string UserId) @@ -96,27 +107,26 @@ public async Task Share(Guid planId, string userId) PlanContents = planDto }; - - //var planTemplateCM = await _planTemplate.CreateOrUpdate(userId, dto); - //await _searchProvider.CreateOrUpdate(planTemplateCM); - //await _webservicesPageGenerator.Generate(planTemplateCM, userId); + var planTemplateCM = await _planTemplate.CreateOrUpdate(userId, dto); + await _searchProvider.CreateOrUpdate(planTemplateCM); + await _webservicesPageGenerator.Generate(planTemplateCM, userId); // @tony.yakovets: for now i left this request to itself because classes above to tight coupled to PlanDirectory project // even if it is a hub - var uri = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/api/v1/plan_templates/"); - var headers = await _hmacService.GenerateHMACHeader( - uri, - "PlanDirectory", - CloudConfigurationManager.GetSetting("PlanDirectorySecret"), - userId, - dto - ); + //var uri = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/api/v1/plan_templates/"); + //var headers = await _hmacService.GenerateHMACHeader( + // uri, + // "PlanDirectory", + // CloudConfigurationManager.GetSetting("PlanDirectorySecret"), + // userId, + // dto + //); - await _client.PostAsync(uri, dto, headers: headers); + //await _client.PostAsync(uri, dto, headers: headers); // Notify user with directing him to PlanDirectory with related search query - var url = CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/PlanDirectory#?planSearch=" + HttpUtility.UrlEncode(dto.Name); + var url = CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/plan_directory#?planSearch=" + HttpUtility.UrlEncode(dto.Name); _pusherNotifier.NotifyUser(new NotificationMessageDTO { NotificationType = NotificationType.GenericSuccess, @@ -126,17 +136,35 @@ public async Task Share(Guid planId, string userId) }, userId); } - public async Task Unpublish(Guid planId, string userId) + public async Task Unpublish(Guid planId, string userId, bool privileged) { - var uri = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/api/v1/plan_templates/?id=" + planId); - var headers = await _hmacService.GenerateHMACHeader( - uri, - "PlanDirectory", - CloudConfigurationManager.GetSetting("PlanDirectorySecret"), - userId - ); + //TODO: add security check with new security model + //var identity = User.Identity as ClaimsIdentity; + //var privileged = identity.HasClaim(ClaimsIdentity.DefaultRoleClaimType, "Admin"); + //var fr8AccountId = identity.GetUserId(); + + var planTemplateCM = await _planTemplate.Get(userId, planId); + + if (planTemplateCM != null) + { + if (planTemplateCM.OwnerId != userId && !privileged) + { + throw new UnauthorizedAccessException(); // Unauthorized(); + } + await _planTemplate.Remove(userId, planId); + await _searchProvider.Remove(planId); + } + + + //var uri = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl") + "/api/v1/plan_templates/?id=" + planId); + //var headers = await _hmacService.GenerateHMACHeader( + // uri, + // "PlanDirectory", + // CloudConfigurationManager.GetSetting("PlanDirectorySecret"), + // userId + //); - await _client.DeleteAsync(uri, headers: headers); + //await _client.DeleteAsync(uri, headers: headers); // Notify user that plan successfully deleted _pusherNotifier.NotifyUser(new NotificationMessageDTO diff --git a/Hub/Services/PlanNode.cs b/Hub/Services/PlanNode.cs index afcf68c19f..69a891cc68 100644 --- a/Hub/Services/PlanNode.cs +++ b/Hub/Services/PlanNode.cs @@ -14,6 +14,7 @@ using Hub.Interfaces; using Hub.Managers; + namespace Hub.Services { public class PlanNode : IPlanNode diff --git a/Infrastructure_PD/Infrastructure/PlanDirectoryBootstrapper.cs b/Hub/StructureMap/PlanDirectoryBootstrapper.cs similarity index 58% rename from Infrastructure_PD/Infrastructure/PlanDirectoryBootstrapper.cs rename to Hub/StructureMap/PlanDirectoryBootstrapper.cs index 670bffc6eb..5de65eff8f 100644 --- a/Infrastructure_PD/Infrastructure/PlanDirectoryBootstrapper.cs +++ b/Hub/StructureMap/PlanDirectoryBootstrapper.cs @@ -7,8 +7,7 @@ using Fr8.Infrastructure.Utilities.Configuration; using Hub.Interfaces; using Hub.Services; -using HubWeb.Infrastructure_PD.Infrastructure; -using HubWeb.Infrastructure_PD.Interfaces; +using Hub.Services.PlanDirectory; using StructureMap; using StructureMap.Configuration.DSL; @@ -21,27 +20,11 @@ public class LiveMode : Registry public LiveMode() { For().Use().Singleton(); - //For().Use().Singleton(); - For().Use().Singleton(); - For().Use(); - For().Use().Singleton(); - For().Use().Singleton(); For().Use().Singleton(); - //For().Use( - // x => new PlanDirectoryHubCommunicatorFactory( - // ObjectFactory.GetInstance(), - // CloudConfigurationManager.GetSetting("HubApiUrl"), - // CloudConfigurationManager.GetSetting("PlanDirectorySecret") - // ) - //); + var serverPath = GetServerPath(); - //now it is hub - var protocol = CloudConfigurationManager.GetSetting("ServerProtocol"); - var server = CloudConfigurationManager.GetSetting("ServerDomainName"); - var port = CloudConfigurationManager.GetSetting("ServerPort"); - var planDirectoryUrl = new Uri(protocol + server + port); - //var planDirectoryUrl = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl")); + var planDirectoryUrl = new Uri(CloudConfigurationManager.GetSetting("PlanDirectoryUrl")); ConfigureManifestPageGenerator(planDirectoryUrl, serverPath); ConfigurePlanPageGenerator(planDirectoryUrl, serverPath); @@ -49,13 +32,13 @@ public LiveMode() private void ConfigurePlanPageGenerator(Uri planDirectoryUrl, string serverPath) { - var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}categorypages"), $"{serverPath}/categorypages"); + var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}/categorypages"), $"{serverPath}/categorypages"); For().Use().Singleton().Ctor().Is(templateGenerator); } private void ConfigureManifestPageGenerator(Uri planDirectoryUrl, string serverPath) { - var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}manifestpages"), $"{serverPath}/manifestpages"); + var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}/manifestpages"), $"{serverPath}/manifestpages"); For().Use().Singleton().Ctor().Is(templateGenerator); } diff --git a/Hub/StructureMap/StructureMapBootStrapper.cs b/Hub/StructureMap/StructureMapBootStrapper.cs index 46b631f285..b458d51cf2 100644 --- a/Hub/StructureMap/StructureMapBootStrapper.cs +++ b/Hub/StructureMap/StructureMapBootStrapper.cs @@ -34,6 +34,7 @@ using Fr8.Infrastructure.Interfaces; using Fr8.Infrastructure.Utilities; using Hub.Security.ObjectDecorators; +using Hub.Services.PlanDirectory; using Hub.Services.Timers; namespace Hub.StructureMap @@ -126,6 +127,15 @@ public LiveMode() For().Use(); For().Use().Singleton(); For().Use().Singleton(); + + + //PD services + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); + //For().Use().Singleton(); + For().Use().Singleton(); } @@ -199,6 +209,19 @@ public TestMode() For().Use().Singleton(); For().Use(); For().Use().Singleton(); + + //PD bootstrap + //tony.yakovets: will it work? or some tests check generated templates? + var templateGenerator = new Mock().Object; + For().Use().Singleton().Ctor().Is(templateGenerator); + For().Use().Singleton().Ctor().Is(templateGenerator); + + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); + For().Use().Singleton(); } } diff --git a/Hub/packages.config b/Hub/packages.config index 42f3f7bac6..02f33627fe 100644 --- a/Hub/packages.config +++ b/Hub/packages.config @@ -29,6 +29,7 @@ + @@ -38,6 +39,9 @@ + + + diff --git a/HubWeb.csproj b/HubWeb.csproj index d79bb33d93..9bbd8b04a3 100644 --- a/HubWeb.csproj +++ b/HubWeb.csproj @@ -393,11 +393,6 @@ - - PlanCategoryTemplate.tt - True - True - @@ -512,43 +507,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - ManifestDescriptionTemplate.tt - True - True - @@ -573,14 +538,6 @@ - - - - - TextTemplatingFilePreprocessor - PlanCategoryTemplate.cs - - @@ -780,10 +737,6 @@ - - TextTemplatingFilePreprocessor - ManifestDescriptionTemplate.cs - @@ -4450,10 +4403,12 @@ + + @@ -4564,8 +4519,7 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + @@ -4652,5 +4606,5 @@ - + \ No newline at end of file diff --git a/Infrastructure_PD/Infrastructure/HubAuthenticationPDHeaderSignature.cs b/Infrastructure_PD/Infrastructure/HubAuthenticationPDHeaderSignature.cs index a4eacaaf5b..244e55de38 100644 --- a/Infrastructure_PD/Infrastructure/HubAuthenticationPDHeaderSignature.cs +++ b/Infrastructure_PD/Infrastructure/HubAuthenticationPDHeaderSignature.cs @@ -1,19 +1,19 @@ -using System.Net.Http; -using Fr8.Infrastructure.Interfaces; +//using System.Net.Http; +//using Fr8.Infrastructure.Interfaces; -namespace PlanDirectory.Infrastructure -{ - public class HubAuthenticationPDHeaderSignature : IRequestSignature - { - private readonly string _fr8Token; - public HubAuthenticationPDHeaderSignature(string token, string userId) - { - _fr8Token = $"key={token}" + (string.IsNullOrEmpty(userId) ? "" : $", user={userId}"); - } +//namespace PlanDirectory.Infrastructure +//{ +// public class HubAuthenticationPDHeaderSignature : IRequestSignature +// { +// private readonly string _fr8Token; +// public HubAuthenticationPDHeaderSignature(string token, string userId) +// { +// _fr8Token = $"key={token}" + (string.IsNullOrEmpty(userId) ? "" : $", user={userId}"); +// } - public void SignRequest(HttpRequestMessage request) - { - request.Headers.Add(System.Net.HttpRequestHeader.Authorization.ToString(), $"FR8-PD {_fr8Token}"); - } - } -} \ No newline at end of file +// public void SignRequest(HttpRequestMessage request) +// { +// request.Headers.Add(System.Net.HttpRequestHeader.Authorization.ToString(), $"FR8-PD {_fr8Token}"); +// } +// } +//} \ No newline at end of file diff --git a/Infrastructure_PD/Infrastructure/PlanDirectoryAuthorizeAttribute.cs b/Infrastructure_PD/Infrastructure/PlanDirectoryAuthorizeAttribute.cs index f8c4768b53..6dc400efa2 100644 --- a/Infrastructure_PD/Infrastructure/PlanDirectoryAuthorizeAttribute.cs +++ b/Infrastructure_PD/Infrastructure/PlanDirectoryAuthorizeAttribute.cs @@ -1,18 +1,18 @@ -using System.Web; -using System.Web.Mvc; -using Hub.Managers; +//using System.Web; +//using System.Web.Mvc; +//using Hub.Managers; -namespace PlanDirectory.Infrastructure -{ - public class PlanDirectoryAuthorizeAttribute : DockyardAuthorizeAttribute - { - public PlanDirectoryAuthorizeAttribute(params string[] roles) : base(roles) - { - } +//namespace PlanDirectory.Infrastructure +//{ +// public class PlanDirectoryAuthorizeAttribute : DockyardAuthorizeAttribute +// { +// public PlanDirectoryAuthorizeAttribute(params string[] roles) : base(roles) +// { +// } - protected override string BuildRedirectUrl(AuthorizationContext context) - { - return VirtualPathUtility.ToAbsolute("~/Reauthenticate"); - } - } -} \ No newline at end of file +// protected override string BuildRedirectUrl(AuthorizationContext context) +// { +// return VirtualPathUtility.ToAbsolute("~/Reauthenticate"); +// } +// } +//} \ No newline at end of file diff --git a/Infrastructure_PD/Infrastructure/PlanDirectoryHMACAuthenticateAttribute.cs b/Infrastructure_PD/Infrastructure/PlanDirectoryHMACAuthenticateAttribute.cs index 22c0905366..b184e6f894 100644 --- a/Infrastructure_PD/Infrastructure/PlanDirectoryHMACAuthenticateAttribute.cs +++ b/Infrastructure_PD/Infrastructure/PlanDirectoryHMACAuthenticateAttribute.cs @@ -1,51 +1,51 @@ -using System.Configuration; -using System.Security.Principal; -using System.Threading; -using System.Threading.Tasks; -using System.Web; -using System.Web.Http.Filters; -using Fr8.Infrastructure.Security; -using Fr8.Infrastructure.Utilities.Configuration; -using Hub.Infrastructure; - -namespace PlanDirectory.Infrastructure -{ - public class PlanDirectoryHMACAuthenticateAttribute : fr8HMACAuthenticateAttribute - { - private const string TerminalId = "PlanDirectory"; - - - public PlanDirectoryHMACAuthenticateAttribute() - { - } - - protected override void Success(HttpAuthenticationContext context, string terminalId, string userId) - { - var identity = new Fr8Identity("terminal-" + terminalId, userId); - var principle = new GenericPrincipal(identity, new string[] { }); - - Thread.CurrentPrincipal = principle; - context.Principal = principle; - - if (HttpContext.Current != null) - { - HttpContext.Current.User = principle; - } - } - - protected override Task GetTerminalSecret(string terminalId) - { - if (terminalId == TerminalId) - { - return Task.FromResult(CloudConfigurationManager.GetSetting("PlanDirectorySecret")); - } - - return Task.FromResult(null); - } - - protected override Task CheckPermission(string terminalId, string userId) - { - return Task.FromResult(true); - } - } -} \ No newline at end of file +//using System.Configuration; +//using System.Security.Principal; +//using System.Threading; +//using System.Threading.Tasks; +//using System.Web; +//using System.Web.Http.Filters; +//using Fr8.Infrastructure.Security; +//using Fr8.Infrastructure.Utilities.Configuration; +//using Hub.Infrastructure; + +//namespace PlanDirectory.Infrastructure +//{ +// public class PlanDirectoryHMACAuthenticateAttribute : fr8HMACAuthenticateAttribute +// { +// private const string TerminalId = "PlanDirectory"; + + +// public PlanDirectoryHMACAuthenticateAttribute() +// { +// } + +// protected override void Success(HttpAuthenticationContext context, string terminalId, string userId) +// { +// var identity = new Fr8Identity("terminal-" + terminalId, userId); +// var principle = new GenericPrincipal(identity, new string[] { }); + +// Thread.CurrentPrincipal = principle; +// context.Principal = principle; + +// if (HttpContext.Current != null) +// { +// HttpContext.Current.User = principle; +// } +// } + +// protected override Task GetTerminalSecret(string terminalId) +// { +// if (terminalId == TerminalId) +// { +// return Task.FromResult(CloudConfigurationManager.GetSetting("PlanDirectorySecret")); +// } + +// return Task.FromResult(null); +// } + +// protected override Task CheckPermission(string terminalId, string userId) +// { +// return Task.FromResult(true); +// } +// } +//} \ No newline at end of file diff --git a/Scripts/app/controllers/PlanDetailsController.ts b/Scripts/app/controllers/PlanDetailsController.ts index d8e741ea95..f13052f037 100644 --- a/Scripts/app/controllers/PlanDetailsController.ts +++ b/Scripts/app/controllers/PlanDetailsController.ts @@ -77,7 +77,9 @@ module dockyard.controllers { $scope.unpublishPlan = () => { - if ($scope.current.plan.visibility.public) { + debugger; + //tony.yakovets: temporary crutch + if (!$scope.current.plan.visibility.hidden) { PlanService.unpublish($stateParams.id) .then(() => { console.log('unpublishPlan: Success'); diff --git a/Services/PlanDirectory/Infrastructure/ManifestPageGenerator.cs b/Services/PlanDirectory/Infrastructure/ManifestPageGenerator.cs index ce1cae3503..8c83c242c0 100644 --- a/Services/PlanDirectory/Infrastructure/ManifestPageGenerator.cs +++ b/Services/PlanDirectory/Infrastructure/ManifestPageGenerator.cs @@ -5,9 +5,9 @@ using Data.Entities; using Data.Interfaces; using Fr8.Infrastructure.Data.Manifests; +using Hub.Enums; +using Hub.Exceptions; using Hub.Interfaces; -using PlanDirectory.Exceptions; -using PlanDirectory.Interfaces; using PlanDirectory.ManifestPages; namespace PlanDirectory.Infrastructure diff --git a/Services/PlanDirectory/Infrastructure/PlanDirectoryBootstrapper.cs b/Services/PlanDirectory/Infrastructure/PlanDirectoryBootstrapper.cs index 13d883974a..2e0ded04db 100644 --- a/Services/PlanDirectory/Infrastructure/PlanDirectoryBootstrapper.cs +++ b/Services/PlanDirectory/Infrastructure/PlanDirectoryBootstrapper.cs @@ -7,7 +7,6 @@ using Fr8.Infrastructure.Utilities.Configuration; using Hub.Interfaces; using Hub.Services; -using PlanDirectory.Interfaces; using StructureMap; using StructureMap.Configuration.DSL; @@ -20,13 +19,13 @@ public class LiveMode : Registry public LiveMode() { For().Use().Singleton(); - For().Use().Singleton(); + For().Use().Singleton(); For().Use().Singleton(); For().Use(); - For().Use().Singleton(); + For().Use().Singleton(); For().Use().Singleton(); For().Use().Singleton(); - For().Use( + For().Use( x => new PlanDirectoryHubCommunicatorFactory( ObjectFactory.GetInstance(), CloudConfigurationManager.GetSetting("HubApiBaseUrl"), @@ -42,13 +41,13 @@ public LiveMode() private void ConfigurePlanPageGenerator(Uri planDirectoryUrl, string serverPath) { var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}category"), $"{serverPath}/category"); - For().Use().Singleton().Ctor().Is(templateGenerator); + For().Use().Singleton().Ctor().Is(templateGenerator); } private void ConfigureManifestPageGenerator(Uri planDirectoryUrl, string serverPath) { var templateGenerator = new TemplateGenerator(new Uri($"{planDirectoryUrl}manifestpages"), $"{serverPath}/manifestpages"); - For().Use().Singleton().Ctor().Is(templateGenerator); + For().Use().Singleton().Ctor().Is(templateGenerator); } private static string GetServerPath() diff --git a/Services/PlanDirectory/Infrastructure/PlanTemplate.Impl.cs b/Services/PlanDirectory/Infrastructure/PlanTemplate.Impl.cs index e63d6986bd..fe86552cbb 100644 --- a/Services/PlanDirectory/Infrastructure/PlanTemplate.Impl.cs +++ b/Services/PlanDirectory/Infrastructure/PlanTemplate.Impl.cs @@ -10,7 +10,8 @@ using Data.States; using Fr8.Infrastructure.Data.DataTransferObjects; using Fr8.Infrastructure.Data.Manifests; -using PlanDirectory.Interfaces; +using Hub.Interfaces; + namespace PlanDirectory.Infrastructure { diff --git a/Services/PlanDirectory/Infrastructure/SearchProvider.Impl.cs b/Services/PlanDirectory/Infrastructure/SearchProvider.Impl.cs index fbc68ca1d9..335891b393 100644 --- a/Services/PlanDirectory/Infrastructure/SearchProvider.Impl.cs +++ b/Services/PlanDirectory/Infrastructure/SearchProvider.Impl.cs @@ -2,11 +2,12 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Fr8.Infrastructure.Data.DataTransferObjects.PlanDirectory; using Fr8.Infrastructure.Data.Manifests; using Fr8.Infrastructure.Utilities.Configuration; +using Hub.Interfaces; using Microsoft.Azure.Search; using Microsoft.Azure.Search.Models; -using PlanDirectory.Interfaces; namespace PlanDirectory.Infrastructure { diff --git a/Services/PlanDirectory/Infrastructure/WebservicesPageGenerator.cs b/Services/PlanDirectory/Infrastructure/WebservicesPageGenerator.cs index da73a7305f..d38cdce190 100644 --- a/Services/PlanDirectory/Infrastructure/WebservicesPageGenerator.cs +++ b/Services/PlanDirectory/Infrastructure/WebservicesPageGenerator.cs @@ -7,7 +7,6 @@ using Fr8.Infrastructure.Data.DataTransferObjects; using Fr8.Infrastructure.Data.Manifests; using Fr8.Infrastructure.Utilities.Configuration; -using Hub.Interfaces; using PlanDirectory.CategoryPages; using PlanDirectory.Interfaces; @@ -19,12 +18,12 @@ public class WebservicesPageGenerator : IWebservicesPageGenerator private const string PageExtension = ".html"; private const string PageType = "WebService"; - private readonly IPageDefinition _pageDefinitionService; + private readonly Hub.Interfaces.IPageDefinition _pageDefinitionService; private readonly IPlanTemplate _planTemplateService; private readonly ITemplateGenerator _templateGenerator; private readonly ITagGenerator _tagGenerator; - public WebservicesPageGenerator(IPageDefinition pageDefinitionService, IPlanTemplate planTemplateService, ITemplateGenerator templateGenerator, ITagGenerator tagGenerator) + public WebservicesPageGenerator(Hub.Interfaces.IPageDefinition pageDefinitionService, IPlanTemplate planTemplateService, ITemplateGenerator templateGenerator, ITagGenerator tagGenerator) { _pageDefinitionService = pageDefinitionService; _planTemplateService = planTemplateService; diff --git a/Services/PlanDirectory/PlanDirectory.csproj b/Services/PlanDirectory/PlanDirectory.csproj index d620fdf847..d2b881e5ac 100644 --- a/Services/PlanDirectory/PlanDirectory.csproj +++ b/Services/PlanDirectory/PlanDirectory.csproj @@ -514,7 +514,7 @@ - + @@ -530,7 +530,7 @@ - + - - + + + + + - + + + diff --git a/Tests/HealthMonitor.HubLauncher/HealthMonitor.HubLauncher.csproj b/Tests/HealthMonitor.HubLauncher/HealthMonitor.HubLauncher.csproj index 4e39557d77..98ee4c657f 100644 --- a/Tests/HealthMonitor.HubLauncher/HealthMonitor.HubLauncher.csproj +++ b/Tests/HealthMonitor.HubLauncher/HealthMonitor.HubLauncher.csproj @@ -186,7 +186,9 @@ - + + Designer + Designer PreserveNewest @@ -204,6 +206,9 @@ PreserveNewest + + Always + @@ -224,12 +229,12 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + + + + + + + %level - %message%newline + 36m + 33m + 31m + + + + + + + \ No newline at end of file diff --git a/Tests/HealthMonitor.HubLauncher/packages.config b/Tests/HealthMonitor.HubLauncher/packages.config index 7c17c09669..a36be4bde0 100644 --- a/Tests/HealthMonitor.HubLauncher/packages.config +++ b/Tests/HealthMonitor.HubLauncher/packages.config @@ -3,7 +3,7 @@ - + diff --git a/Tests/HealthMonitor/App.Demo.config b/Tests/HealthMonitor/App.Demo.config index 088862dd7e..417545e6bc 100644 --- a/Tests/HealthMonitor/App.Demo.config +++ b/Tests/HealthMonitor/App.Demo.config @@ -9,7 +9,8 @@ - + + diff --git a/Tests/HealthMonitor/App.Dev.config b/Tests/HealthMonitor/App.Dev.config index 8cdbb9facd..a9951a9e73 100644 --- a/Tests/HealthMonitor/App.Dev.config +++ b/Tests/HealthMonitor/App.Dev.config @@ -8,7 +8,12 @@ - + + + + + + diff --git a/Tests/HealthMonitor/App.Release.config b/Tests/HealthMonitor/App.Release.config index d750b4097c..b06053c6fd 100644 --- a/Tests/HealthMonitor/App.Release.config +++ b/Tests/HealthMonitor/App.Release.config @@ -7,7 +7,10 @@ - + + + + diff --git a/Tests/HealthMonitor/App.config b/Tests/HealthMonitor/App.config index dc9f9ea3b4..80664065f2 100644 --- a/Tests/HealthMonitor/App.config +++ b/Tests/HealthMonitor/App.config @@ -24,7 +24,8 @@ - + + @@ -32,25 +33,6 @@ - - @@ -59,9 +41,7 @@ - - - + @@ -233,7 +213,7 @@ - + diff --git a/Tests/HealthMonitor/HealthMonitor.csproj b/Tests/HealthMonitor/HealthMonitor.csproj index 81524e2c5d..4254319001 100644 --- a/Tests/HealthMonitor/HealthMonitor.csproj +++ b/Tests/HealthMonitor/HealthMonitor.csproj @@ -552,7 +552,7 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + @@ -566,7 +566,7 @@ - +
-

Plan Directory

@@ -76,7 +75,6 @@
-

diff --git a/Web.config b/Web.config index 39b2cd4193..afa769121a 100644 --- a/Web.config +++ b/Web.config @@ -4,7 +4,6 @@ http://go.microsoft.com/fwlink/?LinkId=301880 --> - diff --git a/packages.config b/packages.config index 1f0691583c..fc8d757581 100644 --- a/packages.config +++ b/packages.config @@ -12,7 +12,7 @@ - + diff --git a/terminalAsana/packages.config b/terminalAsana/packages.config index 0618a742b3..0a8a0673dc 100644 --- a/terminalAsana/packages.config +++ b/terminalAsana/packages.config @@ -4,7 +4,7 @@ - + diff --git a/terminalAsana/terminalAsana.csproj b/terminalAsana/terminalAsana.csproj index 8a36a6122a..1aac7d5c4c 100644 --- a/terminalAsana/terminalAsana.csproj +++ b/terminalAsana/terminalAsana.csproj @@ -321,7 +321,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + @@ -360,7 +360,7 @@ - +