Base solution for your next web application

Activities of "klainer"

Hello, thanks for your awesome work! I Have some question about using ABP. I downloaded ABP - Module Zero template, after that I extend Core project with code which I use for dynamic loading DLL subsystems. Subsystem is a normal Project with area registration class. This subsystem is loaded to Web folder called "Subsystems". In web project I created PreStart class which inicialize subsystem. Everything works, subsystem is loaded and area registered. But I want to use repositories and services form ABP in this dynamicly loaded subsystem. When i create controller like below I got this error:

'CmsSubsystem.Services.TeacherAppService' is waiting for the following dependencies:

  • Service 'Abp.Domain.Repositories.IRepository`1[[CmsSubsystem.Entities.Ucitel, CmsSubsystem, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

When I´m loading dynamic dll of subsystem (area) in CoreModule I register assembly dependecy like this:

dependencyContainer.RegisterAssemblyByConvention(AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == "CmsSubsystem"));

But services, repositories no works... Which is the correct way and place to register dependencies when I´m using this appropoach (cutom project with area registration class compiled to dll and moved to WebModule Subsystems folder).

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Abp.Authorization;
using Abp.Domain.Repositories;
using Abp.Web.Mvc.Authorization;
using Abp.Web.Mvc.Controllers;
using CmsSubsystem.Entities;
using CmsSubsystem.Services;

namespace CmsSubsystem.Controllers
{
    [AbpMvcAuthorize]
    public class DashboardController : BaseController
    {

        private IUcitelAppService _ucitelAppService;

        public DashboardController(IUcitelAppService ucitelAppService)
        {
            _ucitelAppService = ucitelAppService;
        }

        public ActionResult Index()
        {
            IQueryable<Ucitel> ucitele = _ucitelAppService.GetUcitele();
            return View(ucitele);
        }
    }
}

Thanks for tips !

Hello,

I have problem with using KENDO UI componets with ABP. I have test home controller :

public ActionResult CategoriesRead([DataSourceRequest]DataSourceRequest request)
        {

            List<Work> lissOfWorks = new List<Work>() {
                new Work { Name = "Martin", SureName = "HAHA1", ProjectName = "Projekt A", Date = DateTime.Today },
                new Work { Name = "Ondřej", SureName = "HAHA2", ProjectName = "Projekt B", Date = DateTime.Today },
                new Work { Name = "Tomáš", SureName = "HAHA3", ProjectName = "Projekt A", Date = DateTime.Today },
                new Work { Name = "Lukáš", SureName = "HAHA4", ProjectName = "Projekt B", Date = DateTime.Today },
            };

            DataSourceResult result = lissOfWorks.ToDataSourceResult(request, work => new {
                work.Name,
                work.SureName,
                work.ProjectName,
            });

            return Json(result);
        }

In home view this:

@(Html.Kendo().Grid<BB.BB.Web.Models.Work>()
      .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(work => work.Name);
          columns.Bound(work => work.SureName);
          columns.Bound(work => work.ProjectName);
      })
      .DataSource(dataSource =>
        dataSource.Ajax().Read(read => read.Action("CategoriesRead", "Home"))
      )
      .Pageable() // Enable paging
      .Sortable() // Enable sorting
)

ABP covert ajax response with custom wrapper data and GRID no work:

error: null
result: {data: [{name: "Ondřej", sureName: "HAHA1", projectName: "Projekt A"},…], total: 4,…}
success: true
unAuthorizedRequest: false

The response should look like this:

AggregateResults: null
Data: [{Name: "Ondřej", SureName: "Pětník", ProjectName: "HAHA1 B"},…]
Errors: null
Total: 4

How solve this issue ? thanks !

Hello, how locallize sweet alerts buttons ? I found in code this:

abp.event.on('abp.dynamicScriptsInitialized', function () {
        abp.libs.sweetAlert.config.confirm.title = abp.localization.abpWeb('AreYouSure');
        abp.libs.sweetAlert.config.confirm.cancelButtonText = abp.localization.abpWeb('Cancel');
        abp.libs.sweetAlert.config.confirm.confirmButtonText = abp.localization.abpWeb('Yes');
    });

Where are this rosources ? In Localization AbpWeb resource is missing... Thnaks for help !

I checked this document, tried this:

Configuration.Localization.Sources.Extensions.Add(
                new LocalizationSourceExtensionInfo("AbpWeb",
                    new XmlFileLocalizationDictionaryProvider(
                        HttpContext.Current.Server.MapPath("~/Localization/AbpWebExtensions")
                        )
                    )
                );

And overide the names in resource file, but it dont work.

Thnaks for tips!

Hello,

I need to override default SMTP server setting configuration. I created this class:

public class MySettingProvider : SettingProvider
    {
        public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
        {
            return new[]
                    {
                    new SettingDefinition(
                        "SmtpServerAddress",
                        "192.168.50.14"
                        )
                };
        }
    }

And in Web.Module I´m calling this:

public override void PreInitialize()
 {
            Configuration.Settings.Providers.Add<MySettingProvider>();
}

But this no work! What is correct appropoach to do it ? Thnaks !

Works, thanks !!

Hello, i often need to use another table for users, mostly is a VIEW from another system like Active Directory. Is is possible to have custom View table for users and using role, permission and another good functionality of ABP ?

My poople view look like:

PeopleView: Login, Department, Email with thousands of row.

User will be automaticly logged to system by his login - Windows Auth.

Do anybody have the same problem ?

Thanks !

Thanks for reply! Let´s assume that I need to use different table than AbpUser for login check, how would you preoceed ? For login to apllication is windows username needed, if username is in DB , then user is logged. Thats all..

By the way Views is possible to map...

Thanks !

Ok I used your basic sample, with simply retun true. I registered this MyExternalAuthSource, in Web project.

public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }

    public class MyExternalAuthSource : DefaultExternalAuthenticationSource<Tenant, User>
    {
        public override string Name
        {
            get { return "MyCustomSource"; }
        }

         

        public override async Task<bool> TryAuthenticateAsync(string userNameOrEmailAddress, string plainPassword, Tenant tenant)
        {
            //TODO: authenticate user and return true or false
            return true;
        }
    }

But i dont know what i must tu do next for login person by using this external source. In documentation this is missing and I´m confused . What i must change in Login method in auth controller ?

I algo got this error:

No component for supporting the service TT.MyExternalAuthSource was found

Popis: Při provádění aktuálního webového požadavku došlo k neošetřené výjimce. Další informace o chybě a o jejím původu v kódu naleznete v trasování zásobníku. 

Podrobnosti o výjimce: Castle.MicroKernel.ComponentNotFoundException: No component for supporting the service TT.MyExternalAuthSource was found

Ok I solved this by add this code to intialization of Core Module:

public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
            IocManager.Register<MyExternalAuthSource>(DependencyLifeStyle.Transient);
        }

Mayby another question. I notice that when use Custom auth login, AbpUser table automaticly create new record for logged person name and also generate password. Is this appropoach good for my situation ( I have onother table with users) so roles and other stuff are still depended on AbpUser ?

Thnaks for any tip!

Ok tahnks works. I´m aldo traing LDAP auth:

In my core module in PreInitialize method I call this:

IocManager.Register<ILdapSettings, MNDLdapSettings>(); //change default setting source
Configuration.Modules.ZeroLdap().Enable(typeof(MyLdapAuthenticationSource));

I have also class:

public class MyLdapAuthenticationSource : LdapAuthenticationSource<Tenant, User>
    {
        public MyLdapAuthenticationSource(ILdapSettings settings, IAbpZeroLdapModuleConfig ldapModuleConfig)
            : base(settings, ldapModuleConfig)
        {
        }
    }

Then i Created this settings class:

public class MNDLdapSettings : ILdapSettings
    {
        public async Task<bool> GetIsEnabled(int? tenantId)
        {
            return true;
        }

        public async Task<ContextType> GetContextType(int? tenantId)
        {
            return ContextType.Domain;
        }

        public async Task<string> GetContainer(int? tenantId)
        {
            return "";
        }

        public async Task<string> GetDomain(int? tenantId)
        {
            return "domain";
        }

        public async Task<string> GetUserName(int? tenantId)
        {
            return "name";
        }

        public async Task<string> GetPassword(int? tenantId)
        {
            return "pass";
        }
    }

I also tried use your default setting like you noted:

Note: If you don't define domain, username and password, LDAP authentication works for current domain if your application runs in a domain with appropriate privileges.

And try enable LDAP like in this post / last unanswered question: #205@a9e9ccf7-5841-4126-9423-c0d5b678eb9b

But no work , the same problem with : Abp.AbpException: There is no setting defined with name: Abp.Zero.Ldap.IsEnabled

When is LDAP enablet and in cotroller is [AbdAuthorized] attribute. User will be logged automaticly ?

Please help ... Thnaks!

But auth no work for me, how can I detect error in credectials etc or debug auth using LDAP ? Thnaks

Showing 1 to 10 of 31 entries