Beispiel #1
0
        private async Task AddGigMenu(MenuConfigurationContext context, IStringLocalizer l)
        {
            var gigsMenu = new ApplicationMenuItem(
                Zero1FiveMenus.Gig.Name,
                l["Menu:Gigs"],
                "",
                icon: ""
                );

            gigsMenu.AddItem(
                new ApplicationMenuItem(
                    Zero1FiveMenus.Gig.List,
                    l["Menu:Gigs"],
                    Zero1FiveMenus.Gig.ListUrl,
                    icon: "fas fa-list"
                    ));

            if (await context.IsGrantedAsync(Zero1FivePermissions.Gigs.Default))
            {
                gigsMenu.AddItem(
                    new ApplicationMenuItem(
                        Zero1FiveMenus.Gig.Manage,
                        l["Menu:ManageGigs"],
                        Zero1FiveMenus.Gig.ManageUrl,
                        icon: "fas fa-list",
                        requiredPermissionName: Zero1FivePermissions.Gigs.Default
                        ));
            }

            context.Menu.Items.Insert(1, gigsMenu);
        }
Beispiel #2
0
        public ApplicationMenuItemList GetMenu()
        {
            var menuList = new ApplicationMenuItemList();
            var t        = "&_&";

            var item = new ApplicationMenuItem("后台管理", t, "#", icon: "", order: 0);

            item.Items.Add(new ApplicationMenuItem("管理员管理", t, "/Manager"));
            item.Items.Add(new ApplicationMenuItem("角色管理", t, "/Role"));
            menuList.Add(item);

            item = new ApplicationMenuItem("商品管理", t, "#", icon: "", order: 0);
            item.Items.Add(new ApplicationMenuItem("商品列表", t, "/Service/Product"));
            menuList.Add(item);

            item = new ApplicationMenuItem("团长管理", t, "#", icon: "", order: 0);
            item.Items.Add(new ApplicationMenuItem("团长列表", t, "/Service/Head"));
            item.Items.Add(new ApplicationMenuItem("评价列表", t, "/Service/Evaluate"));
            menuList.Add(item);

            item = new ApplicationMenuItem("用户管理", t, "#", icon: "", order: 0);
            item.Items.Add(new ApplicationMenuItem("用户列表", t, "/Service/User"));
            menuList.Add(item);

            menuList.Normalize();
            return(menuList);
        }
Beispiel #3
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <DynamicEntityResource>();

            //Add main menu items.

            if (await context.IsGrantedAsync(DynamicEntityPermissions.FieldDefinition.Default) ||
                await context.IsGrantedAsync(DynamicEntityPermissions.ModelDefinition.Default)
                )
            {
                var menu = new ApplicationMenuItem(DynamicEntityMenus.DynamicEntityManagement, l["Menu:DynamicEntityManagement"]);

                if (await context.IsGrantedAsync(DynamicEntityPermissions.FieldDefinition.Default))
                {
                    menu.AddItem(
                        new ApplicationMenuItem(DynamicEntityMenus.FieldDefinition, l["Menu:FieldDefinition"], "/DynamicEntity/FieldDefinition")
                        );
                }

                if (await context.IsGrantedAsync(DynamicEntityPermissions.ModelDefinition.Default))
                {
                    menu.AddItem(
                        new ApplicationMenuItem(DynamicEntityMenus.ModelDefinition, l["Menu:ModelDefinition"], "/DynamicEntity/ModelDefinition")
                        );
                }

                context.Menu.AddItem(menu);
            }
        }
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <OrdersResource>();            //Add main menu items.

            var orderManagementMenuItem = new ApplicationMenuItem(OrdersMenus.Prefix, l["Menu:OrderManagement"]);

            if (await context.IsGrantedAsync(OrdersPermissions.Orders.Manage))
            {
                var storeAppService = context.ServiceProvider.GetRequiredService <IStoreAppService>();

                var defaultStore = (await storeAppService.GetDefaultAsync())?.Id;

                orderManagementMenuItem.AddItem(
                    new ApplicationMenuItem(OrdersMenus.Order, l["Menu:Order"], "/EShop/Orders/Orders/Order?storeId=" + defaultStore)
                    );
            }

            if (!orderManagementMenuItem.Items.IsNullOrEmpty())
            {
                var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == OrdersMenus.ModuleGroupPrefix,
                                                                () => new ApplicationMenuItem(OrdersMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"]));

                eShopMenuItem.Items.Add(orderManagementMenuItem);
            }
        }
