Base solution for your next web application

Activities of "blewis"

I am playing around with version 5.3 CORE MVC + jQuery and I have a question concerning customizing a table that is using DataTable. I discovered that ABP has a set of customizations for DataTable located in the datatables.default.js and datatables.ajax.js files. I can follow most of the logic in these files, but I cannot figure out how to override the defaults in the datatable.defaults.js file on a page by page basis. For example, I want to change the default page length from 10 row to 25, but only for certain pages. I see the default of 10 in the defaults.js, but in my page specific js, when I call DataTable, it ignores any attempt to override the default of 10. For example, if I try something like:

var dataTable = _$myPageTable.DataTable({
            paging: true,
            pageLength: 25,
            serverSide: true,
            processing: true,
            listAction: {
                ajaxFunction: _auditLogService.getAuditLogs,
                inputFilter: function () {
                    return createRequestParams();
                }
            }...

I have tried various combinations of possible settings, but I cannot figure this out. What am I missing? I want o do similar overrides for other features, like changing the "entries" in "Showing X to Y entries" to something that's more page specific.

Thanks, Bryan

Question

I think I know the answer to this is "No", but I wanted to ask just to see if anyone had a thought about it. We have a need to associate roles with specific Organization Units (OU) and allow users to have different roles with different units.

Our company is in education, and typically we have users who are administrators, aides or teachers. However, we often have users who have multiple jobs and so they may act as a teacher within the context of a specific school, but may have an administrative role in the context of their district. Setting up a hierarchy of districts and schools within the OU data structure is easy. But how hard is it to say that User A has role Adminfor OU District 1, but role Teacher for OU School 2? As I understand it, this is not possible. The user is simply a member of each OU and has both roles in all contexts. Any ideas?

Thanks, Bryan

We have an AspNetZero app currently deployed on an Azure WebApp that runs between 3 and 5 instances at a given time. Currently we are using the default in-memory cache provider, but I am looking to changing this to Redis. If we do that (by creating an Azure Redis cache and uncommenting the Redis config in WebCoreModule), will Abp use Redis for its session info also?

I would like to disable the Afinity Cookie in the Azure web app so that user sessions are no longer sticky to a specific machine and can be served by any machine in the cluster for any request (with all session state being in Redis). Is that the only change needed? Or is there something different for session storage?

Thanks, Bryan

The project that we are working on has fairly high requirements concerning compliance with web accessibility standards (WCAG, Section 508, etc).

Currently, most of the pages and web forms that are pre-built in the Zero project templates are not very accessible. Web form fields are not linked to their corresponding labels ("for" attribute). The use of ARIA attributes is also limited.

If possible, it would be a nice enhancement to include accessibility markup as part of the base Zero template so we don't have to go through and add it.

Thanks, Bryan

I use the AbpMvcAuthorize attribute on many controller methods (not the entire controller) to grant privileges. However, if the user doesn't have that permission, the default action of the attribute seems to be to redirect back to the login page. Because I am using OpenID SSO, it redirects the user to the SSO login page. What I want to do is to just take them to a static "Unauthorized" page that I have created. Is that possible?

Thanks, Bryan

I will be deploying my project to Azure, which doesn't support SMTP. I have created a new EmailSenderSendGrid class that implements IEmailSender but uses the SendGrid API.

I then added:

IocManager.Register<IEmailSender, EmailSenderSendGrid>();

to the PostInitialize() method of my ProjectNameCoreModule.cs (in the Core project) in an attempt to register the new implementation. However, when I attempt to send an email from an MVC controller, it throws and exception and that exception is coming from Abp.MailKit.MailKitEmailSender. So that implies it's still trying to use MailKit and not my class. What am I doing wrong?

This is the first time I am trying to use the IocManager to register my own implementation...so perhaps I am screwing that up.

Thanks, Bryan

I have users across the United States and I need to display UTC dates that are stored in the DB in the user's local time. I understand all of the concepts of converting UTC times to local time within ASP.Net, but not within the ABP framework.

I am using the Asp.Net CORE MVC & jQuery project. Where should I be setting the clock provider to Utc? Startup.cs? After the provider is set, all I need to do is create a Abp.Timing.TimeZone setting for the tenant and/or user and my DB results from Entity Framework will be auto converted to the local timezone?

Thanks, Bryan

Question

I am new to ABP and relatively new to AutoMapper, so I am a bit stumped about why some code is throwing an exception. I am trying to have one of my AppService methods return a Dto , but it throws an exception when I call ObjectMapper.Map().

The exception is : AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

But since the "schools" variable is an anonymous type, I can't setup a mapping configuration, right? The Dto is super simple, just one field. I could eliminate the use of AutoMapper, but I would like to be consistent and use it in all cases just like the existing AppServices.

namespace MyProject.Organizations.Dto
{
    public class SchoolSearchDto
    {
        public string DisplayName { get; set; }
    }
}

The AppService method:

public async Task<ListResultDto<SchoolSearchDto>> SchoolSearch(SchoolSearchInput input)
        {
            var query = from uou in _extendedOrganizationUnitRepository.GetAll()
                        where uou.DisplayName.Contains(input.SchoolName)
                        select new { uou.DisplayName, uou.ParentId };

            var schools = await query.WhereIf(input.ParentId != null, p => p.ParentId == input.ParentId).ToListAsync();

            return new ListResultDto<SchoolSearchDto>(
                ObjectMapper.Map<List<SchoolSearchDto>>(schools)
                );
        }

I also tried using this return statement:

return new ListResultDto<SchoolSearchDto>(
                schools.Select(school =>
                {
                    var dto = ObjectMapper.Map<SchoolSearchDto>(school.ou);
                    return dto;
                }).ToList());

I have created a bunch of app services that inherit from AsyncCrudAppService, and everything works fine. However, when I am reviewing the Audit logs, the "Service" column for every call to GetAll() is "AsyncCrudAppService." I understand why, but it would be more useful if the log recorded my app service name, not the base service name. It makes it hard to keep track of things if all those calls are not differentiated. Just a suggestion.

Thanks, Bryan

The Zero Template comes with the _layout.cshtml file containing a hardcoded page title (title tag). Is there an easy/built-in way to make the name of the active menu/nav item the page title? I have looked through the docs and I don't see anything.

Showing 1 to 10 of 14 entries