Base solution for your next web application
Open Closed

Tenant Specific Menu. #2710


User avatar
0
velu created

How to create Tenant Specific Menu?

Please help me on that

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

9 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Do you want to create a menu item for all tenants or for just a specific tenant ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    Do you want to create a menu item for all tenants or for just a specific tenant ?

    Just a specific tenant.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    This is not possible directly but, you can do it like this:

    1. When defining related permission for menu item, set a feature dependency like this
    var sampleBooleanFeaturePermission = pages.CreateChildPermission(
        name: AppPermissions.Pages_Tenant_SampleBooleanFeature,
        displayName: L("SampleBooleanFeature"),
        isGrantedByDefault: false,
        multiTenancySides: MultiTenancySides.Tenant,
        featureDependency: new SimpleFeatureDependency(AppFeatures.SampleBooleanFeature)
    );
    
    1. Then give this permisison to only that tenant.

    I hope this helps.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    This is not possible directly but, you can do it like this:

    1. When defining related permission for menu item, set a feature dependency like this
    var sampleBooleanFeaturePermission = pages.CreateChildPermission(
       name: AppPermissions.Pages_Tenant_SampleBooleanFeature,
       displayName: L("SampleBooleanFeature"),
       isGrantedByDefault: false,
       multiTenancySides: MultiTenancySides.Tenant,
       featureDependency: new SimpleFeatureDependency(AppFeatures.SampleBooleanFeature)
    );
    
    1. Then give this permisison to only that tenant.

    I hope this helps.

    Does not have parameter named isGrantedByDefault in CreateChildPermission. I am not able to achieve this if any full example or document available then.

    Please provide us.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Sorry, this property is deleted. The main thing here is

    featureDependency: new SimpleFeatureDependency(AppFeatures.SampleBooleanFeature)
    

    You need to define a feature and use it when defining menu item. Then in the UI, allow the tenants you want for this feature.

    I hope this is clear enough.

    Thanks.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    Sorry, this property is deleted. The main thing here is

    featureDependency: new SimpleFeatureDependency(AppFeatures.SampleBooleanFeature)
    

    You need to define a feature and use it when defining menu item. Then in the UI, allow the tenants you want for this feature.

    I hope this is clear enough.

    Thanks.

    Please give more information not able to achieve.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can follow below steps to achieve similar functionality.

    1. Open AppFeatures.cs and add a new feature, for example
    public const string MyCustomMenuFeature= "App.MyCustomMenuFeature";
    
    1. Then open AppFeatureProvider.cs and add the feature like this.
    context.Create(
        AppFeatures.MyCustomMenuFeature,
        defaultValue: "false",
        displayName: L("MyCustomMenuFeature"),
        inputType: new CheckboxInputType()
    );
    
    1. When defininng your menu item use this feature
    .AddItem(new MenuItemDefinition(
        "Customers",
        L("Customers"),
        url: "tenant.customers",
        icon: "icon-globe",
        requiredPermissionName: AppPermissions.Pages_Customers,
        featureDependency:new SimpleFeatureDependency(AppFeatures.MyCustomMenuFeature)
        )
    )
    
    1. Then run the application, login as host admin, open tenant list, select the tenant you want and grand that tenant the feature "AppFeatures.MyCustomMenuFeature".

    In this way, only that tenant is going to see the menu item.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    velu created

    <cite>ismcagdas: </cite> Hi,

    You can follow below steps to achieve similar functionality.

    1. Open AppFeatures.cs and add a new feature, for example
    public const string MyCustomMenuFeature= "App.MyCustomMenuFeature";
    
    1. Then open AppFeatureProvider.cs and add the feature like this.
    context.Create(
       AppFeatures.MyCustomMenuFeature,
       defaultValue: "false",
       displayName: L("MyCustomMenuFeature"),
       inputType: new CheckboxInputType()
    );
    
    1. When defininng your menu item use this feature
    .AddItem(new MenuItemDefinition(
       "Customers",
       L("Customers"),
       url: "tenant.customers",
       icon: "icon-globe",
       requiredPermissionName: AppPermissions.Pages_Customers,
       featureDependency:new SimpleFeatureDependency(AppFeatures.MyCustomMenuFeature)
       )
    )
    
    1. Then run the application, login as host admin, open tenant list, select the tenant you want and grand that tenant the feature "AppFeatures.MyCustomMenuFeature".

    In this way, only that tenant is going to see the menu item.

    Thanks Working...

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)