public void Authorization(AuthorizationReport report) { var table = addDetail().Text("Authorization").Add<TableTag>(); table.AddClass("details"); table.AddHeaderRow(row => { row.Header("Policy"); row.Header("Vote"); }); report.Details.Each(binding => { table.AddBodyRow(row => { row.Cell(binding.PolicyDescription); row.Cell(binding.Vote); }); }); table.AddFooterRow(footer => { footer.AddClass("authz-decision"); footer.Cell("Decision"); footer.Cell(report.Decision); }); }
public override AuthorizationRight IsAuthorized(IFubuRequest request, IEnumerable <IAuthorizationPolicy> policies) { var decision = base.IsAuthorized(request, policies); if (policies.Any()) { var authorizationReport = new AuthorizationReport(); policies.Each(p => { var rights = p.RightsFor(request); authorizationReport.AddVote(p.ToString(), rights.Name); }); authorizationReport.Decision = decision.Name; _report.AddDetails(authorizationReport); } return(decision); }
public override AuthorizationRight IsAuthorized(IFubuRequest request, IEnumerable<IAuthorizationPolicy> policies) { var decision = base.IsAuthorized(request, policies); if (policies.Any()) { var authorizationReport = new AuthorizationReport(); policies.Each(p => { var rights = p.RightsFor(request); authorizationReport.AddVote(p.ToString(), rights.Name); }); authorizationReport.Decision = decision.Name; _report.AddDetails(authorizationReport); } return decision; }