Skip to content

Instantly share code, notes, and snippets.

@joshuaflanagan
Created January 21, 2011 20:29
Show Gist options
  • Save joshuaflanagan/790361 to your computer and use it in GitHub Desktop.
Save joshuaflanagan/790361 to your computer and use it in GitHub Desktop.
Only show cases with IsSensitive=false unless the current user has "View Sensitive Cases" permission
using DovetailCRM.Core.Authorization;
using DovetailCRM.Core.Domain.Workflow;
using FubuFastPack.Querying;
using FubuMVC.Core.Security;
namespace DovetailCRM.Core.Web.Query
{
public class SensitiveCaseDataRestriction : IDataRestriction<Case>
{
public void Apply(IDataSourceFilter<Case> filter)
{
if (!PrincipalRoles.IsInRole(DomainActions.ViewSensitiveCases))
{
filter.WhereEqual(x => x.IsSensitive, false);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment