private static void Create(AuthorizePropertyAttribute attribute, ISpecification holder) { if (attribute != null) { if (attribute.ViewRoles != null || attribute.ViewUsers != null) { FacetUtils.AddFacet(new AuthorizationHideForSessionFacet(attribute.ViewRoles, attribute.ViewUsers, holder)); } if (attribute.EditRoles != null || attribute.EditUsers != null) { FacetUtils.AddFacet(new AuthorizationDisableForSessionFacet(attribute.EditRoles, attribute.EditUsers, holder)); } } }
private static bool Create(AuthorizePropertyAttribute attribute, IFacetHolder holder) { bool added = false; if (attribute != null) { if (attribute.ViewRoles != null || attribute.ViewUsers != null) { var facet = new SecurityHideForSessionFacet(attribute.ViewRoles, attribute.ViewUsers, holder); added = FacetUtils.AddFacet(facet); } if (attribute.EditRoles != null || attribute.EditUsers != null) { var facet = new SecurityDisableForSessionFacet(attribute.EditRoles, attribute.EditUsers, holder); added |= FacetUtils.AddFacet(facet); } } return added; }