Beispiel #5
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.ServiceProvider.GetRequiredService <IStringLocalizer <CmsResource> >();            //Add main menu items.

            var authorizationService = context.ServiceProvider.GetRequiredService <IAuthorizationService>();

            var cmsMenuItem = new ApplicationMenuItem("Cms", l["Menu:Cms"]);

            if (await authorizationService.IsGrantedAsync(CmsPermissions.Categories.Default))
            {
                cmsMenuItem.AddItem(
                    new ApplicationMenuItem("Category", l["Menu:Category"], "/Cms/Categories/Category")
                    );
            }

            if (await authorizationService.IsGrantedAsync(CmsPermissions.Articles.Default))
            {
                cmsMenuItem.AddItem(
                    new ApplicationMenuItem("Article", l["Menu:Article"], "/Cms/Articles/Article")
                    );
            }

            if (!cmsMenuItem.Items.IsNullOrEmpty())
            {
                context.Menu.Items.Add(cmsMenuItem);
            }
        }
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <WeChatPayResource>();            //Add main menu items.

            var weChatPayManagementMenuItem = new ApplicationMenuItem(WeChatPayMenus.Prefix, l["Menu:WeChatPayManagement"]);

            if (await context.IsGrantedAsync(WeChatPayPermissions.PaymentRecords.Default))
            {
                weChatPayManagementMenuItem.AddItem(
                    new ApplicationMenuItem(WeChatPayMenus.PaymentRecord, l["Menu:PaymentRecord"], "/PaymentService/WeChatPay/PaymentRecords/PaymentRecord")
                    );
            }

            if (await context.IsGrantedAsync(WeChatPayPermissions.RefundRecords.Default))
            {
                weChatPayManagementMenuItem.AddItem(
                    new ApplicationMenuItem(WeChatPayMenus.RefundRecord, l["Menu:RefundRecord"], "/PaymentService/WeChatPay/RefundRecords/RefundRecord")
                    );
            }

            if (!weChatPayManagementMenuItem.Items.IsNullOrEmpty())
            {
                var paymentServiceMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == WeChatPayMenus.ModuleGroupPrefix,
                                                                         () => new ApplicationMenuItem(WeChatPayMenus.ModuleGroupPrefix, l["Menu:EasyAbpPaymentService"]));

                paymentServiceMenuItem.Items.Add(weChatPayManagementMenuItem);
            }
        }
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <MiniProgramsResource>(); //Add main menu items.

            var miniProgramManagementMenuItem = new ApplicationMenuItem(MiniProgramsMenus.Prefix, l["Menu:MiniProgramManagement"]);

            if (await context.IsGrantedAsync(MiniProgramsPermissions.MiniProgram.Default))
            {
                miniProgramManagementMenuItem.AddItem(
                    new ApplicationMenuItem(MiniProgramsMenus.MiniProgram, l["Menu:MiniProgram"], "/WeChatManagement/MiniPrograms/MiniPrograms/MiniProgram")
                    );
            }
            if (await context.IsGrantedAsync(MiniProgramsPermissions.MiniProgramUser.Default))
            {
                miniProgramManagementMenuItem.AddItem(
                    new ApplicationMenuItem(MiniProgramsMenus.MiniProgramUser, l["Menu:MiniProgramUser"], "/WeChatManagement/MiniPrograms/MiniProgramUsers/MiniProgramUser")
                    );
            }
            if (await context.IsGrantedAsync(MiniProgramsPermissions.UserInfo.Default))
            {
                miniProgramManagementMenuItem.AddItem(
                    new ApplicationMenuItem(MiniProgramsMenus.UserInfo, l["Menu:UserInfo"], "/WeChatManagement/MiniPrograms/UserInfos/UserInfo")
                    );
            }

            if (!miniProgramManagementMenuItem.Items.IsNullOrEmpty())
            {
                var weChatManagementMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == MiniProgramsMenus.ModuleGroupPrefix,
                                                                           () => new ApplicationMenuItem("EasyAbpWeChatManagement", l["Menu:EasyAbpWeChatManagement"]));

                weChatManagementMenuItem.Items.Add(miniProgramManagementMenuItem);
            }
        }
        public virtual async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }

            var hasRolePermission = await context.IsGrantedAsync(IdentityPermissions.Roles.Default);

            var hasUserPermission = await context.IsGrantedAsync(IdentityPermissions.Users.Default);

            if (hasRolePermission || hasUserPermission)
            {
                var administrationMenu = context.Menu.GetAdministration();

                var l = context.GetLocalizer <IdentityResource>();

                var identityMenuItem = new ApplicationMenuItem(IdentityMenuNames.GroupName, l["Menu:IdentityManagement"], icon: "fa fa-id-card-o");
                administrationMenu.AddItem(identityMenuItem);

                if (hasRolePermission)
                {
                    identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Roles, l["Roles"], url: "~/Identity/Roles"));
                }

                if (hasUserPermission)
                {
                    identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Users, l["Users"], url: "~/Identity/Users"));
                }
            }
        }
