예제 #1
0
        public async Task <ApplicationMenu> GetAsync(string name)
        {
            var menu = new ApplicationMenu(name);

            using (var scope = _serviceProvider.CreateScope())
            {
                var context = new MenuConfigurationContext(menu, scope.ServiceProvider);

                foreach (var contributor in _options.MenuContributors)
                {
                    await contributor.ConfigureMenuAsync(context);
                }
            }

            return(menu);
        }
예제 #2
0
파일: MenuManager.cs 프로젝트: zxbe/abp
        public async Task <ApplicationMenu> GetAsync(string name)
        {
            var menu = new ApplicationMenu(name);

            using (var scope = ServiceScopeFactory.CreateScope())
            {
                var context = new MenuConfigurationContext(menu, scope.ServiceProvider);

                foreach (var contributor in Options.MenuContributors)
                {
                    await contributor.ConfigureMenuAsync(context).ConfigureAwait(false);
                }
            }

            NormalizeMenu(menu);

            return(menu);
        }
예제 #3
0
        public async Task <ApplicationMenu> GetAsync(string name)
        {
            var menu = new ApplicationMenu(name);

            using (var scope = ServiceScopeFactory.CreateScope())
            {
                RequirePermissionsSimpleBatchStateChecker <ApplicationMenuItem> .Instance.ClearCheckModels();

                var context = new MenuConfigurationContext(menu, scope.ServiceProvider);

                foreach (var contributor in Options.MenuContributors)
                {
                    await contributor.ConfigureMenuAsync(context);
                }

                await CheckPermissionsAsync(scope.ServiceProvider, menu);
            }

            NormalizeMenu(menu);

            return(menu);
        }
예제 #4
0
파일: MenuManager.cs 프로젝트: Braiding/abp
        protected virtual async Task <ApplicationMenu> GetInternalAsync(string name)
        {
            var menu = new ApplicationMenu(name);

            using (var scope = ServiceScopeFactory.CreateScope())
            {
                using (RequirePermissionsSimpleBatchStateChecker <ApplicationMenuItem> .Use(new RequirePermissionsSimpleBatchStateChecker <ApplicationMenuItem>()))
                {
                    var context = new MenuConfigurationContext(menu, scope.ServiceProvider);

                    foreach (var contributor in Options.MenuContributors)
                    {
                        await contributor.ConfigureMenuAsync(context);
                    }

                    await CheckPermissionsAsync(scope.ServiceProvider, menu);
                }
            }

            NormalizeMenu(menu);

            return(menu);
        }
예제 #5
0
 public MenuConfigurationContext(ApplicationMenu menu, IServiceProvider serviceProvider)
 {
     Menu            = menu;
     ServiceProvider = serviceProvider;
 }
예제 #6
0
파일: MenuManager.cs 프로젝트: luoxy123/abp
 protected virtual void NormalizeMenu(ApplicationMenu menu)
 {
     //TODO: Should also consider sub menus, recursively, bottom to top!
     menu.Items.RemoveAll(item => item.IsLeaf && item.Url.IsNullOrEmpty());
 }
예제 #7
0
 protected virtual void NormalizeMenu(ApplicationMenu menu)
 {
     menu.Items.RemoveAll(item => item.IsLeaf && item.Url.IsNullOrEmpty());
 }
예제 #8
0
 public MenuConfigurationContext(ApplicationMenu menu, IServiceProvider serviceProvider)
 {
     Menu                 = menu;
     ServiceProvider      = serviceProvider;
     _lazyServiceProvider = ServiceProvider.GetRequiredService <IAbpLazyServiceProvider>();
 }
예제 #9
0
 public static ApplicationMenuItem GetAdministration(this ApplicationMenu applicationMenu)
 {
     return(applicationMenu.GetMenuItem(DefaultMenuNames.Application.Main.Administration));
 }