public override HttpResponseMessage Post(ProjectHook value) { if (!IsInProject(value.ProjectId)) { throw new HttpResponseException(BadRequestErrorResponseMessage()); } Project project = _projectRepository.GetByIdCached(value.ProjectId); if (!_billingManager.CanAddIntegration(project)) { throw new HttpResponseException(PlanLimitReached("Please upgrade your plan to add integrations.")); } return(base.Post(value)); }
protected override PermissionResult CanAdd(WebHook value) { if (String.IsNullOrEmpty(value.ProjectId) || String.IsNullOrEmpty(value.Url) || value.EventTypes.Length == 0) { return(PermissionResult.Deny); } Project project = _projectRepository.GetById(value.ProjectId, true); if (!IsInProject(project)) { return(PermissionResult.Deny); } if (!_billingManager.CanAddIntegration(project)) { return(PermissionResult.DenyWithPlanLimitReached("Please upgrade your plan to add integrations.")); } return(base.CanAdd(value)); }