Beispiel #9
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.ServiceProvider.GetRequiredService<IStringLocalizer<GiftCardManagementResource>>();            //Add main menu items.

            var menuItem = new ApplicationMenuItem("GiftCardManagement", l["Menu:GiftCardManagement"]);
            
            var authorizationService = context.ServiceProvider.GetRequiredService<IAuthorizationService>();

            if (await authorizationService.IsGrantedAsync(GiftCardManagementPermissions.GiftCardTemplates.Default))
            {
                menuItem.AddItem(
                    new ApplicationMenuItem("GiftCardTemplate", l["Menu:GiftCardTemplate"], "/GiftCardManagement/GiftCardTemplates/GiftCardTemplate")
                );
            }
            
            if (await authorizationService.IsGrantedAsync(GiftCardManagementPermissions.GiftCards.Consume))
            {
                menuItem.AddItem(
                    new ApplicationMenuItem("GiftCardConsumption", l["Menu:GiftCardConsumption"], "/GiftCardManagement/GiftCards/GiftCard/Consume")
                );
            }

            if (!menuItem.Items.IsNullOrEmpty())
            {
                context.Menu.AddItem(menuItem);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 将数据同步到数据库中
        /// </summary>
        /// <param name="p"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        private async Task <Menu> UpdateDBAsync(ApplicationMenuItem p, List <Menu> list, Guid parentId)
        {
            Menu item;

            if (list.Exists(x => x.Url == p.Url && x.Name == p.Name))
            {
                var t = list.First(x => x.Url == p.Url && x.Name == p.Name);
                t.Name     = p.Name;
                t.Order    = p.Order;
                t.Url      = p.Url;
                t.Icon     = p.Icon;
                t.ParentId = parentId;
                item       = await _repository.UpdateAsync(t);
            }
            else
            {
                item = await _repository.InsertAsync(new Menu
                {
                    Name     = p.Name,
                    Order    = p.Order,
                    Url      = p.Url,
                    Icon     = p.Icon,
                    ParentId = parentId
                });
            }

            return(item);
        }
Beispiel #11
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <PaymentsResource>();            //Add main menu items.

            var paymentManagementMenuItem = new ApplicationMenuItem("PaymentManagement", l["Menu:PaymentManagement"]);

            var storeAppService = context.ServiceProvider.GetRequiredService <IStoreAppService>();

            var defaultStore = (await storeAppService.GetDefaultAsync())?.Id;

            if (await context.IsGrantedAsync(PaymentsPermissions.Payments.Manage))
            {
                paymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem("Payments", l["Menu:Payments"], "/EShop/Payments/Payments/Payment?storeId=" + defaultStore)
                    );
            }
            if (await context.IsGrantedAsync(PaymentsPermissions.Refunds.Manage))
            {
                paymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem("Refunds", l["Menu:Refunds"], "/EShop/Payments/Refunds/Refund?storeId=" + defaultStore)
                    );
            }

            if (!paymentManagementMenuItem.Items.IsNullOrEmpty())
            {
                var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == "EasyAbpEShop",
                                                                () => new ApplicationMenuItem("EasyAbpEShop", l["Menu:EasyAbpEShop"]));

                eShopMenuItem.Items.Add(paymentManagementMenuItem);
            }
        }
