Base solution for your next web application

Activities of "davidharrison"

Question

Hi Guys,

When I'm logged into the applciation, I want to be able to get my current AuthToken. In the browser console, if I look at the abp.auth object, one if the properties is tokenCookieName which is set too "Abp.AuthToken", but the browser doesn't have a cookie called "Abp.AuthToken". There is also a function called getToken, but if I call this in the console, I only get a null result, presumably because there isn't a "Abp.AuthToken" cookie?

How do I get the current auth token client side? Does something additional need to be configured in the application?

Thanks,

David

project is .NET Core Zero 6.9 MVC & jQuery

Hi guys,

We're currently using .Net Core MVC + jQuery version 6.9.

We host our application in Azure and when we swap our application slots between staging and production, all current users on the system get kicked and are forced to log in again, due to a loss of session.

We've done some research into session management with .Net and Azure, and there seem to be a few options, but we also noticed that in the .Net Zero Documentation it says:

ASP.NET Boilerplate provides an IAbpSession interface to obtain the current user and tenant without using ASP.NET's Session.

Does this mean that any standard methods for managing session will not work with .Net Zero? If not, has anyone implemented an alternative?

If this isn't an issue, then the three main methods that we've come across so far are these:

1.Table Storage 2.SQL Azure 3.Windows Azure Caching (using Redis)

Has anyone implemeneted one of these session management techniquies? Where there any hidden pitfalls or traps that you encountered? Alternatively, does anyone from the .Net Zero team have feedback/suggestions on this matter?

Thanks,

David

Hi all,

I'm setting up editions in my application at the moment and I want my application areas to be controlled by both features and permissions, and as an extension of that, I want to show and hide menu items, first by feature dependency and then by permission dependency. I have implemented this in the way that I understand it needs to be done, but menu items still show up when the logged in users edition doesn't allow for that feature to be seen.


.AddItem(new MenuItemDefinition(
                            FalconPageNames.Common.OrganizationUnits,
                            L("Teams"),
                            url: "Falcon/OrganizationUnits",
                            icon: "fa fa-sitemap",
                            featureDependency: new SimpleFeatureDependency(true, AppFeatures.TeamsManagement),
                            permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_Administration_OrganizationUnits)
                        )

What have I done to make this not work, or what haven't I done? Any help or pointers appreciated.

Hi All,

We've recently encountered an issue wherein when our .Net Zero application is ruinning on a domain (but not in LocalHost) using Chrome, if you have several tabs open all to the same domain app instance, loading tabs and/or calls to the application hang, and Chrome displays a notification in the bottom left hand corner, saying "Waiting for avalible socket". When this is present, the app comes to a standstill on the client, and remains this way until tabs are closed, freeing up sockets and allowing the waiting calls to process.

We've investigated as to what was blowing out Chromes socket connection allowances, and as far as we can tell, it's SignalR's requests that are largly responsible for consuming the avalible sockets. Disabling the Chat feature (which uses SignalR) and disabling the following to SignalR scripts: <script src="@(ApplicationPath)lib/@@aspnet/signalr/dist/browser/signalr.min.js/signalr.min.js" asp-append-version="true"></script> <script src="@(ApplicationPath)lib/abp-web-resources/Abp/Framework/scripts/libs/abp.signalr-client.js" asp-append-version="true"></script> Seems to have stopped the issue, and our app can be used with as many requests as we like, without encountering the socket availability issue, albeit at the cost of any functionality that uses SignalR.

Has this been encountered by anyone else, and therefore, does someone know how to resolve this without removing SignalR, or is this a new issue?

Implementing the RequiresFeature attribute on either an MVC controller or Application Service class or method throws a 500 Internal Server Error when the current user doesn't have the required feature, rather than throwing an AbpAuthorizationException, as the ABP documentation states that it should:

This method is executed only if the "ExportToExcel" feature is enabled for the current tenant (current tenant is obtained from IAbpSession). If it's not enabled, an AbpAuthorizationException is thrown automatically.

