Ends in:
7 DAYS
14 HRS
32 MIN
25 SEC
Ends in:
7 D
14 H
32 M
25 S

Activities of "vd"

  • ABP Framework version: v8.3.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Auth Server Separated (for Angular): no
  • Steps to reproduce the issue:

Create a FeatureDefinitionProvider class in Application.Contracts :

using MyApp.Localization;
using Volo.Abp.Features;
using Volo.Abp.Localization;
using Volo.Abp.Validation.StringValues;

namespace MyApp.Features
{
    public class MyAppFeatureDefinitionProvider : FeatureDefinitionProvider
    {
        public override void Define(IFeatureDefinitionContext context)
        {
            var myGroup = context.AddGroup("MyApp");

            myGroup.AddFeature(
                "MyApp.MyFeature",
                defaultValue: "false",
                displayName: LocalizableString
                                 .Create<MyAppResource>("SomeFeature"),
                valueType: new ToggleStringValueType()
            );
        }
    }
}

Enable the feature :

Refresh the page then get the feature. I expect it to be 'true' but it's always false.

First I tried in route.provider.ts

import { ConfigStateService, RoutesService, eLayoutType } from '@abp/ng.core';
import { APP_INITIALIZER } from '@angular/core';

export const APP_ROUTE_PROVIDER = [{ provide: APP_INITIALIZER, useFactory: configureRoutes, deps: [RoutesService, ConfigStateService], multi: true }];

function configureRoutes(routes: RoutesService, config: ConfigStateService) {
    return () => {
        routes.add([
	    //...
            {
                path: '/mymy',
                name: '::Menu:MyFeature',
                iconClass: 'fas fa-whatever',
                order: 3,
                parentName: '::Menu:MyParent',
                layout: eLayoutType.application,
                //requiredPolicy: 'MyApp.MyFeature', 			 // ---> Doesn't work (I guess it only works with permissions)
                //invisible: config.getFeature('MyApp.MyFeature') != 'false',// ---> Always 'false'
            },
        ]);
    };
}

Second in app.component.ts :

import { Component } from '@angular/core';
import { NavItemsService, UserMenuService } from '@abp/ng.theme.shared';
import { eThemeLeptonXComponents, eUserMenuItems } from '@volosoft/abp.ng.theme.lepton-x';
import { ConfigStateService, ReplaceableComponentsService, RoutesService } from '@abp/ng.core';

@Component({
    selector: 'app-root',
    template: `
        &lt;abp-loader-bar&gt;&lt;/abp-loader-bar&gt;
        &lt;abp-dynamic-layout&gt;&lt;/abp-dynamic-layout&gt;
        &lt;abp-gdpr-cookie-consent&gt;&lt;/abp-gdpr-cookie-consent&gt;
    `,
})
export class AppComponent {
    constructor(
        private replaceComponent: ReplaceableComponentsService,
        private config: ConfigStateService,
        private routes: RoutesService,
    ) {
        let myFeature = this.config.getFeature('MyApp.MyFeature');  // ---> Always 'false'

        if (myFeature === 'false') {
            this.routes.remove(['::Menu:MyFeature']);
        }
    }
}

  • abp version: 8.3.1
  • Template: app
  • Created ABP Studio Version: 0.8.1
  • Tiered: No
  • UI Framework: angular
  • Theme: leptonx
  • Theme Style: system
  • Database Provider: ef
  • Database Management System: sqlserver
  • Separate Tenant Schema: No
  • Mobile Framework: none
  • Progressive Web App: No
  • Public Website: No
  • Optional Modules:
    • GDPR
    • FileManagement
    • TextTemplateManagement
    • LanguageManagement
    • AuditLogging
    • SaaS
    • OpenIddictAdmin

How can I easily hide the bottom-right menu items ? Can I hide them separately or should I hide them one by one ?

Question
  • ABP Framework version: v7.4.4
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Auth Server Separated (for Angular): no

I'm trying to implement public user automatic authentication (for permission management). When users access the website, I want them to be automatically connected under a single "public" user.

I tried this in app.component :

ngOnInit(): void {
        
        //...
        
        const currentUser = this.config.getOne("currentUser");

        if(currentUser == null || currentUser.id == null){
            const loginParams: LoginParams = {
                username: 'public',
                password: '**********'
            }
            this.authService.login(loginParams).subscribe(
                () => {
                    window.location.reload();
                }
            );
        }
    }

window.location.reload() is currently necessary to refresh the top right menu. If I don't reload the page, upon clicking on the user menu I get an error :

app.component.ts:38 ERROR TypeError: Cannot read properties of undefined (reading 'toggle')
    at ToolbarContainerComponent.toggleCtxMenu (volosoft-ngx-lepton-x-layouts.mjs:373:22)
    at ToolbarContainerComponent_Template_lpx_toolbar_profileClick_0_listener (volosoft-ngx-lepton-x-layouts.mjs:377:362)
    at executeListenerWithErrorHandling (core.mjs:16195:16)
    at Object.wrapListenerIn_markDirtyAndPreventDefault [as next] (core.mjs:16228:22)
    at ConsumerObserver.next (Subscriber.js:91:33)
    at SafeSubscriber._next (Subscriber.js:60:26)
    at SafeSubscriber.next (Subscriber.js:31:18)
    at Subject.js:34:30
    at errorContext (errorContext.js:19:9)
    at EventEmitter_.next (Subject.js:27:21)

How can I avoid reloading the page ?

I also tried moving the authentication code to an APP_INITIALIZER in app.module, but then, the authService is not yet initialized

Hi,

I have the exact same issue as 5179 (same abp version, angular, same configuration, same reproduce steps)

I see that you closed it without providing a solution. Is there a solution ?

Showing 1 to 4 of 4 entries
Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06