Activities of "maliming"

hi

What is the purpose of "organization unit"?

https://aspnetboilerplate.com/Pages/Documents/Zero/Organization-Units

can i use "organization unit" to filter data? if yes then how?

https://docs.abp.io/en/abp/latest/Data-Filtering

is it possible that user of "organization unit" can view record of only self "organization unit" ? if not how we can achieve it?

You need to implement it yourself.

It depends on your business logic.

hi

The MainHeaderToolbarUserMenu class

using System;
using System.Text;
using System.Threading.Tasks;
using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Options;
using Microsoft.JSInterop;
using Volo.Abp.Http.Client;
using Volo.Abp.MultiTenancy;
using Volo.Abp.UI.Navigation;
using Volo.Abp.Users;

namespace Volo.Abp.AspNetCore.Components.WebAssembly.LeptonTheme.Components.ApplicationLayout.MainHeader;

public partial class MainHeaderToolbarUserMenu : IDisposable
{
    [Inject]
    protected IMenuManager MenuManager { get; set; }

    [Inject]
    protected ICurrentUser CurrentUser { get; set; }

    [Inject]
    protected ICurrentTenant CurrentTenant { get; set; }

    [Inject]
    protected SignOutSessionStateManager SignOutManager { get; set; }

    [Inject]
    protected NavigationManager Navigation { get; set; }

    [Inject]
    protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }

    [Inject]
    protected IStringLocalizer<AbpUiResource> UiLocalizer { get; set; }

    [Inject]
    protected IOptions<AbpRemoteServiceOptions> RemoteServiceOptions { get; set; }

    [Inject]
    protected IJSRuntime JsRuntime { get; set; }

    protected ApplicationMenu UserMenu { get; set; }

    protected Guid? UserId { get; set; }

    protected string UserName { get; set; }

    protected string TenantName { get; set; }

    protected string ProfileImageUrl { get; set; }

    protected string UserFullName { get; set; }

    protected override async Task OnInitializedAsync()
    {
        await SetUserMenuAndProfileAsync();

        Navigation.LocationChanged += OnLocationChanged;
        AuthenticationStateProvider.AuthenticationStateChanged += AuthenticationStateProviderOnAuthenticationStateChanged;
    }

    private async Task SetUserMenuAndProfileAsync()
    {
        UserMenu = await MenuManager.GetAsync(StandardMenus.User);

        UserId = CurrentUser.Id;
        UserName = CurrentUser.UserName;
        UserFullName = CalculateUserFullName();
        TenantName = CurrentTenant.Name;

        if (UserId != null)
        {
            ProfileImageUrl = RemoteServiceOptions.Value.RemoteServices.Default?.BaseUrl?.TrimEnd('/') +
                              $"/api/account/profile-picture-file/{UserId}";
        }
    }

    protected virtual void OnLocationChanged(object sender, LocationChangedEventArgs e)
    {
        InvokeAsync(StateHasChanged);
    }

    private async void AuthenticationStateProviderOnAuthenticationStateChanged(Task<AuthenticationState> task)
    {
        await SetUserMenuAndProfileAsync();
        await InvokeAsync(StateHasChanged);
    }

    protected virtual async Task BeginSignOut()
    {
        await SignOutManager.SetSignOutState();
        await NavigateToAsync("authentication/logout");
    }

    protected virtual async Task NavigateToAsync(string uri, string target = null)
    {
        if (target == "_blank")
        {
            await JsRuntime.InvokeVoidAsync("open", uri, target);
        }
        else
        {
            Navigation.NavigateTo(uri);
        }

    }

    protected virtual string CalculateUserFullName()
    {
        //TODO: Should we move this logic to some extension method for the ICurrentUser?

        var fullName = new StringBuilder();

        if (!CurrentUser.Name.IsNullOrEmpty())
        {
            fullName.Append(CurrentUser.Name);
        }

        if (!CurrentUser.SurName.IsNullOrEmpty())
        {
            if (fullName.Length > 0)
            {
                fullName.Append(" ");
            }

            fullName.Append(CurrentUser.SurName);
        }

        if (fullName.Length == 0)
        {
            fullName.Append(CurrentUser.UserName);
        }

        return fullName.ToString();
    }

    public void Dispose()
    {
        Navigation.LocationChanged -= OnLocationChanged;
        AuthenticationStateProvider.AuthenticationStateChanged -= AuthenticationStateProviderOnAuthenticationStateChanged;
    }
}

HI

Are your all apps use the same abp packages version?

hi

We will fix this in the next version. Thanks

hi

You can override the TenantManager class,

https://github.com/abpframework/abp/blob/dev/docs/en/UI/Blazor/Customization-Overriding-Components.md

<AuthorizeView>
    <Authorized>
        @if ( UserMenu != null )
        {
            <BarItem>
                <BarDropdown>
                    <BarDropdownToggle Class="btn">
                        <img src="@ProfileImageUrl" width="21" class="user-avatar me-1" alt="@UserName" />
                        @if ( TenantName != null )
                        {
                            <span><i>@TenantName</i>\@UserName</span>
                        }
                        else
                        {
                            <span>@UserName</span>
                        }
                    </BarDropdownToggle>
                    <BarDropdownMenu RightAligned="true">
                        <BarDropdownItem>
                            <Row Padding="Padding.Is2">
                                <Column ColumnSize="ColumnSize.IsAuto" Padding="Padding.Is0.FromEnd">
                                    <img src="@ProfileImageUrl" class="user-avatar-big" width="48" alt="@UserName" />
                                </Column>
                                <Column Padding="Padding.Is2.FromStart">
                                    <span>@UiLocalizer["Welcome"]</span><br />
                                    <Strong>@UserFullName</Strong>
                                </Column>
                            </Row>
                        </BarDropdownItem>
                        <DropdownDivider />
                        @foreach ( var item in UserMenu.Items )
                        {
                            <BarDropdownItem id="@item.ElementId" Class="@item.CssClass" Clicked="() => NavigateToAsync(item.Url, item.Target)">@item.DisplayName</BarDropdownItem>
                        }
                        <BarDropdownItem Clicked="BeginSignOut">@UiLocalizer["Logout"]</BarDropdownItem>
                    </BarDropdownMenu>
                </BarDropdown>
            </BarItem>
        }
    </Authorized>
    <NotAuthorized>
        <a class="nav-link btn" href="authentication/login">@UiLocalizer["Login"]</a>
    </NotAuthorized>
</AuthorizeView>

hi

We will fix this in angular proxy, Thanks.

hi

Can you try to get latest source code of Lepton and override the MainHeaderToolbarUserMenu?

Showing 9471 to 9480 of 11531 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 17, 2025, 07:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.