protected override async Task HandleRequirementAsync(
            AuthorizationHandlerContext context,
            AssignPrereleaseContactsToSpecificReleaseRequirement requirement,
            Release release)
        {
            if (SecurityUtils.HasClaim(context.User, UpdateAllReleases))
            {
                context.Succeed(requirement);
                return;
            }

            var publicationRoles =
                await _userPublicationRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.PublicationId);

            if (ContainPublicationOwnerRole(publicationRoles))
            {
                context.Succeed(requirement);
                return;
            }

            var releaseRoles = await _userReleaseRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.Id);

            if (ContainsEditorOrApproverRole(releaseRoles))
            {
                context.Succeed(requirement);
            }
        }
        protected override async Task HandleRequirementAsync(
            AuthorizationHandlerContext context,
            UpdateSpecificReleaseRequirement requirement,
            Release release)
        {
            var statuses = await _releasePublishingStatusRepository.GetAllByOverallStage(
                release.Id,
                ReleasePublishingStatusOverallStage.Started,
                ReleasePublishingStatusOverallStage.Complete
                );

            if (statuses.Any() || release.Published != null)
            {
                return;
            }

            if (SecurityUtils.HasClaim(context.User, SecurityClaimTypes.UpdateAllReleases))
            {
                context.Succeed(requirement);
                return;
            }

            var publicationRoles =
                await _publicationRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.PublicationId);

            var releaseRoles = await _releaseRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.Id);

            if (release.ApprovalStatus == ReleaseApprovalStatus.Approved
                ? ContainsApproverRole(releaseRoles)
                : ContainPublicationOwnerRole(publicationRoles) || ContainsEditorOrApproverRole(releaseRoles))
            {
                context.Succeed(requirement);
            }
        }
        private async Task HandleApproved(
            AuthorizationHandlerContext context,
            TRequirement requirement,
            Release release)
        {
            if (SecurityUtils.HasClaim(context.User, SecurityClaimTypes.ApproveAllReleases))
            {
                context.Succeed(requirement);
                return;
            }

            var roles = await _userReleaseRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.Id);

            if (ContainsApproverRole(roles))
            {
                context.Succeed(requirement);
            }
        }
        protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context,
                                                             TRequirement requirement,
                                                             Release release)
        {
            var releaseRoles = await _releaseRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.Id);

            if (releaseRoles.Any())
            {
                if (_test == null || _test.Invoke(new ReleaseRolesAuthorizationContext(release, releaseRoles)))
                {
                    context.Succeed(requirement);
                }
            }
        }
        protected override async Task HandleRequirementAsync(
            AuthorizationHandlerContext authContext,
            ViewReleaseStatusHistoryRequirement requirement,
            Release release)
        {
            if (SecurityUtils.HasClaim(authContext.User, SecurityClaimTypes.AccessAllReleases))
            {
                authContext.Succeed(requirement);
                return;
            }

            var publicationRoles = await _publicationRoleRepository
                                   .GetAllRolesByUser(authContext.User.GetUserId(), release.PublicationId);

            var releaseRoles = await _releaseRoleRepository
                               .GetAllRolesByUser(authContext.User.GetUserId(), release.Id);

            if (ContainPublicationOwnerRole(publicationRoles) || ContainsUnrestrictedViewerRole(releaseRoles))
            {
                authContext.Succeed(requirement);
            }
        }
        protected override async Task HandleRequirementAsync(
            AuthorizationHandlerContext context,
            PublishSpecificReleaseRequirement requirement,
            Release release)
        {
            if (release.ApprovalStatus != ReleaseApprovalStatus.Approved)
            {
                return;
            }

            if (SecurityUtils.HasClaim(context.User, PublishAllReleases))
            {
                context.Succeed(requirement);
                return;
            }

            var releaseRoles = await _userReleaseRoleRepository.GetAllRolesByUser(context.User.GetUserId(), release.Id);

            if (ContainsApproverRole(releaseRoles))
            {
                context.Succeed(requirement);
            }
        }