Yes you need to update the user permission to allow to access to the dashboard.
Any error in console?
@firnas you need to enable the dashboard on C# and go to http://host:port/!#/hangfire
//Enable it to use HangFire dashboard (uncomment only if it's enabled in clayWebModule)
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
});
on web module file Startup.cs
I try to implement my custom Session to store some information (es. companyId) I use this code
public interface IMySession : ITransientDependency
{
long CompanyId { get; set; }
void SetCompanyId(long companyId);
}
public class NullableMySession : IMySession
{
private static readonly NullablemySession SingletonInstance = new NullableMySession();
public static NullableMySession Instance
{
get { return NullableMySession.SingletonInstance; }
}
public long CompanyId { get; set; }
public void SetCompanyId(long companyId)
{
}
}
public class MySession : IMySession
{
public long CompanyId
{
get;
set;
//get
//{
// var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
// if (claimsPrincipal == null)
// {
// return 0;
// }
// var company = claimsPrincipal.Claims.FirstOrDefault(c => c.Type == myConsts.SessionCompany);
// if (company == null || string.IsNullOrEmpty(company.Value))
// {
// return 0;
// }
// return System.Convert.ToInt32(company.Value);
//}
}
public void SetCompanyId(long companyId)
{
var claimsPrincipal = Thread.CurrentPrincipal as ClaimsPrincipal;
var claimsIdentity= Thread.CurrentPrincipal.Identity as ClaimsIdentity;
var company = claimsPrincipal.Claims.FirstOrDefault(c=> c.Type == myConsts.SessionCompany);
if (company != null)
{
claimsIdentity.RemoveClaim(company);
}
claimsIdentity.AddClaim(new Claim(myConsts.SessionCompany, companyId.ToString()));
}
}
If I try to set value after login on Principal the new value is not persisted on Principal, so I move to simple solution store on session. I add a
public IMySession MySession { get; set; }
protected demoAppServiceBase()
{
LocalizationSourceName = clayConsts.LocalizationSourceName;
MySession = NullableMySession.Instance;
}
But Any time to redo a call from API the value is not persisted on mySession so I add the row on coreModule preInitialize
IocManager.IocContainer.Register(Component.For<IMySession, MySession>().ImplementedBy<MySession>());
After do that the value is persistend on all call, but is it the correct way or I make some mistakes?
Mattia
Thank @aaron to your suggestion but after a lot of time this approch not work. Here is my code
public interface IMustHaveCompany
{
long CompanyId { get; set; }
}
public class Person : FullAuditedEntity, IMustHaveCompany
{
public long CompanyId { get; set; }
public string Name { get; set; }
}
// On coreModule -> PreInitialize()
...
Configuration.UnitOfWork.RegisterFilter("CompanyFilter", true);
// On DbContext Class
public override void Initialize()
{
base.Initialize();
// If I uncomment this the stack say me
// System.ApplicationException: Filter name CompanyFilter not found
//this.SetFilterScopedParameterValue(
// "CompanyFilter",
// "companyId",
// 2);
}
protected void OnodelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Filter("CompanyFilter",
(IMustHaveCompany entity, int companyId) => entity.CompanyId == companyId, () =>
{
return 19;
});
}
// I try to call on TenantDashboardAppService
CurrentUnitOfWork.SetFilterParameter("CompanyFilter", "CompanyId", 19);
var q = _personManager.Persons.ToArray();
public interface IPersonManager : IDomainService
{
IQueryable<Person> Persons { get; }
}
public class PersonManager : demoServiceBase, IPersonManager
{
private readonly IRepository<Person> _repository;
public PersonManager(IRepository<Person> repository)
{
_repository = repository;
}
public virtual IQueryable<Person> Persons
{
get { return _repository.GetAll(); }
}
}
What is wrong??? When I look on Configuration.UnitOfWork the filter is regitered on PreInit with 0 parameter, but it's the same for tenant May/Must
@sunflowerlab you can use KendoUi Table, I rememeber that exist an example of usege on ABP (old version but is in jQuery)
about this article Articles/How To/add custom data filter ef core is possibile to do the same on MVC abp (Abp version 4.2)?
hi @ismcagdas
I try to flow your suggestion but my interface are not registered. Last week I update to lastest ABP 4.2 and this week I try it again.
I have a multiple instance of IReportData so I register it on PreInitialize of my module
IocManager.IocContainer.Register(
Component.For<IReportData, Expense>().ImplementedBy<Expense>(),
Component.For<IReportData, Invoice>().ImplementedBy<Invoice>()
);
In this way I need to register every new IReportData, how can I do it automatically via IocManager.IocContainer?
@yekalkan thank you for your suggestion
@mohamedaarif are you ask if exists a way to put data from remote side to ABP/ANZ website?
If it's correct I do that via local stream service on remote side and I use supersocket http://www.supersocket.net/