コード例 #1
0
 private static void Create(AuthorizeActionAttribute attribute, ISpecification holder) {
     if (attribute != null) {
         if (attribute.Roles != null || attribute.Users != null) {
             FacetUtils.AddFacet(new AuthorizationHideForSessionFacet(attribute.Roles, attribute.Users, holder));
             FacetUtils.AddFacet(new AuthorizationDisableForSessionFacet(attribute.Roles, attribute.Users, holder));
         }
     }
 }
        private static bool Create(AuthorizeActionAttribute attribute, IFacetHolder holder) {
            bool added = false;

            if (attribute != null) {
                if (attribute.Roles != null || attribute.Users != null) {
                    IFacet facet = new SecurityHideForSessionFacet(attribute.Roles, attribute.Users, holder);
                    added = FacetUtils.AddFacet(facet);
                    facet = new SecurityDisableForSessionFacet(attribute.Roles, attribute.Users, holder);
                    added |= FacetUtils.AddFacet(facet);
                }
            }

            return added;
        }