Beispiel #12
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <PrepaymentResource>();
            //Add main menu items.

            var prepaymentManagementMenuItem = new ApplicationMenuItem(PrepaymentMenus.Prefix, l["Menu:PrepaymentManagement"]);

            if (await context.IsGrantedAsync(PrepaymentPermissions.Account.Manage))
            {
                prepaymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem(PrepaymentMenus.Account, l["Menu:Account"], "/PaymentService/Prepayment/Accounts/Account")
                    );
            }

            if (await context.IsGrantedAsync(PrepaymentPermissions.WithdrawalRequest.Manage))
            {
                prepaymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem(PrepaymentMenus.WithdrawalRequest, l["Menu:WithdrawalRequest"], "/PaymentService/Prepayment/WithdrawalRequests/WithdrawalRequest")
                    );
            }

            if (!prepaymentManagementMenuItem.Items.IsNullOrEmpty())
            {
                var paymentServiceMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == PrepaymentMenus.ModuleGroupPrefix,
                                                                         () => new ApplicationMenuItem(PrepaymentMenus.ModuleGroupPrefix, l["Menu:EasyAbpPaymentService"]));

                paymentServiceMenuItem.Items.Add(prepaymentManagementMenuItem);
            }
        }
Beispiel #13
0
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <BookManagementResource>();

            context.Menu.Items.Insert(0, new ApplicationMenuItem("BookStore.Home", l["Menu:Home"], "~/"));

            var bookStoreMenu = new ApplicationMenuItem(
                "BooksStore",
                l["Menu:BookManagement"],
                icon: "fa fa-book"
                );

            context.Menu.AddItem(bookStoreMenu);

            //CHECK the PERMISSION
            if (await context.AuthorizationService.IsGrantedAsync(BookManagementPermissions.Books.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Books",
                                          l["Menu:Books"],
                                          url: "/Books"
                                          ));
            }

            //CHECK the PERMISSION
            if (await context.AuthorizationService.IsGrantedAsync(BookManagementPermissions.Authors.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Authors",
                                          l["Menu:Authors"],
                                          url: "/Authors"
                                          ));
            }
        }
        public virtual async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            var l = context.ServiceProvider.GetRequiredService <IStringLocalizer <CosoIdentityResource> >();
            var authorizationService = context.ServiceProvider.GetRequiredService <IAuthorizationService>();

            if (context.Menu.Name == StandardMenus.User)
            {
                context.Menu.AddItem(new ApplicationMenuItem("Account.SecurityLogs", l["MyIdentitySecurityLogs"], url: "~/account/securitylogs", icon: "fa fa-cog", order: 1001, null));
            }
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }

            var administration = context.Menu.GetAdministration();
            var indentity      = administration.GetMenuItemOrNull(IdentityMenuNames.GroupName);

            if (indentity != null)
            {
                if (await authorizationService.IsGrantedAsync(CosoIdentityPermissions.OrganizationUnits.Default))
                {
                    var OrganizationUnitsMenuItem = new ApplicationMenuItem("OrganizationUnits", l["OrganizationUnits"], "~/Identity/organizationunits", "fa fa-copy", 1000);
                    indentity.AddItem(OrganizationUnitsMenuItem);
                }
                if (await authorizationService.IsGrantedAsync(CosoIdentityPermissions.IdentitySecurityLogs.Default))
                {
                    var IdentitySecurityLogsMenuItem = new ApplicationMenuItem("IdentitySecurityLogs", l["IdentitySecurityLogs"], "~/Identity/securitylogs", "fa fa-copy", 1001);
                    indentity.AddItem(IdentitySecurityLogsMenuItem);
                }
            }
        }
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <GiftCardManagementResource>();            //Add main menu items.

            var menuItem = new ApplicationMenuItem(GiftCardManagementMenus.Prefix, l["Menu:GiftCardManagement"]);

            if (await context.IsGrantedAsync(GiftCardManagementPermissions.GiftCardTemplates.Default))
            {
                menuItem.AddItem(
                    new ApplicationMenuItem(GiftCardManagementMenus.GiftCardTemplate, l["Menu:GiftCardTemplate"], "/GiftCardManagement/GiftCardTemplates/GiftCardTemplate")
                    );
            }

            if (await context.IsGrantedAsync(GiftCardManagementPermissions.GiftCards.Consume))
            {
                menuItem.AddItem(
                    new ApplicationMenuItem(GiftCardManagementMenus.GiftCardConsumption, l["Menu:GiftCardConsumption"], "/GiftCardManagement/GiftCards/GiftCard/Consume")
                    );
            }

            if (!menuItem.Items.IsNullOrEmpty())
            {
                context.Menu.AddItem(menuItem);
            }
        }
