Activities of "chofoza"

Question
  • ABP Framework version: v4.1.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): no
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi, I'd like to customise the user menu in the main toolbar:

  1. remove/hide the Security Logs option
  2. replace the username with Name

I can see the function ConfigureToolbarAsync in the ToolbarContributor where it gets added, but I don't know how to edit the object or intercept it. I am guessing I need to override the class that calls ConfigureToolbarAsync but I am too new to this so am a little lost. Help is appreciated!

  • ABP Framework version: v4.1.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): no

Hi, I have added a new boolean field to the User object called Active. I have overwridden the Register page to set this to false for new users and it works.

I have also added a new menu item under User Management that goes to Identity/Users/Inactive. I've created the Inactive.cshtml/cs page for it, as well as Inactive.js to edit the Actions to only have Activate and Delete. The Activate function correctly sets the field to true and reloads the page, so most of what I want is working.

My problem: how do I filter the Users list that loads on the Inactive page? I have only been able to use the 'filter' option but that seems to only search on name/surname, and I can't get it to filter on another field.

That part of the js file is:

        var _$table = _$wrapper.find('table');
        var getInactiveFilter = function () {
            return {
                filter: 'test',
            };
        };
           abp.libs.datatables.normalizeConfiguration({
               order: [[1, 'asc']],
               processing: true,
               serverSide: true,
               scrollX: true,
               paging: true,
               ajax: abp.libs.datatables.createAjax(
                   _identityUserAppService.getList, getInactiveFilter
               ),
               columnDefs: abp.ui.extensions.tableColumns.get('identity.user').columns.toArray()
           })
       );

I have tried to make the getInactiveFilter function look like this (testing on a named field before attempting ExtraProperties):

var getInactiveFilter = function () {
            return {
                name: 'test',
            };
        };

That doesn't work at all - the parameter isn't even passed in the ajax request.

What I really want to do is filter the list in 2 ways (at once):

  1. only show users where Active=false
  2. only show users that are within the OU hierarchy of the current logged in user

The Inactive page is only visible to users within a certain role, and they will be approving new users that register within their OU structure. Can anyone help with the filtering?

  • ABP Framework version: v4.1.0
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Seperated (Angular): no

Hi, I feel like this is an easy one...

I have a new property (bool Active) on the User object, stored in ExtraProperties. I want to reference it on the razor page, but the CurrentUser (ICurrentUser) object doesn't have it or ExtraProperties. How can I read the value?

In my example basically I want to do:

@if (CurrentUser.IsAuthenticated && CurrentUser.ExtraProperties["Active"])

Thank you - the first part to remove the security logs from the menu works!

On the new Default.cshtml page though the actual Model object is null, so it fails on the line checking Model.Items.Any(). The model in your code is an ApplicationMenu which seems correct.

Any ideas what the issue is?

Thank you, it worked. I had tried to use the UserManager but obviously was too lazy to find its namespace so wasted a question instead!

Thanks for your help.

This was my fault. I left @page in at the top of the page when I created the new file. All sorted now. Thanks for the help.

Hi @gterdem.

I got all of this working, but have been struggling with part 2 of my question. I am pretty sure I can get the linq query working to filter on the current users OU's (or start with GetUsersInOrganizationUnitWithChildrenAsync and then filter on Active only) but I can't work out how to get the current user in my EntityFrameworkCore project. I've tried various dependency injections but I keep getting errors. I also tried passing the user ID along with the Ajax but it's ignored.

Can you please help?

Also in my dev environment if I view the Inactive page and the normal Users page they both behave normally. However in production whichever one I view first is what I continue to see (ie if I look at Inactive first, I see the same filter and Actions when I go to Users, and vice versa). This only seems to be an issue in prod and I can't reproduce it in dev. Any ideas?

Ok I have sorted out the filtering issue. I didn't understand how easy the dependency injection was but finally got my head round that. I am injecting the httpContextAssessor and the OU repository, and then finding the current users OU and calling the GetUsersInOrganizationUnitWithChildrenAsync method with its Code.

The other problem I mentioned above is still happening: In dev if I look at my Inactive page and my normal Users page, they behave as expected. In live, whichever one I look at first becomes the "default" and I can't see the other one. The screens are very similar obviously, but the filter is fixed to the first one I chose, and the Actions list is fixed to the first one too. Something is being cached somewhere it shouldn't but I can't figure out why this only affects live and the dev behaviour is perfect?

Hi @cotur, I have the CLI and Suite both on RC2, but when I try add the Cms-Kit I get an error that it could not be found.

Am I using the wrong "name" for it? This is what I have: abp add-module Cms-Kit (and I've tried variations of the name too)

For anyone wondering the command line to install Cms Kit is abp add-module Volo.CmsKit

Showing 1 to 10 of 16 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11