Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "fawad29"

Is there any update please?

Answer

So what would be the best place to read menu from the database? I would need a value from session to retreive menu from the database. You mentioned current function in previous reply where is this function? Please reply comprehensively if possible with example so that I can close this ticket quickly. Thanks

Answer

Do we have access to AbpSession.UserId in SetNavigation method?

Yes, I just need to get the menu from the database and display them with any permission dependcies as well. Is this a suitable placce?

If I declare a class as static what will be the scope of it, will it be application wide or tenant wide. I would like to store validation error messages in a database table, each tenant will have their own set of validation error messages. I was thinking of loading error messages for each tenant and keep them in cache in a static class so that I dont' have to inject it all the time as the error message will not change and keep the resources as low as possible. However, each tenant can have their own set of error messages so I was wondering about the scope of static class. As you know in c#, a static class exists only once so their only one copy of data so I was wondering how my proposed design will work. Or if you have an alternative way of handling it in ANZ, then please suggest.

The paramter is unknow because it is an Id of selected student, consider the follownig scenario:

when you login first, you are taken to a list of students, you must select a student first before you go to any other page via menu. Once you have a selected a client and you click on LinkA, I want this javascript function to be called so that I can append student Id. From LinkA user may click on LinkB so I would then again append the student Id so that LinkB shows data for the selected student only. As I said, I can do that when user clicks on Edit button on any page, because I grab click function, append Id and change location.href.

I know I can use session, however, problem with session is that if user opens the first page in a new tabl and select a different student then session value will get overwritten and both tabls will then be linked to the latest session. However, if I can call a javascript function whenever a menu is clicked then I can append student id to Url and I can have two tabs opened showing details for different students at the same time which is what I want to achieve.

Answer

Do you mean I should get menu from database in SetNavigation function of AppNavigationProvider1 as shown below?

public override void SetNavigation(INavigationProviderContext context)
        {
            var menu = context.Manager.Menus[MenuName] = new MenuDefinition(MenuName, new FixedLocalizableString("Main Menu"));
            
            var myList = _myMenuService.GetMenusByMyParameter(_mySession.myParameter);
            
            foreach(MyMenuItem myMenuItem in myList)
            {
               menu.AddItem(new MenuItemDefinition(
                        myMenuItem.Text,
                        L(myMenuItem.Text),
                        url: myMenuItem.url,
                        icon: myMenuItem.icons,
                        permissionDependency: new SimplePermissionDependency(myMenuItem.permissionString)
                    )
            }
            
         }
Question

I would like to create menu from the items stored in the database, instead of hardwiring them in AppNavigationProvider.cs. Do you have a sample example for this purpose? What should be the database look like for this purpose and in what format menus should be returned to abp.nav.menus.MainMenu?

I am using ANZ v8 MVC Core and Jquery.

I am using ANZ version 8, when I run the default application, it shows menus on the left. If I am on Dasbhoard page and I click on Demo UI Components menu, it launches the page via URL App/DemoUIComponents. I would like to pass a parameter when this link is clicked so that URL beomes App/DemoUIComponents/1234. The parameter value will not be known until Dashboard page launches. Similalry when I am on Demo UI component page and I click on Dashboard menu then I would like to pass an id parameter to Dashboard page as well.

I can pass id parameter via javascript if I have a button on a page and I click on it using the following link. Can I

$('#EditButton').click(function () {
`location.href = '@Html.Raw(@Url.Action("EditView", new {id = Model.id }))'`
 });

Can I trap a client side event for menu click as well?

How can this be procedure be implemented, I do not want to use session because sessions are not unique to each browser tab?

Hi @ismcagdas,

I have found UserManager class, but it does not have IsGranted method? Where shall I find IsGranted method because as per @ryancyq suggestion I would need to changed it so that i set it to true if User's current primary group has permission for a menu and false if he/she has not? I am assuming simply setting IsGranted to false will hide the menu.

Thank you @ryancyq, I am learning ANZ so please bear with me.

I have created both tables, where should I create PermissionGroupRoleRemover event handler? I have created GroupID instead of UserId in PermissionGroup table.

I can't find AbpUserManager in my solution, do I need to extend any class?

Thanks

Showing 51 to 60 of 79 entries