Beispiel #16
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <PaymentServiceResource>();            //Add main menu items.

            var paymentManagementMenuItem = new ApplicationMenuItem(PaymentServiceMenus.Prefix, l["Menu:PaymentService"]);

            if (await context.IsGrantedAsync(PaymentServicePermissions.Payments.Manage))
            {
                paymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem(PaymentServiceMenus.Payment, l["Menu:Payment"], "/PaymentService/Payments/Payment")
                    );
            }

            if (await context.IsGrantedAsync(PaymentServicePermissions.Refunds.Manage))
            {
                paymentManagementMenuItem.AddItem(
                    new ApplicationMenuItem(PaymentServiceMenus.Refund, l["Menu:Refund"], "/PaymentService/Refunds/Refund")
                    );
            }

            if (!paymentManagementMenuItem.Items.IsNullOrEmpty())
            {
                context.Menu.Items.GetOrAdd(i => i.Name == PaymentServiceMenus.Prefix,
                                            () => paymentManagementMenuItem);
            }
        }
Beispiel #17
0
        public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }

            var administrationMenu = context.Menu.GetAdministration();

            var authorizationService = context.ServiceProvider.GetRequiredService <IAuthorizationService>();
            var l = context.ServiceProvider.GetRequiredService <IStringLocalizer <IdentityResource> >();

            var identityMenuItem = new ApplicationMenuItem(IdentityMenuNames.GroupName, l["Menu:IdentityManagement"], icon: "fa fa-id-card-o");

            administrationMenu.AddItem(identityMenuItem);

            if (await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default))
            {
                identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Roles, l["Roles"], url: "/Identity/Roles"));
            }

            if (await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default))
            {
                identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Users, l["Users"], url: "/Identity/Users"));
            }
        }
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            if (!MultiTenancyConsts.IsEnabled)
            {
                var administration = context.Menu.GetAdministration();
                administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName);
            }

            var l = context.GetLocalizer <BookStoreResource>();

            context.Menu.Items.Insert(0, new ApplicationMenuItem(BookStoreMenus.Home, l["Menu:Home"], "~/"));

            var bookStoreMenu = new ApplicationMenuItem(
                "BooksStore",
                l["Menu:BookStore"],
                icon: "fa fa-book"
                );

            context.Menu.AddItem(bookStoreMenu);

            //CHECK the PERMISSION
            if (await context.IsGrantedAsync(BookStorePermissions.Books.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Books",
                                          l["Menu:Books"],
                                          url: "/Books"
                                          ));
            }
        }
        public virtual Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return(Task.CompletedTask);
            }

            var administrationMenu = context.Menu.GetAdministration();

            var l = context.GetLocalizer <AbpTenantManagementResource>();

            var tenantManagementMenuItem = new ApplicationMenuItem(
                TenantManagementMenuNames.GroupName,
                l["Menu:TenantManagement"],
                icon: "fa fa-users"
                );

            administrationMenu.AddItem(tenantManagementMenuItem);

            tenantManagementMenuItem.AddItem(new ApplicationMenuItem(
                                                 TenantManagementMenuNames.Tenants,
                                                 l["Tenants"],
                                                 url: "~/tenant-management/tenants",
                                                 requiredPermissionName: TenantManagementPermissions.Tenants.Default
                                                 ));

            return(Task.CompletedTask);
        }
Beispiel #20
0
        public virtual Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return(Task.CompletedTask);
            }

            var administrationMenu = context.Menu.GetAdministration();

            var l = context.GetLocalizer <IdentityResource>();

            var identityMenuItem = new ApplicationMenuItem(IdentityMenuNames.GroupName, l["Menu:IdentityManagement"],
                                                           icon: "far fa-id-card");

            administrationMenu.AddItem(identityMenuItem);

            identityMenuItem.AddItem(new ApplicationMenuItem(
                                         IdentityMenuNames.Roles,
                                         l["Roles"],
                                         url: "~/identity/roles").RequirePermissions(IdentityPermissions.Roles.Default));

            identityMenuItem.AddItem(new ApplicationMenuItem(
                                         IdentityMenuNames.Users,
                                         l["Users"],
                                         url: "~/identity/users").RequirePermissions(IdentityPermissions.Users.Default));

            return(Task.CompletedTask);
        }
