Exemple #1
0
        private IList <MenuTreeDto> FilterByTenancySide(IList <MenuTreeDto> menuTreeDtos, MultiTenancySides multiTenancySides)
        {
            var result = menuTreeDtos.OrderBy(o => o.Order).ToList();

            result.RemoveAll(o => !multiTenancySides.HasFlag(MultiTenancySides.Host) && o.Items.Count == 0 && o.Name.Contains("Host"));
            result.RemoveAll(o => !multiTenancySides.HasFlag(MultiTenancySides.Tenant) && o.Items.Count == 0 && o.Name.Contains("Tenancy"));
            foreach (var item in result.Where(o => o.Items.Count > 0))
            {
                item.Items = FilterByTenancySide(item.Items, multiTenancySides);
            }
            return(result);
        }
 public IReadOnlyList <Permission> GetAllPermissions(MultiTenancySides multiTenancySides)
 {
     return(Permissions.Values
            .Where(p => p.MultiTenancySides.HasFlag(multiTenancySides))
            .Where(p =>
                   p.DependedFeature == null ||
                   (p.MultiTenancySides.HasFlag(MultiTenancySides.Host) && multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                   p.DependedFeature.IsSatisfied(_featureDependencyContext)
                   ).ToImmutableList());
 }
 public IReadOnlyList<Permission> GetAllPermissions(MultiTenancySides multiTenancySides)
 {
     return Permissions.Values
         .Where(p => p.MultiTenancySides.HasFlag(multiTenancySides))
         .Where(p =>
             p.FeatureDependency == null ||
             (p.MultiTenancySides.HasFlag(MultiTenancySides.Host) && multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
             p.FeatureDependency.IsSatisfied(_featureDependencyContext)
         ).ToImmutableList();
 }
 public IReadOnlyList <WinformToolbarGroup> GetAllToolbarGroups(MultiTenancySides multiTenancySides)
 {
     return(ToolbarGroups.Values
            .Where(t => t.MultiTenancySides.HasFlag(multiTenancySides))
            .Where(t =>
                   string.IsNullOrEmpty(t.Permission) ||
                   AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                   (t.MultiTenancySides.HasFlag(MultiTenancySides.Host) &&
                    multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                   (!string.IsNullOrEmpty(t.Permission) && _permissionChecker.IsGranted(t.Permission))
                   ).ToImmutableList());
 }
 public virtual IReadOnlyList <WinformMenu> GetAllMenus(MultiTenancySides multiTenancySides)
 {
     return(Menus.Values
            .Where(m => m.MultiTenancySides.HasFlag(multiTenancySides))
            .Where(m =>
                   string.IsNullOrEmpty(m.Permission) ||
                   AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                   (m.MultiTenancySides.HasFlag(MultiTenancySides.Host) &&
                    multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                   (!string.IsNullOrEmpty(m.Permission) && _permissionChecker.IsGranted(m.Permission))
                   ).ToImmutableList());
 }
        public IList <WinformToolbar> GetToolbarsByGroups(string groupName, MultiTenancySides multiTenancySides)
        {
            var group = GetToolbarGroup(groupName);

            return(group.ToolBars.Where(t => t.MultiTenancySides.HasFlag(multiTenancySides))
                   .Where(t =>
                          string.IsNullOrEmpty(t.Permission) ||
                          AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                          (t.MultiTenancySides.HasFlag(MultiTenancySides.Host) &&
                           multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                          (!string.IsNullOrEmpty(t.Permission) && _permissionChecker.IsGranted(t.Permission))
                          ).ToImmutableList());
        }
 public IReadOnlyList <Permission> GetAllPermissions(MultiTenancySides multiTenancySides)
 {
     using (var featureDependencyContext = _iocManager.ResolveAsDisposable <FeatureDependencyContext>())
     {
         var featureDependencyContextObject = featureDependencyContext.Object;
         return(Permissions.Values
                .Where(p => p.MultiTenancySides.HasFlag(multiTenancySides))
                .Where(p =>
                       p.FeatureDependency == null ||
                       AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                       (p.MultiTenancySides.HasFlag(MultiTenancySides.Host) &&
                        multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                       p.FeatureDependency.IsSatisfied(featureDependencyContextObject)
                       ).ToImmutableList());
     }
 }
 public IReadOnlyList<Permission> GetAllPermissions(MultiTenancySides multiTenancySides)
 {
     using (var featureDependencyContext = _iocManager.ResolveAsDisposable<FeatureDependencyContext>())
     {
         var featureDependencyContextObject = featureDependencyContext.Object;
         return Permissions.Values
             .Where(p => p.MultiTenancySides.HasFlag(multiTenancySides))
             .Where(p =>
                 p.FeatureDependency == null ||
                 AbpSession.MultiTenancySide == MultiTenancySides.Host ||
                 (p.MultiTenancySides.HasFlag(MultiTenancySides.Host) &&
                  multiTenancySides.HasFlag(MultiTenancySides.Host)) ||
                 p.FeatureDependency.IsSatisfied(featureDependencyContextObject)
             ).ToImmutableList();
     }
 }