I've implemented the RequiresFeature attribute in the same way as shown by the documentation:

Abp Implementation [RequiresFeature("ExportToExcel")] public async Task<FileDto> GetReportToExcel(...) { ... }

My Implementation [RequiresFeature("App.RoleManagement")] public async Task<GetRoleForEditOutput> GetRoleForEdit(...) { ... }

Hi all,

I'm in the process of building out unit tests for the new functionality that we've added to our .net zero project. So far, for the app services, this is going swimmingly. However we have several pieces of functionality that sit in domain layer managers, and I'm struggling to implement unit tests for those.

My first question is, is there an ideal or proper way of implementing a unit test in .net zero for domain layer managers?

Where I've managed to get so far is creating an interface for the domain manager, which allows it to be resolvable in the unit test project. When running the test, it correctly creates an instance of the manager, but then fails due to a disposed object error on a repository. This isn't an issue when running a unit test on an app service that calls a method inside of a manager that uses a repository, but I'm not sure what the missing difference is between an app service unit test and a domain manager unit test.

If I'm on the right path with this approch, how does one correctly resolve a domain manager such that it correctly used the test context? (Which I guessing is what fails with the disposed object error)

Thanks,

David

Hi Guys,

I'm in the process of setting up editions, and creating and implementing features for the editions.

I'm currently trying to restrict access to certain views/app services based on needing to have a required feature. Using the following implementations:

featureDependency: new SimpleFeatureDependency(true, "App.AppBuilder") I can hide menu items

[RequiresFeature("App.AppBuilder")] or if (await FeatureChecker.IsEnabledAsync("App.AppBuilder")) { throw new AbpAuthorizationException("You don't have this feature: App Builder"); } I can restrict access to an MVC controller or App Service.

These work well and out of the box for tenant users, however, I am finding that host users get blocked from the controllers that have these feature checks implemented on them.

Do I need to implement the checks differently or is there some additional code that I need to add that allows host users access to feature restricted areas without having an edition assigned?

Thanks, David

Question

Hi Guys,

I've recently begun building out unit tests in our .net zero project and I don't currently fully understand how the unit tests manage user context.

I've noticed that the AbpSession.UserId value when the tests are running is set to user 2. How does the testing framework chose this user and set as user context?

Is it possible to change which user context all the tests or certain tests run under?

Thanks,

David

Hi Guys,

I've added a new feature into the application, as shown below:

    public static class AppFeatures
    {
        public const string SubmissionLimit = "App.SubmissionLimit";
        public const string StarterSubmissionLimit = "App.StarterSubmissionLimit";
    }
    
    public class AppFeatureProvider : FeatureProvider
    {
        public override void SetFeatures(IFeatureDefinitionContext context)
        {
            var submissionLimit = context.Create(
                AppFeatures.SubmissionLimit,
                defaultValue: "true",
                displayName: L("SubmissionLimit"),
                inputType: new CheckboxInputType()
                );

            submissionLimit.CreateChildFeature(
                AppFeatures.StarterSubmissionLimit,
                defaultValue: "100",
                displayName: L("StarterSubmissionLimit"),
                inputType: new SingleLineStringInputType(new NumericValueValidator(0, 100))
                );
        } 
    }

I am able to see these new features in the edit edition modal and I am able to select them, however the new features don't appear in the AbpFeatures table as having been assigned to the edition - is there something that I am missing here?

Hi Guys,

If you are loading a view or a partial view, how do you correctly throw an error (for example if a permission check has been run to verify user is authorized to view view) and then handle the thrown error?

We've tried working with UserFriendlyException but as far as we can ascertain, there is a mismatch between the return types and error handling types. If our understanding is correct, when requesting a view, the request is expecting an html view/error view to return, but the UserFriendlyException returns a json format error?

Thanks

Showing 1 to 10 of 17 entries