Beispiel #21
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <ProductsResource>();

            //Add main menu items.

            var productManagementMenuItem = new ApplicationMenuItem(ProductsMenus.Prefix, l["Menu:ProductManagement"]);

            if (await context.IsGrantedAsync(ProductsPermissions.Categories.Manage))
            {
                productManagementMenuItem.AddItem(
                    new ApplicationMenuItem(ProductsMenus.Category, l["Menu:Category"], "/EShop/Products/Categories/Category")
                    );
            }

            if (await context.IsGrantedAsync(ProductsPermissions.Products.Manage))
            {
                productManagementMenuItem.AddItem(
                    new ApplicationMenuItem(ProductsMenus.Product, l["Menu:Product"], "/EShop/Products/Products/Product")
                    );
            }

            if (!productManagementMenuItem.Items.IsNullOrEmpty())
            {
                var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == ProductsMenus.ModuleGroupPrefix,
                                                                () => new ApplicationMenuItem(ProductsMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"], icon: "fa fa-shopping-bag"));

                eShopMenuItem.Items.Add(productManagementMenuItem);
            }
        }
Beispiel #22
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <CouponsResource>(); //Add main menu items.

            var couponManagementMenuItem = new ApplicationMenuItem(CouponsMenus.Prefix, l["Menu:CouponManagement"]);

            if (await context.IsGrantedAsync(CouponsPermissions.CouponTemplate.Default))
            {
                couponManagementMenuItem.AddItem(
                    new ApplicationMenuItem(CouponsMenus.CouponTemplate, l["Menu:CouponTemplate"], "/EShop/Plugins/Coupons/CouponTemplates/CouponTemplate")
                    );
            }
            if (await context.IsGrantedAsync(CouponsPermissions.Coupon.Default))
            {
                couponManagementMenuItem.AddItem(
                    new ApplicationMenuItem(CouponsMenus.Coupon, l["Menu:Coupon"], "/EShop/Plugins/Coupons/Coupons/Coupon")
                    );
            }

            if (!couponManagementMenuItem.Items.IsNullOrEmpty())
            {
                var eShopMenuItem = context.Menu.Items.GetOrAdd(i => i.Name == CouponsMenus.ModuleGroupPrefix,
                                                                () => new ApplicationMenuItem(CouponsMenus.ModuleGroupPrefix, l["Menu:EasyAbpEShop"], icon: "fa fa-shopping-bag"));

                eShopMenuItem.Items.Add(couponManagementMenuItem);
            }
        }
