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

Activities of "alexanderpilhar"

Answer

I also make ASPNETZERO classes partial when I need to extend them somehow. But when merging I still have to check the ASPNETZERO classes because they are marked to be different since I added partial to them. If they would be partial from begin with, merging process would be a little easier/faster (less checks to do).

Although I have not tried with with ASP MVC + jQuery, this should be what you want:

context.Create(
    AppFeatures.SampleSelectionFeature,
    defaultValue: "B",
    displayName: L("Sample selection feature"),
    inputType: new ComboboxInputType(
        new StaticLocalizableComboboxItemSource(
            new LocalizableComboboxItem("A", L("Selection A")),
            new LocalizableComboboxItem("B", L("Selection B")),
            new LocalizableComboboxItem("C", L("Selection C"))
        )
    )
)[FeatureMetadata.CustomFeatureKey] = new FeatureMetadata
{
    IsVisibleOnPricingTable = true
};

Thank you @ismcagdas!

Created Issue: [FeatureChecker should make use of Localization when throwing AbpAuthorizationException #4365](https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4365)

Thanks a lot @ismcagdas!

Using

new AppMenuItem("MenuItemName", "PermissionName", "fas fa-icon", "/app/main/page", undefined, undefined, undefined, () => {
    return this._featureCheckerService.isEnabled("FeatureName");
})

works : )

Hi @ismcagdas! So, it is not translated, right?

I extended app-navigation-service.ts like follows:

...
import { FeatureCheckerService } from '@abp/features/feature-checker.service';
...
constructor(
    private _permissionCheckerService: PermissionCheckerService,
    private _featureCheckerService: FeatureCheckerService,
    private _appSessionService: AppSessionService
) { }
...
checkFeature(feature: string): boolean {
    const result = this._featureCheckerService.isEnabled(feature);
    abp.log.info(`Feature.isEnabled: ${result}`);
    return result;
}
...
new AppMenuItem("MenuItemName", "PermissionName", "fas fa-icon", "/app/main/page", null, null, null, this.checkFeature("FeatureName"))

But result is always false ...

EDIT

There was a type in my feature name ... now I'm back at ERROR TypeError: "this.featureDependency is not a function" since the function is executed (!?) when passed on ... changing it to:

new AppMenuItem("MenuItemName", "PermissionName", "fas fa-icon", "/app/main/page", null, null, null, (): boolean => { return this.checkFeature("FeatureName"); })

leads to: ERROR TypeError: "_v.parent.context.item.items is null"

If I do it like this (app-navigation.service.ts):

new AppMenuItem("MenuItemName", "PermissionName", "fas fa-icon", "/app/main/page", null, null, null, "FeatureName")

then browser console shows error messages.

One of the errors says: ERROR TypeError: "this.featureDependency is not a function". This is because of (app-navigation.service.ts):

showMenuItem(menuItem: AppMenuItem): boolean {        
        ...
        if (menuItem.hasFeatureDependency() && !menuItem.featureDependencySatisfied()) {
            hideMenuItem = true;
        }
        ...        
}

and (app-menu-item.ts):

featureDependencySatisfied(): boolean {
        if (this.featureDependency) {
            return this.featureDependency();
        }

        return false;
}

this.featureDependency() does not exist ... at least, it's not a function but a property of type any.

Do i have to pass on some function?

H @ryancyq! No, it's none of the features provided by ANZ but one of my custom features coming from a custom feature provider. I used RequiresFeature attribute as described here: Using RequiresFeature Attribute

When I call a service method that requires a certain feature using a user lacking of certain feature, I get above message - it works correct, it's just not translated properly. Not just the feature name (which is not translated at all but showing the translation-key), but the whole message is in English but should be in German.

I think, permission checker might work quite similar - there are no issues with permission checker. Also, I can find according translations in localization files for permssion checker. But not for feature checker.

6.7.0, Angular, .NET Framework

I want to display certain AppMenuItems only in dependency of certain features.

I couldn't find anything about it in documentation, but I found a 2 years old support question here: [Using featureDependency in Navigation Provider? #1880](https://support.aspnetzero.com/QA/Questions/1880)

The problem is, I don't know where to import SimpleFeatureDependency from.

It seems there is no translation for exception-messages thrown because of missing features (I can't find it in localization files):

Showing 131 to 140 of 224 entries