Beispiel #23
0
        public async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }

            var appLocalizer = context.GetLocalizer <MyAbpResource>();


            context.Menu.Items.Insert(
                0,
                new ApplicationMenuItem(
                    "MyAbp.Home",
                    appLocalizer["Menu:Home"],
                    "/",
                    icon: "home"
                    )
                );

            var administrationMenu = context.Menu.GetAdministration();

            administrationMenu.Items.RemoveAll(m => true);
            administrationMenu.Icon = "global";
            administrationMenu.Url  = "/admin";

            var hasTenantPermission = await context.IsGrantedAsync(TenantManagementPermissions.Tenants.Default);

            if (hasTenantPermission)
            {
                var tenantLocalizer          = context.GetLocalizer <AbpTenantManagementResource>();
                var tenantManagementMenuItem = new ApplicationMenuItem(TenantManagementMenuNames.GroupName, tenantLocalizer["Menu:TenantManagement"], url: "/tenant", icon: "solution");
                administrationMenu.AddItem(tenantManagementMenuItem);
                tenantManagementMenuItem.AddItem(new ApplicationMenuItem(TenantManagementMenuNames.Tenants, tenantLocalizer["Tenants"], url: "/tenant/tenants"));
            }

            var hasRolePermission = await context.IsGrantedAsync(IdentityPermissions.Roles.Default);

            var hasUserPermission = await context.IsGrantedAsync(IdentityPermissions.Users.Default);

            if (hasRolePermission || hasUserPermission)
            {
                var identityLocalizer = context.GetLocalizer <IdentityResource>();

                var identityMenuItem = new ApplicationMenuItem(IdentityMenuNames.GroupName, identityLocalizer["Menu:IdentityManagement"], url: "/identitys", icon: "team");
                administrationMenu.AddItem(identityMenuItem);

                if (hasRolePermission)
                {
                    identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Roles, identityLocalizer["Roles"], url: "/identitys/roles"));
                }

                if (hasUserPermission)
                {
                    identityMenuItem.AddItem(new ApplicationMenuItem(IdentityMenuNames.Users, identityLocalizer["Users"], url: "/identitys/users"));
                }
            }
        }
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <BookStoreResource>();

            context.Menu.Items.Insert(
                0,
                new ApplicationMenuItem(
                    "BookStore.Home",
                    l["Menu:Home"],
                    "/",
                    icon: "fas fa-home"
                    )
                );


            //context.Menu.AddItem(
            //    new ApplicationMenuItem(
            //        "BooksStore",
            //        l["Menu:BookStore"],
            //        icon: "fa fa-book"
            //    ).AddItem(
            //        new ApplicationMenuItem(
            //            "BooksStore.Books",
            //            l["Menu:Books"],
            //            url: "/books"
            //        )
            //    )
            //);
            var bookStoreMenu = new ApplicationMenuItem(
                "BooksStore",
                l["Menu:BookStore"],
                icon: "fa fa-book"
                );

            context.Menu.AddItem(bookStoreMenu);

            //CHECK the PERMISSION
            if (await context.IsGrantedAsync(BookStorePermissions.Books.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Books",
                                          l["Menu:Books"],
                                          url: "/books"
                                          ));
            }

            if (await context.IsGrantedAsync(BookStorePermissions.Authors.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Authors",
                                          l["Menu:Authors"],
                                          url: "/authors"
                                          ));
            }
        }
        private Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer<BloggingResource>();

            var managementRootMenuItem = new ApplicationMenuItem("BlogManagement", l["Menu:BlogManagement"], requiredPermissionName: BloggingPermissions.Blogs.Management);

            managementRootMenuItem.AddItem(new ApplicationMenuItem("BlogManagement.Blogs", l["Menu:Blogs"], "~/Blogging/Admin/Blogs", requiredPermissionName: BloggingPermissions.Blogs.Management));

            context.Menu.GetAdministration().AddItem(managementRootMenuItem);

            return Task.CompletedTask;
        }
Beispiel #26
0
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var authorizationService = context.ServiceProvider.GetRequiredService <IAuthorizationService>();
            var l = context.ServiceProvider.GetRequiredService <IStringLocalizer <BloggingResource> >();

            if (await authorizationService.IsGrantedAsync(BloggingPermissions.Blogs.Default))
            {
                var rootMenuItem = new ApplicationMenuItem("Blogs", l["Menu:Blogs"], "/Blog");

                context.Menu.AddItem(rootMenuItem);
            }
        }
Beispiel #27
0
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            if (!MyProjectNameConsts.IsMultiTenancyEnabled)
            {
                ApplicationMenuItem administration = context.Menu.GetAdministration();
                administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName);
            }

            var l = context.ServiceProvider.GetRequiredService <IStringLocalizer <MyProjectNameResource> >();

            context.Menu.Items.Insert(0, new ApplicationMenuItem("MyProjectName.Home", l["Menu:Home"], "/"));
        }
        public virtual async Task ConfigureMenuAsync(MenuConfigurationContext context)
        {
            if (context.Menu.Name != StandardMenus.Main)
            {
                return;
            }

            var l = context.GetLocalizer <DocumentManagementResource>();

            var documentManagementMenuItem = new ApplicationMenuItem(DocumentManagementMenuNames.GroupName, l["Menu:DocumentManagement"], icon: "fa fa-book");

            context.Menu.AddItem(documentManagementMenuItem);

            documentManagementMenuItem.AddItem(new ApplicationMenuItem(DocumentManagementMenuNames.Documents, l["Documents"], url: "~/DocumentManagement/Documents")); //, requiredPermissionName: DocumentManagementPermissions.Documents.Default));

            var operationMenuItem = new ApplicationMenuItem(DocumentManagementMenuNames.OperationData, l["MenuOperationData"], url: "#");

            documentManagementMenuItem.AddItem(operationMenuItem);

            var documentTypes = await _documentTypeAppService.GetListAsync(new GetDocumentTypesInput
            {
                MaxResultCount = 1000,
                SkipCount      = 0
            });

            if (documentTypes != null && documentTypes.Items.Any())
            {
                foreach (var documentType in documentTypes.Items)
                {
                    operationMenuItem.Items.Add(new ApplicationMenuItem(documentType.Code, documentType.Name, url: $"~/DocumentManagement/Documents/OperationData?Code={documentType.Code}"));
                }
            }

            var departmentMenuItem = new ApplicationMenuItem(DocumentManagementMenuNames.DepartmentData, l["MenuDepartmentData"], url: $"#");

            documentManagementMenuItem.AddItem(departmentMenuItem);

            var departments = await _departmentAppService.GetListAsync(new GetDepartmentsInput
            {
                MaxResultCount = 1000,
                SkipCount      = 0
            });

            if (departments != null && departments.Items.Any())
            {
                foreach (var department in departments.Items)
                {
                    departmentMenuItem.Items.Add(new ApplicationMenuItem(department.Code, department.Name, url: $"~/DocumentManagement/Documents/DepartmentData?Code={department.Code}"));
                }
            }

            return;
        }
        private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
        {
            if (!MultiTenancyConsts.IsEnabled)
            {
                var administration = context.Menu.GetAdministration();
                administration.TryRemoveMenuItem(TenantManagementMenuNames.GroupName);
            }
            var l = context.GetLocalizer <BookStoreResource>();

            context.Menu.Items.Insert(0, new ApplicationMenuItem("BookStore.Home", l["Menu:Home"], "~/"));

            var bookStoreMenu = new ApplicationMenuItem(
                "BooksStore",
                l["Menu:BookStore"],
                icon: "fas fa-chevron-circle-down"
                );

            //CHECK the PERMISSION OF AUTHORS IN BOOKSTOREMENU CONTRIBUTOR
            if (await context.IsGrantedAsync(BookStorePermissions.Authors.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Authors",
                                          l["Menu:Authors"],
                                          url: "/Authors",
                                          icon: "fas fa-chevron-right"
                                          ));
            }

            //CHECK the PERMISSION
            if (await context.IsGrantedAsync(BookStorePermissions.Books.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Books",
                                          l["Menu:Books"],
                                          url: "/Books",
                                          icon: "fas fa-chevron-right"
                                          ));
            }

            //CHECK the PERMISSION OF SLIDE
            if (await context.IsGrantedAsync(BookStorePermissions.Slides.Default))
            {
                bookStoreMenu.AddItem(new ApplicationMenuItem(
                                          "BooksStore.Slides",
                                          l["Menu:Slides"],
                                          url: "/Slides",
                                          icon: "fas fa-chevron-right"
                                          ));
            }

            context.Menu.AddItem(bookStoreMenu);
        }
        private async Task ConfigureMainMenu(MenuConfigurationContext context)
        {
            var l = context.GetLocalizer <ProductManagementResource>();

            var rootMenuItem = new ApplicationMenuItem("ProductManagement", l["Menu:ProductManagement"]);

            if (await context.IsGrantedAsync(ProductManagementPermissions.Products.Default))
            {
                rootMenuItem.AddItem(new ApplicationMenuItem("Products", l["Menu:Products"], "/ProductManagement/Products"));
            }

            context.Menu.AddItem(rootMenuItem);
        }
Beispiel #31
0
		public OpenWithMenu (string mime)
		{
			list = GetApplications (mime);

			if (list == null)
				return;

			foreach (MimeApplication app in list) {
				ApplicationMenuItem i = new ApplicationMenuItem (this, app);
				i.Activated += HandleItemActivated;
				Append (i);
			}
		}
Beispiel #32
0
 private void AddApplicationMenu()
 {
     ApplicationMenu menu = ComponentManager.ApplicationMenu;
     if (menu != null && menu.MenuContent != null)
     {
         // Create our Application Menu Item
         ApplicationMenuItem mi = new ApplicationMenuItem();
         mi.Text = appText;
         mi.Description = appDesc;
         mi.LargeImage = GetIcon(largeFile);
         // Attach the handler to fire out command
         mi.CommandHandler = new AutoCADCommandHandler(bpCmd);
         // Add it to the menu content
         menu.MenuContent.Items.Add(mi);
     }
 }